« Back to channel list

#RubyOnRails - 07 January 2016

« Back 1 day Forward 1 day »
[00:02:43] art-solopov: has joined #RubyOnRails
[00:03:48] mostlybadfly: has joined #RubyOnRails
[00:03:56] Radar: juddey: tbh I had forgotten I had posted about that. That's a blast from the past :)
[00:05:07] lacuna: has joined #RubyOnRails
[00:05:07] lacuna: has joined #RubyOnRails
[00:05:54] mattrse: Anyone looking for a full-time Rails position? PM me
[00:06:54] juddey: Radar: six years on and still delivering value :) Now i just have to figure out why its not working in my controller. hmmm...
[00:10:06] guacamole: has joined #RubyOnRails
[00:12:14] RegulationD: has joined #RubyOnRails
[00:12:20] rubyonrailed: has joined #RubyOnRails
[00:12:26] superlou: has joined #RubyOnRails
[00:13:20] Radar: mattr__: You'll have to work harder than that!
[00:13:30] Radar: Pay, location, job expectations.
[00:13:42] safety_cut: has joined #RubyOnRails
[00:14:01] mattrse: Radar: saving that for PM, thanks
[00:15:32] FernandoBasso: has joined #RubyOnRails
[00:16:07] sleungcy: is remote debugging on rails really supposed to be this difficult? I never got it to work easily
[00:16:51] tpendragon: "Remote debugging"?
[00:17:42] sleungcy: i didn't start the dev server using the console, so i don't have a running console to catch the breakpoints
[00:17:48] choke: has joined #RubyOnRails
[00:18:01] sleungcy: i'm using passenger as my dev server, so it's just running from the background.
[00:21:23] sleungcy: and everytime i change some code, the server would crash because there is already another byebug server running and cannot bind to the port.
[00:23:23] fox_mulder_cp: sleungcy: hm. i use puma at dev, at prod, at rails 5 and no problems with it...
[00:24:28] fox_mulder_cp: but one problem find, yep. chrome doesn't work - where post form failed for security tag missmatch, but in ms ie/edge all ok
[00:26:41] baweaver: has joined #RubyOnRails
[00:27:35] pwnd_nsfw: has joined #RubyOnRails
[00:28:56] cmolenda: has joined #RubyOnRails
[00:29:07] sleungcy: I set byebug.start_server in my initializer on port 1048, but when i load the app on the browser, i complains it cannot bind to 1049 instead...
[00:30:15] sleungcy: and i check with 'lsof' to see whats using 1048.. spring is using it? what? i'm so confused.
[00:31:06] fox_mulder_cp: lsof -Pni | grep $port
[00:32:40] mary5030: has joined #RubyOnRails
[00:32:42] neredsenvy: has joined #RubyOnRails
[00:32:45] neredsenvy: I created a new migration but instead of up/down methods I got change does this replace up/down ? Create table/remove table columns etc ?
[00:32:50] choke: has joined #RubyOnRails
[00:33:11] sarink: has joined #RubyOnRails
[00:33:15] fox_mulder_cp: neredsenvy: don't worry if the easy logic.
[00:33:25] Radar: neredsenvy: change is the default now. AR is mostly smart enough to know what to do with migrating / rollback
[00:33:41] sarink: when i run rspec, i keep getting "0 examples, 0 failures" - it is not running my tests! what could be wrong?
[00:33:43] Radar: neredsenvy: i.e. you create_table in the change, Rails knows that during the migration it should create that table but during the rollback it will drop that table.
[00:33:52] fox_mulder_cp: up/down required when need group/degroup something.
[00:33:52] Radar: sarink: You're not telling it to run the tests. "rspec spec"
[00:34:18] Radar: sarink: If not that, then provide steps to reproduce the issue in a new app
[00:34:38] pyemkey: has joined #RubyOnRails
[00:34:42] sarink: Radar: i am running `bundle exec rspec spec`
[00:34:50] _Tariq: has joined #RubyOnRails
[00:34:53] Radar: sarink: That should run all the tests (if there are only to run)
[00:34:57] Radar: any to run*
[00:35:32] sarink: Radar: yes, but it does not... tbh I'm not sure where to begin troubleshooting? I was wondering if anyone had any ideas
[00:35:43] Radar: [11:34:18] <Radar> sarink: If not that, then provide steps to reproduce the issue in a new app
[00:35:47] Radar: That would be a great place.
[00:35:50] neredsenvy: wait it's possible to define relations in migrations now 0.o ?
[00:35:57] Radar: neredsenvy: example plz
[00:36:36] tvw: has joined #RubyOnRails
[00:36:52] neredsenvy: nevermind read it wrong
[00:36:55] sarink: Radar: It's clearly something about my app or configuration that is causing this, a new app is going to work
[00:37:05] Radar: sarink: !consultant
[00:37:05] helpa: sarink: Your question, problem, and/or attitude requires more than free internet advice from an irc channel. May I suggest hiring a consultant or life coach?
[00:37:30] Radar: sarink: Everything you've told me seems to indicate that it's setup correctly.
[00:37:33] fox_mulder_cp: Radar: it's your own bot?
[00:37:33] Radar: sarink: Gist the full output please.
[00:37:36] Radar: fox_mulder_cp: yes
[00:37:54] fox_mulder_cp: Radar: it can't execute oneliners?
[00:38:09] Radar: fox_mulder_cp: what
[00:38:12] s2013: has joined #RubyOnRails
[00:38:21] guacamole: has joined #RubyOnRails
[00:38:31] fox_mulder_cp: Radar: $ puts 2 + 2 as example
[00:38:36] Radar: fox_mulder_cp: it doesn't do that
[00:39:02] chipotle: has joined #RubyOnRails
[00:39:50] DonOtreply: has joined #RubyOnRails
[00:40:16] sarink: Radar: here's the console output https://gist.github.com/sarink/29a2d917f266fd62f63f (the current working directory is the root of the app, and there are plenty of specs in the spec folder)
[00:40:24] infinitone: has joined #RubyOnRails
[00:40:26] mices: when i say u.save in console it says too few arguments
[00:42:03] matthewd: sarink: And does any of that output sound like it might be constraining what gets run?
[00:43:39] jmfurlott: has joined #RubyOnRails
[00:44:03] tvw: has joined #RubyOnRails
[00:45:26] Scripore: has joined #RubyOnRails
[00:45:37] shibabu: has joined #RubyOnRails
[00:45:56] sleungcy: ok so i found that spring is also starting another byebug server
[00:46:27] sleungcy: whenever I use bin/rails to access the console, it will run the initializers and start a debug server
[00:46:51] sleungcy: is there a way to stop it from starting another instance?
[00:47:15] sleungcy: i already got a byebug server running from the server started by passenger
[00:47:42] sleungcy: maybe the initializer isn't the right place to start a byebug server?
[00:48:20] choke: has joined #RubyOnRails
[00:48:50] guacamole: has joined #RubyOnRails
[00:49:14] sarink: matthewd: what am i missing? the options? even if i try to run a single specific test, eg, `rspec spec/mailers/user_mailer_spec.rb` it does not run
[00:49:37] sarink: (the output looks the same)
[00:50:14] matthewd: sarink: Does the output match that of an empty app?
[00:50:40] matthewd: sarink: I haven't used recent rspec, so don't *know* what it's supposed to look like, but the focus:true sounds potentially suspect to me
[00:52:29] northfurr: has joined #RubyOnRails
[00:53:27] neredsenvy: I have two tables/models Patients (hasMany Reports) and Reports (belongsTo Patient) I found ror4 introcuded foreign_key how do I use this in migration ?
[00:53:32] neredsenvy: Can I define a relation this way or ?
[00:54:20] HalcyonicStorm: has joined #RubyOnRails
[00:54:33] neredsenvy: Would this mean I would have t.foreign_key :patient_id, :patients in Reports
[00:54:43] Papierkorb: neredsenvy: add_foreign_key :table_name_plural, :referenced_table_plural [, on_delete: :cascade]
[00:54:59] Papierkorb: neredsenvy: the [] part is 'optional', if you want that on the DB level to happen
[00:55:10] Papierkorb: neredsenvy: outside the create_table block
[00:55:42] celly: has joined #RubyOnRails
[00:56:05] neredsenvy: Papierkorb: So in my case it would be t.foreign_key :reports, :patients ?
[00:56:05] sevenseacat: has joined #RubyOnRails
[00:56:16] Papierkorb: neredsenvy: Outside the block. No t.stuff.
[00:56:31] lastk: has joined #RubyOnRails
[00:56:36] Papierkorb: neredsenvy: https://gist.github.com/Papierkorb/56dc0116ad73078038da like this
[00:56:47] sarink: matthewd: how do i even pass these options? i'm reading the rspec docs, but it is not clear to me
[00:57:18] matthewd: sarink: If you don't know / haven't used them, then I guess they're probably not relevant to your problem
[00:57:55] matthewd: sarink: So, time to debug the problem. When did it stop working? What changed since then? etc.
[00:58:12] Papierkorb: neredsenvy: further reads: https://richonrails.com/articles/foreign-keys-in-rails-4-2 and http://edgeapi.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_foreign_key
[00:58:31] Papierkorb: neredsenvy: Oh, sorry, it's http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_foreign_key
[00:58:33] sarink: matthewd: i'm new to this app, and of course none of my colleagues are online to help :-/
[00:59:38] neredsenvy: Papierkorb: Aaa ok, one more question. This has nothing to do with relations it will just create a patient_id foreign key in my reports table
[01:00:08] Papierkorb: neredsenvy: Correct. You still use has_many, belongs_to, etc. in your models like usual
[01:00:22] neredsenvy: Aaaa oke thank you very much mate.
[01:00:30] Papierkorb: neredsenvy: That's also why you still need the 't.references' to actually create the column
[01:01:05] NoTroutAboutIt: has joined #RubyOnRails
[01:02:07] guacamole: has joined #RubyOnRails
[01:02:57] mduca: has joined #RubyOnRails
[01:05:10] choke: has joined #RubyOnRails
[01:09:13] sbarg: has joined #RubyOnRails
[01:09:38] neredsenvy: one more question regarding database.yml I have default:, development:, test: and production: all define db config how do I know which one is being used
[01:10:01] neredsenvy: Is there a setting/config which puts the app in one of those modes and that db is automatically used ?
[01:10:33] Papierkorb: neredsenvy: Which one is used is determined by the environment the rails app is run in. See `Rails.env`
[01:11:13] guacamole: has joined #RubyOnRails
[01:12:01] neredsenvy: Papierkorb: Where is this located and also I know I can do rails s -e 'env' to run the server in selected env
[01:12:11] neredsenvy: a different call to set the application into that env
[01:13:05] rhizome: neredsenvy: essentially it's either RAILS_ENV or command line option
[01:13:22] blackmesa: has joined #RubyOnRails
[01:14:27] guacamole: has joined #RubyOnRails
[01:14:29] NoTroutAboutIt: has joined #RubyOnRails
[01:14:36] neredsenvy: Ahh ok I see it it's set as enviroment variable I can use export RAILS_ENV=... or better yet set it under apache/vhost
[01:14:40] aadam21: has joined #RubyOnRails
[01:16:26] mary5030: has joined #RubyOnRails
[01:17:50] choke: has joined #RubyOnRails
[01:19:16] cpruitt: has joined #RubyOnRails
[01:19:21] guacamole: has joined #RubyOnRails
[01:19:22] jottr: has joined #RubyOnRails
[01:20:41] gaustin: has joined #RubyOnRails
[01:21:10] lastk: has joined #RubyOnRails
[01:22:22] northfurr: has joined #RubyOnRails
[01:23:49] scottj: has joined #RubyOnRails
[01:24:52] f00dMonsta: has joined #RubyOnRails
[01:26:52] northfurr: has joined #RubyOnRails
[01:27:19] brycesenz: has joined #RubyOnRails
[01:29:01] choke: has joined #RubyOnRails
[01:30:39] lacuna_: has joined #RubyOnRails
[01:32:04] guacamole: has joined #RubyOnRails
[01:35:03] DonOtreply: has joined #RubyOnRails
[01:35:33] threeminutemonta: has joined #RubyOnRails
[01:36:08] djbkd: has joined #RubyOnRails
[01:36:24] choke: has joined #RubyOnRails
[01:40:40] brycesenz: has joined #RubyOnRails
[01:41:43] jottr_: has joined #RubyOnRails
[01:42:02] aadam21: has joined #RubyOnRails
[01:42:56] craysiii: has joined #RubyOnRails
[01:42:57] lemur: has joined #RubyOnRails
[01:45:25] cmolenda: has joined #RubyOnRails
[01:46:45] daande: has joined #RubyOnRails
[01:47:37] cmolenda_: has joined #RubyOnRails
[01:51:13] daivyk: has joined #RubyOnRails
[01:54:47] craysiii: has joined #RubyOnRails
[01:57:43] choke: has joined #RubyOnRails
[01:57:53] brycesenz: has joined #RubyOnRails
[01:57:59] baweaver: has joined #RubyOnRails
[01:59:14] twilling: has joined #RubyOnRails
[01:59:38] bricker: has joined #RubyOnRails
[02:00:52] northfurr: has joined #RubyOnRails
[02:03:34] bsamson: has joined #RubyOnRails
[02:05:54] sarink: Can someone tell me how I would debug this code https://gist.github.com/sarink/81747e47405416a6f134 ? why do I not get my puts message in the console? why doesn't pry stop on the pry line?
[02:08:02] choke: has joined #RubyOnRails
[02:08:14] cmolenda: has joined #RubyOnRails
[02:09:17] jottr_: has joined #RubyOnRails
[02:09:19] NoTroutAboutIt: has joined #RubyOnRails
[02:10:57] Sawbones: has joined #RubyOnRails
[02:14:02] guacamole: has joined #RubyOnRails
[02:14:27] brycesenz: sarink - I think it's because that method hasn't actually been called yet
[02:14:59] Palsson: has joined #RubyOnRails
[02:15:00] bsamson: sarink: are you using delayed job or some kind of background worker? you might need to restart the worker
[02:16:17] sarink: bsamson: no worker
[02:16:21] bsamson: brycesenz: i thought the same thing but the sql output make it look like its doing the lookups on line 7
[02:16:25] sarink: brycesenz: what do you mean? did you see the console output below
[02:16:50] brycesenz: sarink - just calling "ContestMailer.contest_started(Contest.first)", doesn't actually call the *instance* method of your class
[02:17:09] brycesenz: It generates a new Class object (ActionMailer::Message I believe).
[02:17:30] brycesenz: You can then call things like ".deliver" on that class, which will IN TURN be delegated down to that instance method
[02:17:46] sarink: the whole reason i'm trying to debug it is that i'm trying to write a unit test (it's not passing) and i just want to be able to inspect the variables.... is there a better/different way i can do this?
[02:17:46] brycesenz: So try ContestMailer.contest_started(Contest.first).deliver in the console. I'm sure you'll see the "puts" statement output
[02:18:36] sevenseacat: http://stackoverflow.com/questions/33993388/rails-4-controller-wont-call-my-actionmailer-class/33993897#33993897
[02:18:38] brycesenz: sarink - http://vicfriedman.github.io/blog/2013/08/05/how-to-write-rspec-mailer-tests/
[02:18:46] choke: has joined #RubyOnRails
[02:18:51] djbkd: has joined #RubyOnRails
[02:20:11] brycesenz: random question for the group - can anyone recommend a good VPN service? I've heard of PIA and ZenVPN, but haven't talked to anyone with much experience using either.
[02:21:41] threeminutemonta: has joined #RubyOnRails
[02:21:53] brycesenz: sarink - thanks. May I ask what you like about that service in particular?
[02:22:11] sarink: brycesenz: uh, i used it once on my nas. it worked.
[02:22:32] bsamson: sevenseacat: I don???t think that???s true, it should call the method just not deliver any mail. I just testing this from an app here and it definitely calls the method right away https://gist.github.com/samsonasu/e9064553b4dc90aeb62f
[02:22:46] sarink: brycesenz: that rspec mailer test link looks a bit dated
[02:23:22] northfurr: if you render a partial in the middle of an <%= .each %> block is there a way to pass the object to the partial?
[02:23:22] bsamson: sarink: if this isn???t working in a test are you using a preloader or something like spork or zues that might not be reloading your classes correctly?
[02:23:39] SteenJobs: has joined #RubyOnRails
[02:24:10] brycesenz: sarink - yeah, I can't speak for the syntax. But the idea of testing mailers by 1) clearing old deliveries, 2) sending out the mail, 3) inspecting the last piece of mail sent out and asserting things about its properties is the best way I've found to test mailers
[02:24:26] sarink: i updated the gist to include the spec https://gist.github.com/sarink/81747e47405416a6f134
[02:24:34] brycesenz: northfurr - you can pass locals to partials. I'd go that route
[02:26:24] brycesenz: sarink - I'd change that to like "before(:each) { ActionMailer::Base.deliveries = []; ContestMailer.contest_started(contest) }; subject { ActionMailer::Base.deliveries.last };"
[02:27:20] Martyn: has joined #RubyOnRails
[02:27:37] Martyn: I need a bit of help debugging an application.
[02:27:39] choke: has joined #RubyOnRails
[02:27:47] sarink: (refresh) - btw, the first one that tests the subject is working fine
[02:28:47] Martyn: https://github.com/walkeriniraq/twitarr/blob/master/app/controllers/forums_controller.rb
[02:28:47] penguinpowernz: has joined #RubyOnRails
[02:29:14] Martyn: in "new_post" on the URL I just linked, forum = Forum.find(params[:forum_id])
[02:29:26] bsamson: sarink: try expect(user_emails).to match_array(message_emails)
[02:29:37] Martyn: BUT .. when the code is actually executed, I get a server 500 error, and the following error in the debugger log
[02:30:23] StevenXL: has joined #RubyOnRails
[02:30:31] Martyn: Mongoid::Errors::InvalidFind (
[02:30:32] Martyn: Calling Document.find with nil is invalid.
[02:30:48] StevenXL: Hello everyone. I'd like to get a better understanding of creating database schemas in Rails.
[02:30:59] Martyn: And it's true ... if I print the parameters, there is no evidence that forum_id was passed in
[02:31:01] StevenXL: Can anyone point me to what they think is a strong guide / tutorial?
[02:31:02] FailBit: stevenxl: the secret is that ActiveRecord is evil
[02:31:09] FailBit: and you have to learn to deal with ActiveRecord being evil
[02:31:12] sarink: stevenxl: http://edgeguides.rubyonrails.org/active_record_migrations.html
[02:31:17] StevenXL: sarink: thank you.
[02:31:21] StevenXL: FailBit: :-(
[02:31:32] FailBit: mongodb is a shit database
[02:31:39] FailBit: and it was better than putting up with ActiveRecord's shit
[02:31:56] FailBit: for usability, mind, not performance
[02:32:01] Martyn: I don't like having to format my queries as whole programs
[02:32:12] brycesenz: FailBit - really? ActiveRecord is one of the few things I like about Rails
[02:32:13] Martyn: <-- SQL guy, even SQLite is better than mongodb to me
[02:32:26] FailBit: Martyn: let me find the mongoid config option to disable that
[02:32:59] FailBit: Martyn: under your options section
[02:33:02] FailBit: raise_not_found_error: false
[02:33:11] FailBit: that way it will just return nil if it can't find it
[02:33:20] FailBit: alternatively you can use find_by(id: <someid>)
[02:33:44] Martyn: Thing is, I'm pretty sure it shoudln't be "nil"
[02:33:44] DLSteve: has joined #RubyOnRails
[02:33:51] brycesenz: Martyn - is your question how to prevent the error (in which case, FailBit seems to have given solid advice), or is it "why didn't my parameter value come through?"
[02:33:57] Martyn: Let me imgur you a screenshot of the interface --- there -should- be an ID, I think
[02:34:04] FailBit: you probably aren't saving it
[02:34:13] Martyn: I think more the latter than the former
[02:34:14] aadam21: has joined #RubyOnRails
[02:34:34] Martyn: <-- learning Ruby/Rails .. the developer of this app is taking a year off ... but I'm in over my head debugging this issue
[02:34:43] Radar: how are things
[02:34:43] brycesenz: Martyn - Can you also post your routes? Or at least, the relevant parts?
[02:34:53] brycesenz: hi Radar. Things are well.
[02:35:00] StevenXL: I want to enforce referential integrity at the database level, not just through AR validations. I have an answer model and a question model, and I want an answer to belong to a question. I have the following migration for my answer model but it is not enforcing referential integrity:
[02:35:05] dcope: hey all, i have a Company with a Person in it. what's the best way to query for companies with at least one person or more?
[02:35:08] StevenXL: https://gist.github.com/StevenXL/52f9d9cb926cdc00cc39
[02:35:09] StevenXL: Can anyone see at a glance what I'm doing wrong?
[02:35:17] Radar: dcope: Company.joins(:people)
[02:35:33] FailBit: Radar: things are great
[02:35:36] Martyn: http://imgur.com/req1LO8
[02:35:36] dcope: i'm trying a join with group & having but i keep getting SQL errors about the having not containing the same column as group
[02:35:37] FailBit: just ate 18 wings
[02:35:41] Radar: stevenxl: You might want add_foreign_key "answers", "questions"
[02:35:49] chipotle_: has joined #RubyOnRails
[02:35:56] Martyn: brycesenz : I think so --- rails routes?
[02:36:02] Martyn: or the contents of routes.rb?
[02:36:06] dcope: Radar: interesting, i didn't know the join would discard non-joined rows
[02:36:09] pyemkey: has joined #RubyOnRails
[02:36:14] StevenXL: Radar: I do that outside of the create_table but inside of the change method correct?
[02:36:34] Radar: stevenxl: yeah
[02:36:36] StevenXL: Radar: what does foreign_key do then? I felt like it would be doing that last bit.
[02:36:46] Radar: stevenxl: I am not sure it has any effect on an integer column
[02:36:53] brycesenz: Martyn - what is the URL address of the new_post route?
[02:37:11] Radar: stevenxl: You might be thinking of the references method instead: http://devdocs.io/rails/activerecord/connectionadapters/table#method-i-references
[02:37:15] Martyn: http://pastebin.ubuntu.com/14426659/
[02:37:33] StevenXL: Radar: I tried using references, but oddly enough it doesn't take a null: false option.
[02:37:43] mary5030: has joined #RubyOnRails
[02:37:55] StevenXL: So even though it will enforce referential integrity if the question_id attribute is there, it wont' require it.
[02:37:55] Martyn: I'll get the rake routes .. one sec
[02:38:01] Radar: stevenxl: But the foreign key will enforce that the column can't be a value which doesn't exist in the other column. So you don't need the null: false.
[02:38:11] StevenXL: Radar: that's what I thought.
[02:38:14] StevenXL: Let me check
[02:38:17] Radar: stevenxl: So two options: use add_foreign_key as I advise, or change integer to references in your migration
[02:38:19] StevenXL: Maybe I did something wrong earlier.
[02:38:29] StevenXL: Radar: will do. I'll try references
[02:38:44] aadam21: has joined #RubyOnRails
[02:38:44] Martyn: http://pastebin.ubuntu.com/14426669/
[02:38:52] Martyn: The second paste is a snippet of rake routes
[02:39:32] brycesenz: Martyn - it's clear just by looking at that route that there's no forum_id coming in
[02:39:47] Martyn: okay, so the developer left this half-connected.
[02:40:08] brycesenz: Like, compare it to the line below it, which *has* :forum_id listed
[02:40:08] Martyn: or it's supposed to be nil, which would make FailBit's suggestion correct?
[02:40:22] Martyn: I did .. but isn't a POST different from a PUT?
[02:40:45] brycesenz: Martyn - I don't know your app, so I have no idea if it's supposed to be nil. But the code makes little sense unless you're supposed to actually find a Forum object
[02:41:04] Radar: Martyn: I missed the beginning of this. What route are you hitting and what error are you getting?
[02:41:20] brycesenz: Martyn - yes, they are different actions. But that isn't relevant to this discussion
[02:41:21] Martyn: Okay, so what I'm looking at is an incomplete implementation by the original developer ...
[02:41:52] brycesenz: Radar - he has a controller action that is looking for a param :forum_id. But the route doesn't match the idea of a :forum_id being passed in.
[02:42:13] Martyn: Radar : In the code https://github.com/walkeriniraq/twitarr/blob/master/app/controllers/forums_controller.rb ... it breaks because params(:forum_id) is not set
[02:42:17] brycesenz: Radar - what the original intent was is anyone's guess. But that's what isn't working.
[02:42:42] Radar: Martyn: which action in that controller specifically?
[02:44:10] Radar: Yeah right
[02:44:24] Radar: So it looks like the issue is that https://github.com/walkeriniraq/twitarr/blob/master/config/routes.rb#L42 this route is within the collection block instead of a member block
[02:44:34] Radar: if it's inside of a member block, then the forum's id will be available as params[:id], not params[:forum_id]
[02:44:43] Radar: And really, that new post action should be inside its own controller
[02:45:07] StevenXL: Radar: I updated the code now: https://gist.github.com/StevenXL/52f9d9cb926cdc00cc39
[02:45:20] Radar: stevenxl: looks good tome
[02:45:28] StevenXL: However, I am still able to create an Answer using this in the ocnsole: "Answer.create(body: "Hello")"
[02:45:59] leonardoajim: has joined #RubyOnRails
[02:46:12] brycesenz: Radar - the route is "new_post_forums POST /forums/new_post(.:format) forums#new_post". An :id param isn't going to come over either.
[02:46:13] Martyn: Radar : I tried modifying the forums_controller.rb to use "id" insted of "forum_id" .. but the problem is that I don't understand what I'm trying to fix
[02:46:37] Radar: brycesenz: I said to move it outside of the collection block to a member block
[02:46:42] Radar: brycesenz: that will make the params[:id] come through.
[02:46:50] Radar: [13:44:22] <Radar> So it looks like the issue is that https://github.com/walkeriniraq/twitarr/blob/master/config/routes.rb#L42 this route is within the collection block instead of a member block
[02:46:54] brycesenz: Radar - gotcha. I missed that.
[02:47:23] shibabu: has joined #RubyOnRails
[02:47:25] Martyn: Okay .. so I'm not ruby/rails conversant yet on the difference .. what is a member block, what is a collection block?
[02:47:32] brycesenz: Martyn - if conceptually, you're trying to provide functionality to create a new post, then the Posts objects should have their own controller
[02:47:44] Martyn: I'd like to understand not just how to fix it, but why it's fixed
[02:47:54] StevenXL: Radar: Sorry but again taht code is not working.
[02:48:01] Radar: stevenxl: !didntwork
[02:48:01] helpa: stevenxl: What "didn't work"? Did your server not start? Did your computer explode? Did your webpage turn bright pink? Did your client not pay your bill on time? You may have to be more specific. A Gist (http://gist.github.com) of the code that doesn't work (and the error you are getting) will be helpful.
[02:48:05] brycesenz: Martyn - http://stackoverflow.com/questions/3028653/difference-between-collection-route-and-member-route-in-ruby-on-rails
[02:48:06] Radar: Martyn: !routing
[02:48:06] helpa: Martyn: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[02:48:22] Martyn: bookmarked
[02:48:57] Martyn: okay, so I need to get "new_post" out of the collection block
[02:49:14] StevenXL: Radar: I am still able to create an answer using Answer.create(body: "text") in the console
[02:49:20] brycesenz: Martyn - So, conceptually, let's say we have a group of things. Forums, in your case. There are many actions we can take on Forums. Some of them are taken on the collection itself (such as viewing all Forums, or creating a new Forum). Some are taken on an individual member (such as updating a specific Forum). That's the difference.
[02:49:26] Radar: stevenxl: and you definitely ran the migrations?
[02:49:32] StevenXL: I expected it to tell me that the question and / or the employer can't be nil.
[02:49:35] StevenXL: Radar: Yes.
[02:49:41] StevenXL: Radar: Is it because I'm using sqlite?
[02:49:41] Radar: stevenxl: ok then, I am not sure what's going wrong.
[02:49:44] Radar: stevenxl: Possibly.
[02:49:51] StevenXL: let me check that
[02:49:51] brycesenz: Martyn - the first thing that you can do is, yes, move that new_post route into a member block
[02:49:53] Martyn: brycesenz : Makes complete sense ... so I need to keep it inside that resources block?
[02:50:14] brycesenz: Martyn - still inside the resources block, but in a member block inside of it.
[02:50:22] Radar: stevenxl: https://www.sqlite.org/foreignkeys.html
[02:50:32] Radar: stevenxl: quick skim read makes me think that it's not enabled by default.
[02:50:57] Martyn: ie... member do
[02:51:03] Martyn: post 'new_post'
[02:51:35] brycesenz: Martyn - yes. Once you have that done, run "rake routes" to inspect all of the routes. You should hopefully see that the route associated with that action now requires an :id parameter
[02:51:36] StevenXL: Radar: that's what I'm thinking too
[02:51:51] sevenseacat: rails does not support FKs in sqlite.
[02:52:03] sarink: has joined #RubyOnRails
[02:52:15] Martyn: and then I should modify the forum_controller.rb to use id instead of forum_id
[02:52:31] sevenseacat: `add_foreign_key` is a no-op in the sqlite adapter
[02:52:35] Martyn: new_post_forum POST /forums/:id/new_post(.:format) forums#new_post
[02:53:14] choke: has joined #RubyOnRails
[02:53:55] brycesenz: Martyn - Ok, so that route looks good then. Inside that controller action, you will now have access to a parameter :id which will be the id of the Forum
[02:54:20] brycesenz: You will probably have to play with your views a bit to make sure that they still work. I'm guessing that they may not.
[02:54:23] Martyn: ActionController::RoutingError (No route matches [POST] "/forums/new_post"):
[02:54:25] sevenseacat: resourceful routes ftw
[02:54:37] Martyn: since it's now forums/id/new_post, it did break, yes
[02:54:50] brycesenz: sevenseacat - yeah, agreed. But we're going to iterate to that (I hope) :)
[02:54:54] Martyn: brycesenz : That means editing the coffee files, yes?
[02:55:43] brycesenz: Martyn - I don't know what your views are written in. What is in your views folder?
[02:55:55] gambl0re: has joined #RubyOnRails
[02:56:12] Martyn: three directories
[02:56:44] Martyn: home only has index.html
[02:56:58] Martyn: layouts has three .erb files ( application.html.erb login.html.erb static.html.erb )
[02:57:17] Martyn: user has four .erb files ( create_user.html.erb forgot_password.html.erb login_page.html.erb security_question.html.erb )
[02:57:24] lacuna: has joined #RubyOnRails
[02:57:25] lacuna: has joined #RubyOnRails
[02:57:52] brycesenz: Um, fun. Can you search your application for new_post_forum_path, and see if it appears in any of those view files?
[02:58:12] Radar: brycesenz: app is up at https://github.com/walkeriniraq/twitarr/ btw
[02:58:19] Martyn: It appears in : assets/javascripts/controllers/forums_controller.js.coffee
[02:58:25] brycesenz: Radar - thanks!
[02:58:27] Martyn: The entire app is in github, yes
[02:58:45] Martyn: it is also present in assets/javascripts/models/forum.js.coffee
[02:58:46] sevenseacat: this is a SPA?
[02:59:14] Martyn: and has one line in router.js.coffee : assets/javascripts/router.js.coffee: @route 'new_post', { path: ':id/new' }
[03:00:36] Martyn: http://pastebin.ubuntu.com/14426772/
[03:00:44] Martyn: Those are all I could find with grep -r
[03:00:51] brycesenz: Martyn - I don't know Ember well, but let's try this.
[03:01:04] Martyn: Hey, that's better than me .. I don't know Ember at -all-
[03:01:15] iateadonut: has joined #RubyOnRails
[03:01:20] brycesenz: Martyn - in forums.js.coffee, there is a part (line 28 I think) that maps to posting things to that new_post route. Do you see what I'm referring to?
[03:01:52] brycesenz: Martyn - sorry, line 32
[03:02:55] brycesenz: Try changing "$.post('forums/new_post'" to "$.post('forums/#{forum_id}new_post'
[03:02:59] StevenXL: sevenseacat and Radar thank you both
[03:03:09] Radar: all good :)
[03:03:15] brycesenz: sorry "$.post('forums/#{forum_id}/new_post'
[03:03:39] brycesenz: So at least that will be posting data to the correct route. Does it make sense why we need to change that?
[03:03:58] StevenXL: you both saved me a lot of time
[03:04:01] Martyn: and leave the route as "forum_id" in the other code...
[03:04:10] PaperAnchor: has joined #RubyOnRails
[03:04:39] Radar: stevenxl: If you feel like giving something to us, you could buy our book :)
[03:04:40] Radar: stevenxl: !r4ia
[03:04:40] helpa: stevenxl: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[03:04:51] Radar: We each get a couple of bucks out of that.
[03:04:55] Martyn: updated rake routes, and starting rails
[03:05:34] cmolenda: has joined #RubyOnRails
[03:05:48] brycesenz: Martyn - I'm not sure about where you're asking if we should leave it as "forum_id".
[03:06:26] brycesenz: Martyn - Also, if you're able to push these changes to a separate branch as you make them, that might be helpful.
[03:06:45] Martyn: I am already on a new branch and tag .. but I don't have commit access to the github yet
[03:06:57] Martyn: They are working on it
[03:07:51] PaperAnchor: Hey everyone. Rails newbie here, basically just here to say hi, listen and soak up any information that I can.
[03:08:03] brycesenz: Martyn - ok, no worries
[03:08:15] brycesenz: Martyn - so what happened when you started Rails locally?
[03:08:45] Martyn: brycesenz : Just started it .. will try to make a post now
[03:10:17] Martyn: http://pastebin.ubuntu.com/14426818/
[03:10:23] Martyn: Doesn't seem to have worked -- as far as adding a new post
[03:10:25] FailBit: PaperAnchor: welcum
[03:10:34] Martyn: But I'm no longer getting an /error/ per se
[03:11:29] Martyn: http://imgur.com/oNe62Cz
[03:11:39] brycesenz: has joined #RubyOnRails
[03:11:48] Martyn: But it goes back to the page, no update takes place ... if I go back a level and re-enter the forum, there is no new post under the original one
[03:11:53] brycesenz: Martyn - it looks like whatever you did triggered the ForumsController :create action
[03:12:18] Martyn: so, wrong route?
[03:12:25] rubyonrailed: has joined #RubyOnRails
[03:12:39] sankaber: has joined #RubyOnRails
[03:12:52] brycesenz: Martyn - I think it would help me a lot if I could just review your repo for a second. For my own understanding, what page are you on when you're trying to create a new post?
[03:13:37] Martyn:
[03:13:54] iamayam: has joined #RubyOnRails
[03:14:32] Martyn: This is the page source of that page : http://pastebin.ubuntu.com/14426844/
[03:19:49] sankaber: has joined #RubyOnRails
[03:19:57] Martyn: brycesenz : Again, thank you immensely for your assistance.
[03:20:15] brycesenz: Martyn - ok, I will admit, my relative lack of experience with Ember.js is hurting me right now. I'm trying to understand how to best trace through everything.
[03:20:29] lacuna: has joined #RubyOnRails
[03:20:29] lacuna: has joined #RubyOnRails
[03:20:34] brycesenz: Martyn - but to confirm - we're back to a place where the app is loading, but the action is failing, correct?
[03:21:12] Martyn: The intent, I think, is to be able to add a new forum post after the initial forum is created
[03:21:31] Martyn: so it needs forum_id of the original post .. so that it can add another post in that forum
[03:22:15] brycesenz: Martyn - can you send me a screenshot of the page in which you're trying to submit the new post?
[03:22:37] Martyn: http://imgur.com/oNe62Cz
[03:22:44] Martyn: That's the one
[03:22:48] Martyn: I'll capture the URL as well, one sec
[03:23:17] dcunit3d: has joined #RubyOnRails
[03:23:24] Martyn: http://imgur.com/9QTQkVM
[03:23:30] Martyn: There .. URL, page, and inspector
[03:23:45] one_zero: has joined #RubyOnRails
[03:24:56] blackmesa: has joined #RubyOnRails
[03:25:17] brycesenz: Martyn - ok, here's the associated Ember view file for that page - https://github.com/walkeriniraq/twitarr/blob/master/app/assets/javascripts/templates/forums/detail.hbs
[03:25:55] bsamson: Martyn: You should check out this chrome extension if you???re going to debugging ember apps: https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi?hl=en
[03:26:38] brycesenz: Martyn - ok, I think I see two problems
[03:27:03] choke: has joined #RubyOnRails
[03:27:18] brycesenz: Martyn - 1) we need to change the ember.js routes file (https://github.com/walkeriniraq/twitarr/blob/master/app/assets/javascripts/router.js.coffee)
[03:28:12] brycesenz: Under @resoures forums, we should change the route for new_post to map to ":id/new_post" I believe
[03:28:34] brycesenz: Then, in that view we were just discussion, the button should point to the action "new_post" and not "new".
[03:28:39] brycesenz: discussing*
[03:29:25] Martyn_: has joined #RubyOnRails
[03:29:38] Martyn_: brycesenz :: Lost my connection
[03:29:41] Martyn_: @route 'new_post', { path: ':id/new' }
[03:30:12] brycesenz: Martyn - change that to { path: ':id/new_post' }
[03:30:14] bsamson: that app is kindof a mess re: organization and the inspector will help figure out which controllers are getting used
[03:30:43] Martyn_: do I need to restart rails after changing the file?
[03:31:10] brycesenz: Martyn - did you also change that view file so that the button maps to "new_post" and not "new"?
[03:32:19] Martyn_: which view file?
[03:32:24] Martyn_: I may have missed your post
[03:33:13] MrPasserby: has joined #RubyOnRails
[03:33:20] brycesenz: https://github.com/walkeriniraq/twitarr/blob/master/app/assets/javascripts/templates/forums/detail.hbs
[03:33:34] Martyn: @route 'new_post', { path: ':id/new_post' }
[03:33:38] Martyn: changing the hbs file
[03:33:52] brycesenz: On line 61, the btn action should now be "new_post" and not "new", correct?
[03:34:34] Martyn: yep, changed
[03:34:42] Martyn: starting rails
[03:35:50] Martyn: Hmm .. now nothing happens when I click "Post"
[03:36:07] brycesenz: Martyn - like, no server action at all?
[03:36:09] Martyn: I'm going to print a git diff for you to see what's been changed so far
[03:36:11] Martyn: Npe, no action
[03:37:15] Martyn: http://pastebin.ubuntu.com/14426982/
[03:37:36] Martyn: that should be helpful
[03:38:42] n1lo: has joined #RubyOnRails
[03:39:22] Martyn: hold on -- I see an error
[03:39:55] Martyn: I had a debug line in app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
[03:40:25] lacuna: has joined #RubyOnRails
[03:40:26] lacuna: has joined #RubyOnRails
[03:41:08] startupality: has joined #RubyOnRails
[03:42:14] brycesenz: Martyn - I don't think that doing that is necessarily what's going wrong, but restart and let me know if anything has changed.
[03:42:37] Martyn: nope, nothing changed
[03:42:41] Martyn: I'll give you a valid diff though
[03:43:27] Martyn: current diff : http://pastebin.ubuntu.com/14427013/
[03:43:36] brycesenz: Martyn - ok, you know where we changed that button line? Unchange it :)
[03:43:40] baweaver: has joined #RubyOnRails
[03:44:00] brycesenz: Martyn - then let's see what happens. On the plus side, this is really fun for me; I'm learning a lot about Ember, haha
[03:44:41] Martyn: change detail.hbs?
[03:44:51] Martyn: or the router.js.coffee?
[03:46:00] brycesenz: details.hbs
[03:46:05] Martyn: <button class="btn" {{action 'new'}}>Post</button> -- right?
[03:46:51] brycesenz: Martyn - right. It's clearer to me now that the "new" action just maps to the Ember controller here (https://github.com/walkeriniraq/twitarr/blob/master/app/assets/javascripts/controllers/forums_controller.js.coffee)
[03:47:11] brycesenz: And that "new" action seems well defined. It calls the parts of the Ember.js model that we want anyway.
[03:47:16] kies^: has joined #RubyOnRails
[03:47:32] brycesenz: The inconsistent naming convention is just one of many sins throughout this repo, but we'll come back to that.
[03:48:12] Martyn: Well, that earns a WTF
[03:48:16] Martyn: -- nothing -- happened
[03:48:24] Martyn: When I click the button, bupkis
[03:49:40] Martyn: I did create a new forum, to make sure that still works
[03:49:46] Martyn: http://imgur.com/yqPSjTC
[03:51:40] baweaver: has joined #RubyOnRails
[03:51:46] Martyn: @resource 'forums', ->
[03:51:46] Martyn: @route 'page', { path: '/' }
[03:51:46] Martyn: @route 'page', { path: ':page' }
[03:51:46] Martyn: @route 'new_post', { path: ':id/new_post' }
[03:51:48] Martyn: @route 'detail', { path: 'thread/:id' }
[03:51:48] Martyn: @route 'detail', { path: 'thread/:id/:page'}
[03:51:50] Martyn: @route 'new'
[03:51:55] Martyn: sorry -- bad cut/paste
[03:52:15] brycesenz: Martyn - hrm...try changing that new_post route back to ':id/new', and let's see what happens.
[03:52:40] Martyn: restarting rails
[03:53:25] Martyn: That did something
[03:53:44] Martyn: We're back to getting a response -- but not the right one
[03:54:05] Martyn: http://pastebin.ubuntu.com/14427105/
[03:54:38] wethu: has joined #RubyOnRails
[03:54:40] Martyn: It hits the "create" path, not the new_post one
[03:54:52] brycesenz: Ok, no problem.
[03:54:52] brycesenz: Martyn - what exactly is the URL of the page in question again?
[03:55:07] Martyn:
[03:55:31] rhizome: what does the /0 do
[03:56:15] brycesenz: 0 specifies the page
[03:56:56] brycesenz: Martyn - ok, fun test - now let's change that button path back to "new_post" from "new".
[03:57:01] rhizome: it should probably be above thread/:id
[03:57:24] brycesenz: I'm kind of guessing at hypotheses here, while trying to learn more about Ember.js routing.
[03:57:59] Martyn: changed hbs file, restarting rails
[03:58:34] Martyn: changing it, disables the button
[03:58:40] Martyn: ember I guess depends on the "new" vs "new_post"
[03:58:46] Martyn: it has a meaning inside of Ember
[03:58:51] bsamson: Martyn: I found the issue: In forums controller.coffee you need to call @get(???forum.id???) instead of @get(???id???)
[03:59:47] bsamson: your routes are all fine. Look at what loads the model for that controller, which happens in the route. It calls Forum.get(id), but that method (in forum.coffee) returns a hash with {formum: data, next_page: ???.}
[04:00:10] Martyn: forum.id or forum_id?
[04:00:21] brycesenz: bsamson - you clearly know more than I do about the Ember.js piece. You're a much better resource at this point.
[04:00:44] bsamson: if you look at the rest of forums controller coffeescript when it wants data from the forum object it observes ???forum.posts??? instead of just ???posts"
[04:00:58] bsamson: so on line 53 you need get ???forum.id??? instead of just id
[04:01:08] bsamson: when you get just id there it???s returning null instead of the actual id
[04:01:18] Martyn: i.e. Twitarr.Forum.new_post(@get('forum.id'), @get('new_post'), @get('photo_ids')).then (response) => ??
[04:01:37] Martyn: not in quotes, I assume
[04:01:43] Martyn: get(forum.id) then?
[04:02:16] bsamson: brycesenz: ember is a beast its been over a year since i worked on ember but we were deep into a project
[04:02:24] bsamson: no, with quotes
[04:02:30] bsamson: Twitarr.Forum.new_post(@get('forum.id'), @get('new_post'), @get('photo_ids')).then (response) =>
[04:02:59] bsamson: brycesenz: also don???t feel bad beacuse I cheated and cloned his repo :)
[04:03:06] Martyn: bsamson : Okay -- did you see the pastebin I put in with all the changes I've made so far?
[04:03:09] brycesenz: bsamson - yeah, it looks...interesting? I don't know. The overhead of multiple layers of controllers, routes, and models doesn't seem very DRY to me (unless you just had a Rails API that lived in its own repo and a separate front end)
[04:03:15] Martyn: Because I may have to reverse some to make what you did work
[04:03:31] bsamson: yes you should revert everything except that one line in forumcontroller
[04:03:39] Martyn: reverting to HEAD, one moment
[04:04:13] brycesenz: bsamson - haha, no worries. I'm trying to straddle the line between trying to be helpful and guessing at things.
[04:04:18] bsamson: brycesenz: yeah its pretty good but and it has gotten much better but I???m not sure I would pick it again
[04:04:48] Martyn: Reverted to HEAD
[04:04:51] Martyn: changed the one line
[04:04:54] Martyn: restarting RAILS
[04:05:46] Martyn: bsamson : Changed the one line -- but bupkis?
[04:06:13] SteenJobs: has joined #RubyOnRails
[04:06:16] Martyn: - Twitarr.Forum.new_post(@get('id'), @get('new_post'), @get('photo_ids')).then (response) =>
[04:06:17] Martyn: + Twitarr.Forum.new_post(@get('forum.id'), @get('new_post'), @get('photo_ids')).then (response) =>
[04:06:27] Sawbones: has joined #RubyOnRails
[04:06:37] Martyn: --- a/app/assets/javascripts/controllers/forums_controller.js.coffee
[04:06:38] Martyn: +++ b/app/assets/javascripts/controllers/forums_controller.js.coffee
[04:06:41] Martyn: All other changes were reverted
[04:06:49] Martyn: the new_post is back in the controller block
[04:07:08] NoTroutAboutIt: has joined #RubyOnRails
[04:08:17] Martyn: bsamson : Ideas?
[04:09:07] Martyn: none .. just nothing happens
[04:09:08] bsamson: http://imgur.com/qlxvamE
[04:09:38] Martyn: Let me re-clone the repo
[04:09:43] Martyn: I did a git reset HEAD
[04:09:47] bsamson: you shouldn???t need to do that
[04:09:51] Martyn: which should have put us in the same place
[04:10:05] wldcordeiro: has joined #RubyOnRails
[04:10:09] Martyn: martin@Twit-arr:~/twitarr$ !rails
[04:10:09] Martyn: rails server -b
[04:10:38] ur5us: has joined #RubyOnRails
[04:10:42] Martyn: Ooo ... that's a nice live screencap ... what application do you use for that?
[04:11:02] bsamson: http://www.cockos.com/licecap/
[04:14:33] Martyn: running rake routes
[04:14:37] Martyn: checking, then running rails again
[04:14:45] Martyn: I'm having an odd issue getting rails started
[04:14:48] Martyn: one moment
[04:14:57] Scripore: has joined #RubyOnRails
[04:15:43] bsamson: I highly suggest using the ember inspector to figure out what???s going on, it???s really good
[04:15:44] bsamson: http://imgur.com/RoWPfHd
[04:16:00] bsamson: its getting late so I need to take off
[04:16:12] Martyn: I installed the Ember inspector as well into Chrome
[04:16:16] Martyn: Thank you for all your help!
[04:16:34] Martyn: So the -only- thing you changed in the repo was that one line?
[04:17:24] bsamson: I had to comment out a line in forum_post_decorator.rb about location being undefined but I assume that was bad config
[04:18:03] bsamson: it was throwing an error but it looked to be unrelated to this
[04:18:22] startupality: has joined #RubyOnRails
[04:18:56] arup_r: has joined #RubyOnRails
[04:21:08] arup_r: As I said other day, my app runs very slow. It is very small and under development. Not many data also. It runs both devlopment and production very slow.. Here i tried hit http://localhost:3000/sites, and I see in browser devtool it took 8.11 second to complete . this https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93 is rails log
[04:21:35] arup_r: no idea of why it became so slow
[04:21:49] Radar: "Views: 8068.0ms"
[04:21:52] Radar: It's in your view.
[04:22:10] Radar: Looks like you could do with some eager loading for users + phones too
[04:22:10] krz: has joined #RubyOnRails
[04:22:27] Radar: arup_r: shared/_header.html.erb view please
[04:22:30] choke: Well, from what I see -- I'd look @ why you have so many hits to the database. I had the same issue on my app -- did some refactoring and dropped it from 4 seconds to 200-400ms
[04:22:30] Radar: Rendered shared/_header.html.erb (7929.6ms)
[04:22:40] Radar: choke: The DB hits are quite quick
[04:23:04] arup_r: ok giving .. one min
[04:23:09] choke: Yes, but they also add up...
[04:23:17] Radar: ACTION is half-expecting to see an external service call done in the view.
[04:23:24] bsamson: choke: sure, but compared to 7s in header.erb its nothing
[04:23:30] choke: but yeah, I see the bottom 7s thing
[04:23:38] Radar: https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93#file-log-txt-L13-L50 so 37 queries there, at 0.2ms per query is ... 7.4ms.
[04:24:41] leonardoajim: has joined #RubyOnRails
[04:24:58] arup_r: added Radar: yes one external service call is done to gravatar site, for some image comparisons..
[04:25:10] arup_r: https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93
[04:25:24] Radar: 330 lines
[04:25:42] Radar: https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93#file-_header-html-erb-L275-L292
[04:25:46] Radar: How many users do you have?
[04:26:02] Radar: And you find each user more than twice
[04:26:10] Radar: Sorry, exactly twice.
[04:27:07] Radar: arup_r: ok, so that's not it
[04:27:16] Radar: I have no idea why it would take 7 seconds to render that partial
[04:27:26] Martyn: bsamson : FIXED. Thank you :)
[04:27:27] Radar: It's not the gravatar calls. Those happen when the page has finished rendering.
[04:27:35] Martyn: Once I rolled back the location code, this all works nicely
[04:27:42] arup_r: should I show you the helper user_profile_image .. because I have third party call
[04:28:06] blackmesa: has joined #RubyOnRails
[04:28:12] SteenJobs: has joined #RubyOnRails
[04:28:30] Radar: arup_r: sure, that might help.
[04:28:46] Radar: arup_r: I'd really like to know what that helper is.
[04:29:16] rubyonrailed: has joined #RubyOnRails
[04:29:19] bsamson: Martyn: :) np good luck with ember
[04:30:15] Martyn: Tbanks ... I'll go read up tomorrow morning
[04:30:34] Martyn: I need to understand -why- forum.id works
[04:30:54] arup_r: ok, so our users are imported from Google account. We use omniauth + devise for signup/sign in. Now, we have some image fallback rule. When user have google default image, then we will check Gravatar for the user image, and if there also user have any default we will fallback to our site default image.. code : https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93/edit
[04:31:00] Martyn: I can see the how .. that makes sense ... but the change from id -> forum.id seems like a small, but significant slip-up
[04:31:17] Martyn: I also had to roll-back the whole "location" thing int he codebase ... I'm surprised it ran at ALL for you
[04:31:26] SteenJobs: has joined #RubyOnRails
[04:31:34] Martyn: because when I installed the code, I got blocked with a server error
[04:31:37] bsamson: Martyn: look at forum.js.coffee around line 27, the ???Forum.get??? call sets its result as an object with forum, next_page, and prev_page as keys
[04:31:46] arup_r: Radar: I added.
[04:31:58] pawnbox: has joined #RubyOnRails
[04:32:09] Martyn: I'm surprised you were able to get it to work from the HEAD position ... did you have to do anything vis-a-vie location?
[04:32:25] bsamson: i just commented out a call to location in the decorator and it worked
[04:32:40] bsamson: rake db:setup. props to whoever you inherited this from, it at least has good seed data
[04:33:04] Martyn: I had to roll back commit :: git revert 25c0c0deb86da2e9c5f1d4fe1e64c76c6830529a
[04:33:06] Martyn: Yeah, I also commented out the call to location
[04:33:23] Martyn: then rolled back the entire location commit in my repo -- it's unfinished code, and it does't belong there
[04:33:28] Martyn: it's half-implemented
[04:33:29] bsamson: ok good night all
[04:33:35] Martyn: goodnight, and thank you again
[04:33:41] makenoise: has joined #RubyOnRails
[04:34:13] matthewd: arup_r: You can specify the URL that Gravatar will use for the fallback image
[04:34:14] duncannz: has joined #RubyOnRails
[04:35:00] Radar: https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93#file-users_helper-rb-L7
[04:35:02] Radar: What is this?
[04:35:04] Bloomer: has joined #RubyOnRails
[04:35:32] choke: Radar that's added in too https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93#file-compare_image-rb
[04:36:05] arup_r: Radar: ok, I have the default google and gravtar default image in my app FS, I just compare the signature to see if it the default image or not.
[04:36:25] Radar: https://gist.github.com/aruprakshit/c9cd6eb13c6e27af2a93#file-compare_image-rb-L18-L20
[04:36:27] Radar: My guess is this line
[04:36:28] matthewd: arup_r: Yeah, don't do that.
[04:36:56] juddey: has joined #RubyOnRails
[04:37:51] arup_r: Radar: yes, that is the signature calculation.
[04:38:17] arup_r: matthewd: Then how would I get to know if the user has default gravtar set or not in gravtar.com ?
[04:38:29] pyemkey: has joined #RubyOnRails
[04:38:35] Radar: What does it matter if they do?
[04:38:38] lacuna: has joined #RubyOnRails
[04:38:38] lacuna: has joined #RubyOnRails
[04:38:40] matthewd: [15:04:13] <matthewd> arup_r: You can specify the URL that Gravatar will use for the fallback image
[04:39:38] arup_r: Radar: otherwise, I need to fallback to site default.
[04:39:52] arup_r: matthewd: I was not sure if they always use same default image url
[04:39:59] Radar: matthewd: all yours
[04:40:06] arup_r: that's why though checksum calculation.
[04:40:14] matthewd: arup_r: You. can. specify. the. URL.
[04:42:28] srinidhi: has joined #RubyOnRails
[04:42:39] koryteg: has joined #RubyOnRails
[04:42:59] matthewd: arup_r: So, user_profile_image becomes: `user.image_url || gravatar_url(user, size: 128, default: "http://placehold.it/150x150")`
[04:43:20] arup_r: let me fix and see.. But for some moment, I commented out that image calculation from the partial, and see page load is 4.02 sec .. OMG was that the curprit.. ?
[04:44:01] arup_r: matthewd trying.
[04:44:28] matthewd: It's an incredibly expensive thing to be doing, so yes, I would expect things to get faster. 4s still sounds pretty slow, but at least it's an improvement ??\_(???)_/??
[04:49:01] sevenseacat: i once worked on an app where rendering the dashboard took 3 minutes. true story.
[04:49:31] arup_r: matthewd: what is does, gravatar_url(user, size: 128, default: "http://placehold.it/150x150") ? I didn't find the default option to the gem..
[04:49:52] choke: you and me both sevenseacat.. was a regular occurrence working with PHP ( crap is so slow )
[04:50:39] choke: arup_r, try just d:
[04:50:39] arup_r: now saw https://github.com/lwe/gravatarify#need-more-control
[04:51:06] arup_r: choke: doing.. went to see who is pressing my door bell :p
[04:51:25] choke: may be from a different grav gem though ( too many gems doing basically the same thing )
[04:52:13] pickerel: has joined #RubyOnRails
[04:52:24] choke: and most of these are years old, just begging for a new repo manager
[04:53:22] Axsuul: has joined #RubyOnRails
[04:55:18] capin: anyone know why I'm not seeing social login icons inside the buttons? i asked a more descriptive question here, http://stackoverflow.com/questions/34647523
[04:55:22] rubyonrailed: has joined #RubyOnRails
[04:55:57] one_zero: has joined #RubyOnRails
[04:57:33] Bloomer: has left #RubyOnRails: ()
[04:57:36] IFrank00: has joined #RubyOnRails
[05:01:23] xardion_: has joined #RubyOnRails
[05:04:25] arup_r: matthewd: https://gist.github.com/aruprakshit/9d58ae41932e44ff3fdc now, 142 ms :) but, yes for now my users don't have the google image url, which is why it hits the gravtar site. but once I'll get mixed users, then this code will give me pain again..
[05:06:04] choke: image_url is a string I'm guessing arup_r?
[05:06:17] NoTroutAboutIt: has joined #RubyOnRails
[05:06:29] arup_r: choke: yes, it is carrierwave helper that is.. image is a column to the User modwl
[05:06:29] pawnbox: has joined #RubyOnRails
[05:10:04] choke: so carrierwave -- why not a simple ternario... user.image? ? user.image.url : gravatar(user, :size => 128, default: "http//placeholdit/150x150") effectively bypasses the if-else stuff, and pick the right image
[05:10:29] koryteg: has joined #RubyOnRails
[05:10:29] threeminutemonta: has joined #RubyOnRails
[05:11:43] pawnbox: has joined #RubyOnRails
[05:12:02] arup_r: choke: when I am onboarding user, we are saving the image of google without checking if that image is default or not.. So, when I have image, I still need to check the image we got from google is the default one or not
[05:12:10] koryteg: has joined #RubyOnRails
[05:13:00] arup_r: in your Google profile, you can change your image frequently. That is ok. But when you remove the profile pic, then we again need to fallback from google to gravtar to own site default..
[05:13:22] arup_r: so gravter and site url fallback is fixed.. Need to think, about google image..
[05:13:45] arup_r: Right now we save google image for eac login to make our app uptodate with google..
[05:14:19] arup_r: one idea could be, just to check this signature thing when the user signed in.. then I can avoid the checksum calculation..
[05:14:55] arup_r: ^^ yeah, that makes sense.. And then choke I will use the code you said..
[05:15:51] arup_r: because if move the the signature comparisons to the user sign in time.. it will be just a one time work.. not the checksum calculation for all users which is what I have right now.
[05:15:57] choke: I Figure ternary would be better, since really it should be all about what is currently the users image. all the other manipulations definitely belongs somewhere else
[05:16:10] arup_r: choke: ^^ +1
[05:16:26] arup_r: I will do calculation signup and sign in time...
[05:16:37] arup_r: thanks choke matthewd Radar :D
[05:16:44] Radar: Faster now?
[05:17:02] arup_r: 8 second load drops down to 142 ms
[05:17:12] arup_r: Radar: yes faster..
[05:17:16] choke: nice speed improvement
[05:17:22] Radar: arup_r: much better
[05:18:29] xnp70: has joined #RubyOnRails
[05:19:39] xnp70: when I use has_one, how can I tell rails it can have zero ?, zero or one ?
[05:20:07] sevenseacat: thats how it works by default
[05:21:55] xnp70: tks @sevenseacat
[05:22:10] jdcauley: has joined #RubyOnRails
[05:22:34] xnp70: same with belongs_to ?
[05:23:15] KrzaQ: has joined #RubyOnRails
[05:23:21] choke: pretty sure most relations ( if not all ) are a "zero or ..." by default... sevenseacat would know that better than me though
[05:24:31] xnp70: thanks guys
[05:25:21] choke: and since sevenseacat is active, i've been going through your book and learned some things I had no clue about ( which is awesome ) and directly helped me enhance my api @ work... so thanks for that
[05:25:40] sevenseacat: choke: awesome :)
[05:27:21] choke: it could use more enhancement i'm sure.. but same route getting a list of places within an area, the last 6 posts, and the posts user all cached ( buggy ) was 97ms response time ( in postman ).. without full cache with updated code its 110ms ( with on average about 20 places each with 6 posts )
[05:27:50] chipotle: has joined #RubyOnRails
[05:28:30] xnp70: sevenseacat: is there a rails 5 in action in the works ?
[05:29:07] sevenseacat: none of the authors of R4IA are willing to deal with manning again.
[05:29:22] choke: that bad?
[05:30:02] mloy: has joined #RubyOnRails
[05:30:21] seaworthy: has joined #RubyOnRails
[05:30:47] mloy: has joined #RubyOnRails
[05:30:59] blackmesa: has joined #RubyOnRails
[05:31:44] choke: HTTP/1.0 404 Not Found
[05:31:56] seaworthy: can someone please help me associating records so i can use something like this buy_transactions = Transaction.includes(:virtual_item).where(["buyer_id = ?", user.id]).order(updated_at: :desc)
[05:32:03] SteenJobs: has joined #RubyOnRails
[05:32:20] seaworthy: i tried doing # has_one :virtual_item, class_name: "VirtualItem" but got SQL error
[05:32:33] seaworthy: inside Transaction
[05:33:01] choke: transaction belongs_to :user user has_one or has_many :transactions should do it
[05:33:32] choke: or buyer or whatever the class is
[05:33:34] kknight: has joined #RubyOnRails
[05:33:37] seaworthy: i am trying to associate virtual_item and transaction
[05:34:12] C0r3: has joined #RubyOnRails
[05:34:21] kknight: what is the need of migration if developer are ok with sql knowqledge
[05:34:21] MrPasserby: has joined #RubyOnRails
[05:34:23] choke: okay i see...
[05:34:24] aadam21: has joined #RubyOnRails
[05:34:58] choke: to transaction has_one or has_many: :virtual_items and virtual_items class belongs_to :transaction
[05:36:24] seaworthy: all right trying now, thanks! choke
[05:36:42] choke: kknight the migrations help ( for me ) with making changes.. regardless of if i am good with sql or not, i don't have to write the code in db/schema.rb in order to get rails to know my table schema -- it's all done for me
[05:36:55] stannard: has joined #RubyOnRails
[05:41:42] seaworthy: You tried to define an association named transaction on the model VirtualItem, but this will conflict with a method transaction already defined by Active Record. Please choose a different association name. (ArgumentError)
[05:42:22] choke: ahh yes should have caught that -- transaction is a reserved word for ActiveRecord -- that entire class should probably be renamed
[05:42:59] seaworthy: FO REAL???!?
[05:43:40] bricker: has joined #RubyOnRails
[05:43:43] choke: http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html
[05:44:31] seaworthy: okay what do i do now?
[05:45:09] choke: so lets say you rename the class to order instead of transaction.. your virtual_item would just belong_to whatever you renamed transaction to
[05:45:48] seaworthy: so order is not reserved
[05:46:55] xnp70: has left #RubyOnRails: ()
[05:47:47] choke: it might be, but i'm not too sure on that.
[05:48:52] seaworthy: according to the link its not
[05:48:59] choke: http://reservedwords.herokuapp.com/ reserved words list
[05:49:37] choke: some may not be on it, but order doesn't appear so you should be safe
[05:49:41] rubyonrailed: has joined #RubyOnRails
[05:50:18] kknight: has joined #RubyOnRails
[05:50:43] kknight: m getting error Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
[05:51:12] kknight: i have added msql2 in gem file and run bundle install still it shows error
[05:51:40] kknight: i have added msql2 in gem file and run bundle install still it shows error
[05:51:50] kknight: m getting error Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
[05:51:53] kknight: i have added msql2 in gem file and run bundle install still it shows error
[05:52:07] choke: You don't need to spam us kknight we saw it the first time.
[05:52:26] seaworthy: thanks i have to redo a lot
[05:53:03] choke: try: bundle update mysql2 and if that fails, what version of rails are you running?
[05:53:13] shibabu: has joined #RubyOnRails
[05:55:13] krz: has joined #RubyOnRails
[05:55:53] kknight: btw m runnig the cmd you told
[05:56:15] arup_r: has joined #RubyOnRails
[05:56:45] kknight: saying same error
[05:57:10] choke: k, tag your mysql2 gem to 0.3.18 like: gem 'mysql2', '~> 0.3.18' and run bundle update mysql2 again
[05:57:40] kknight: i9n gemfile?
[05:58:02] choke: yes, replace the "gem 'mysql2' line and pin it to version 0.3.18
[05:59:26] kknight: then bundle update
[06:00:16] kknight: same error
[06:00:24] arup_r: has joined #RubyOnRails
[06:00:36] kknight: just added a new line in gemfile gem 'mysql2' , '~> 0.3.18'
[06:00:49] choke: did you get rid of the old line with mysql2 on it?
[06:01:09] kknight: yes deleted previous one
[06:01:27] kknight: but sqlite3 whic is default also there?
[06:01:34] kknight: is that correcct?
[06:01:39] choke: you can get rid of that too
[06:01:42] barajasfab: has joined #RubyOnRails
[06:03:37] kknight: after that bundle install or budle update
[06:04:19] choke: bundle update i believe
[06:05:22] arup_r: has joined #RubyOnRails
[06:05:26] kknight: done but getting same error and i have added mysql2 gem
[06:05:48] kknight: error is Gem::LoadError (Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).):
[06:06:09] choke: k, in your gemfile what does the gem 'rails' line say?
[06:06:10] kknight: why gem is not loaded , i have added it in gemd=fiel
[06:06:18] PlasmaStar: has joined #RubyOnRails
[06:06:27] sevenseacat: choke: having fun yet? :)
[06:06:31] kknight: gem 'rails', '4.2.3'
[06:06:31] kknight: gem 'mysql2' , '~> 0.3.18'
[06:06:55] kknight: sevenseacat: almost i think both of us
[06:07:57] Guest_: has joined #RubyOnRails
[06:08:15] choke: sevenseacat always having fun... kknight, what i've learned through my googling... is this appears to be an issue with rails itself. using 4.2.4 should fix it
[06:08:44] kknight: how it can be fixed
[06:08:58] kknight: i have installed it 2 month before
[06:09:05] choke: change your gem 'rails', '4.2.3' to gem 'rails', '4.2.4' in the gem file
[06:09:15] choke: and bundle update
[06:10:15] kknight: raise Gem::LoadError, "Specified '#{spec[:adapter]}' for database adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord)."
[06:10:16] kknight: rescue LoadError => e
[06:10:31] tibra: has joined #RubyOnRails
[06:11:28] choke: try just for giggles... gem 'rails', '~> 4.2.4', git: "git://github.com/rails/rails.git", branch: '4-2-table' and unpin the version of mysql2
[06:11:33] choke: if that fails, i've no clue.
[06:11:46] juddey: has joined #RubyOnRails
[06:12:16] choke: unless of course, you're missing libmysqlclient-dev ( if you're on debian linux -- not sure about other OS's )
[06:12:34] kknight: m on gnome linux
[06:12:50] rubyonrailed: has joined #RubyOnRails
[06:13:22] choke: okay, so for other giggles just try installing that package with apt-get
[06:13:26] Radar: kknight: Why are you depending on an older version of my mysql2 gem?
[06:13:38] Radar: kknight: latest is 0.4.2
[06:13:58] Radar: kknight: Your database adapter should just be "mysql", not "mysql2"
[06:14:05] Radar: Orrr... I am wrong
[06:14:13] Radar: Late in the day and I make stupid mistakes like that.
[06:14:53] choke: http://stackoverflow.com/questions/32457657/rails-4-gemloaderror-specified-mysql2-for-database-adapter-but-the-gem-i looking at this, with 4.2.3 there seemed to be an issue running latest mysql2 Radar
[06:15:33] tibra: has joined #RubyOnRails
[06:15:58] atmosx: has joined #RubyOnRails
[06:17:17] roshanavand: has joined #RubyOnRails
[06:23:17] choke: but with that, i'm off to bed.. full day of adulting to do tomorrow
[06:26:20] arup_r: choke: hehe what do you mean by that ? :p
[06:26:29] arup_r: that tomorrow thing..
[06:26:31] mloy: has joined #RubyOnRails
[06:26:48] arup_r: good night..
[06:26:53] choke: Nothing more than that I'm old.
[06:27:08] arup_r: ok,, choke cya .. :)
[06:27:21] choke: http://www.urbandictionary.com/define.php?term=Adulting
[06:27:37] aganov: has joined #RubyOnRails
[06:30:41] kknight: what is the latest version of rails you guys are using
[06:31:47] kknight: m doing rake rails:upadte it shows error?
[06:31:50] tibra: kknight: 4.2.5 probably https://github.com/rails/rails/releases
[06:32:22] tibra: set new rails version in your Gemfile and run bundle install
[06:32:42] kknight: everytime i have to do that it means
[06:32:57] kknight: i want default version of it
[06:33:17] chouhoul_: has joined #RubyOnRails
[06:33:19] tibra: sorry, i don't understand your question
[06:33:42] lxsameer: has joined #RubyOnRails
[06:33:51] kknight: everytime i don't want to change by going in gemfile
[06:34:01] blackmesa: has joined #RubyOnRails
[06:34:11] kknight: so i needded a dedfault version
[06:34:12] rvanlieshout: has joined #RubyOnRails
[06:34:23] kknight: i hope u got it isn't?
[06:36:20] tibra: you should put at least the branch for the latest major version you're using in your Gemfile, otherwise you won't have control over rails upgrades that might your applications because of api changes etc.
[06:36:24] tibra: gem 'rails', github: 'rails/rails', branch: '4-2-stable'
[06:37:02] tibra: *might break
[06:37:12] kknight: explain little bit
[06:37:40] tibra: put this in your Gemfile:
[06:37:42] tibra: gem 'rails', github: 'rails/rails', branch: '4-2-stable'
[06:38:21] mary5030: has joined #RubyOnRails
[06:39:15] kknight: why i make change in gemfiel everytime?
[06:39:19] kknight: why not default
[06:39:20] tibra: and run "bundle install". thats basically it. if you want to have control over the exact rails version, put gem 'rails', '4.2.5' in your Gemfile. When you want to upgrade to 4.2.6 or whatnot, change your version in the Gemfile and run bundle install
[06:40:22] pyemkey: has joined #RubyOnRails
[06:40:54] rvanlieshout: imo it's not right to use version constraints in gemfile if there is no reason for it
[06:40:54] tibra: because you don't want a Rails 4.x application to become a Rails 5.x overnight. making your code work for a new major version (4.x -> 5.x) is usually combined with some effort and change on your side and you should know what you're doing.
[06:41:00] rvanlieshout: and if there is, you should document why there is a constraint
[06:41:21] Axsuul: has joined #RubyOnRails
[06:41:57] robbyoconnor: has joined #RubyOnRails
[06:42:16] tibra: rvanlieshout: agree for minor releases, but wouldn't you recommend that for a change from, say, 4.2.x to 4.3.x?
[06:42:49] rvanlieshout: you should always run tests and make sure everything works after gem update
[06:42:55] rvanlieshout: a constraint should be there for a reason
[06:43:30] rvanlieshout: like when you ran into problems when upgrading to version 2 of foo. you write, '< 2' # see github issues foo/123 ish
[06:43:40] kknight: one more thing which practice you folks are using for making app agile or TDD?
[06:43:48] rvanlieshout: something in between
[06:44:14] cmolenda: has joined #RubyOnRails
[06:44:15] kknight: because in a video i saw DHH was crticsing TDD
[06:44:28] kknight: between means ?
[06:44:37] rvanlieshout: fully TDD is slow
[06:44:41] rvanlieshout: no TDD whatsoever is wrong
[06:45:03] choke: has joined #RubyOnRails
[06:45:58] edj: has joined #RubyOnRails
[06:46:09] kknight: for newbie which one is good
[06:46:26] comrad: has joined #RubyOnRails
[06:46:31] rvanlieshout: something in between
[06:46:39] rvanlieshout: sometimes write code just to see what it does
[06:46:42] tibra: but start with tdd so you know how to do it
[06:46:42] rvanlieshout: THEN create a test
[06:46:50] rvanlieshout: and if you feel like you're up to it write some tests and THEN the code
[06:47:46] PedramT: has joined #RubyOnRails
[06:48:19] kknight: michel hartl follows TDD practice where as book to DHH follows agile
[06:48:37] rvanlieshout: follow something you feel best by
[06:48:57] rvanlieshout: and be intrested about how other people work and adapt if you like it
[06:49:29] rvanlieshout: back in like 15 min
[06:49:54] tibra: rvanlieshout: I get the idea about versioning in my Gemfile. Say your gemfile only has gem "rails" in it, how are you upgrading your rails version? by gunning gem update rails?
[06:50:41] barajasfab: has joined #RubyOnRails
[06:52:11] fcser_: has joined #RubyOnRails
[06:53:17] chouhoulis: has joined #RubyOnRails
[06:54:35] bsamson_: has joined #RubyOnRails
[06:54:54] robbyoconnor: has joined #RubyOnRails
[06:55:30] shibabu: has joined #RubyOnRails
[06:56:13] tibra: kknight: I think the important piece is to have functioning code and tests to verify your expectation of what ??? at least your critical ??? code does. if you write a test before or after writing code depends on your personal preference and the type of problem.
[06:56:15] startupality: has joined #RubyOnRails
[06:56:47] duncannz: has joined #RubyOnRails
[06:56:50] d0nn1e: has joined #RubyOnRails
[06:57:16] russt: has joined #RubyOnRails
[06:57:19] duncannz: has joined #RubyOnRails
[06:57:47] kp666: has joined #RubyOnRails
[06:58:43] sevenseacat: has joined #RubyOnRails
[06:58:53] kp666: has joined #RubyOnRails
[07:00:06] kp666: has joined #RubyOnRails
[07:01:22] kp666: has joined #RubyOnRails
[07:01:31] Marquel: has joined #RubyOnRails
[07:02:26] kp666: has joined #RubyOnRails
[07:02:39] Guest2279: i hear the best way to learn is just trying to build something right?
[07:02:50] choke: has joined #RubyOnRails
[07:02:51] Guest2279: so where do i find the building blocks?
[07:03:31] tparenti: has joined #RubyOnRails
[07:03:47] kp666: has joined #RubyOnRails
[07:05:23] sevenseacat: depending on what you mean by 'building blocks', they'd either be on rubygems, or you'd write them yourself
[07:07:33] johnflux: has joined #RubyOnRails
[07:07:33] johnflux: has joined #RubyOnRails
[07:07:59] arup_r: has joined #RubyOnRails
[07:12:50] DonOtreply: has joined #RubyOnRails
[07:16:55] Pazician: has joined #RubyOnRails
[07:20:57] BradenBraden: has joined #RubyOnRails
[07:22:58] lenage: has joined #RubyOnRails
[07:23:47] choke: has joined #RubyOnRails
[07:25:08] jvanbaarsen: has joined #RubyOnRails
[07:26:15] juddey: has joined #RubyOnRails
[07:27:55] riddled: has joined #RubyOnRails
[07:28:37] solars: has joined #RubyOnRails
[07:29:11] Radar: Guest2279: Do you know any Ruby?
[07:29:29] Guest2279: radar: yea i read a book on it
[07:29:35] Radar: Guest2279: !r4ia
[07:29:35] helpa: Guest2279: Rails 4 in Action - http://manning.com/bigg2 - An excellent book combining Rails and TDD/BDD development. Written by Rebecca Skinner, Steve Klabnik, Ryan Bigg, Yehuda Katz
[07:29:38] Radar: Here is another book you can read.
[07:30:10] sevenseacat: is a good book. *nods
[07:31:12] Guest2279: radar: yea i went through that one
[07:32:05] Guest2279: where do i go now?
[07:32:57] sevenseacat: I don't think you'd be asking these questions if you had
[07:33:18] trautwein: has joined #RubyOnRails
[07:34:29] Radar: Guest2279: What's the library in Chapter 7 that we use for authorization?
[07:34:49] havenwood: I know! I know!
[07:35:48] blackmesa: has joined #RubyOnRails
[07:36:01] choke_: has joined #RubyOnRails
[07:36:19] Radar: Guest2279: Still waiting...
[07:36:36] BradenBraden: so here is a weird one, I have built my own little login system and use the session to store a hash. I am trying to access the session from the index action but it is empty but dumping it in the view shows it is there. am I up against some sort of race condition? https://gist.github.com/brazenbraden/d2e1170044a1ef1135c7
[07:37:23] choke_: I know that one too Radar ( mainly because I passed that in the book already )
[07:37:28] choke_: and i've used it before
[07:38:01] seanhandley: BradenBraden: Don't store the whole user object in the session
[07:38:27] Guest2279: wasn't that the chapter where it was like we aren't using a gem or something. then just made it ?
[07:38:31] BradenBraden: seanhandley, im not, just a hash key which I retrieve from the session then use it to load the user details
[07:38:42] sevenseacat: BradenBraden: so where is it empty?
[07:38:54] Guest2279: I'm not really good with the jargin i just know how things work.
[07:39:20] Macaveli: has joined #RubyOnRails
[07:39:50] BradenBraden: in the index action where that bit is commented out. trying to get the current_user. if I break in the index action and use Better Errors repl to check the session, it comes back as {}
[07:40:47] sevenseacat: the session isnt blank there, otherwise your before_action would redirect you
[07:40:59] sevenseacat: so can you gist what you're seeing?
[07:41:00] seanhandley: Where is the "user" object defined?
[07:41:02] BradenBraden: sevenseacat, thats what I feel, but I cant access it
[07:41:20] seanhandley: ah ignore, I see
[07:42:35] Axsuul: has joined #RubyOnRails
[07:43:10] BradenBraden: sevenseacat, when I print out current_user in the index action (via BE repl), it returns a string saying "<html><body>You are being <a href=\"\">redirected</a>.</body></html>"
[07:43:29] sevenseacat: that does not mean that session is nil
[07:43:58] BradenBraden: ok.. still cant see whats in it though via the repl
[07:44:00] sevenseacat: check what the session is
[07:44:30] tetraktys: has joined #RubyOnRails
[07:44:51] sevenseacat: this seems to be inside an engine - are the engine and main app on different subdomains?
[07:45:14] Sawbones: has joined #RubyOnRails
[07:45:21] BradenBraden: not subdomains, just paths
[07:45:24] sevenseacat: i also do not see where the session_key is being defined
[07:46:07] BradenBraden: I have a lib class that handles log in and returns an object containing a hash key which I then save into the session in the login method in app_controller
[07:46:17] sevenseacat: i can see that
[07:46:21] sevenseacat: but that doesnt answer the question
[07:46:35] sevenseacat: where is the session key being defined? what value does it have?
[07:46:36] BradenBraden: then I misunderstood
[07:46:49] BradenBraden: its a SHA512 hash generated on timestamp
[07:46:54] BradenBraden: i can add the lib folder
[07:47:06] sevenseacat: i'd prefer it if you just answered my question
[07:47:11] sevenseacat: its a pretty straightforward one
[07:47:37] sevenseacat: https://gist.github.com/brazenbraden/d2e1170044a1ef1135c7#file-application_controller-rb-L31 what is user_details[:session_key] ?
[07:47:55] pawnbox: has joined #RubyOnRails
[07:48:11] BradenBraden: but ive answered it. session[:user] defined in login function. contains a sha512 hash which is returned from a lib method elsewhere that talks to an external API
[07:48:26] sevenseacat: that does not tell me what value that variable has
[07:48:32] sevenseacat: which i've asked four times now
[07:48:58] BradenBraden: SHA512 hash. string. number and letters.
[07:49:27] BradenBraden: session_key: Digest::SHA2.new(512).hexdigest(Date.today.to_time.to_i.to_s)
[07:52:47] Xentil: has joined #RubyOnRails
[07:54:33] jas02: has joined #RubyOnRails
[07:54:42] pawnbox: has joined #RubyOnRails
[08:00:01] choke: has joined #RubyOnRails
[08:00:16] ur5us: has joined #RubyOnRails
[08:01:04] lacuna: has joined #RubyOnRails
[08:01:04] lacuna: has joined #RubyOnRails
[08:04:16] pawnbox: has joined #RubyOnRails
[08:06:15] brunto: has joined #RubyOnRails
[08:07:06] choke: has joined #RubyOnRails
[08:08:10] pawnbox: has joined #RubyOnRails
[08:09:36] adaedra: has joined #RubyOnRails
[08:10:04] arBmind: has joined #RubyOnRails
[08:11:04] choke_: has joined #RubyOnRails
[08:12:14] ur5us: has joined #RubyOnRails
[08:12:58] yardenbar: has joined #RubyOnRails
[08:13:52] NodeNagant: has joined #RubyOnRails
[08:14:06] NodeNaga_: has joined #RubyOnRails
[08:15:35] darutoko: has joined #RubyOnRails
[08:15:43] pyemkey: has joined #RubyOnRails
[08:17:31] Guest2279: can rails be the back end for a rubymotion app?
[08:19:11] choke_: as an external api yeah. cant include rails into rubymotion of course as it doesn't break down to obj-c
[08:21:13] seanhandley: Guest2279: May be worth considering the API-only mode in Rails5
[08:21:31] pawnbox: has joined #RubyOnRails
[08:21:33] rhizome: or rails-api, or sinatra
[08:22:12] raldu: has joined #RubyOnRails
[08:22:28] choke_: I'm looking at that myself seanhandley ( not even running rails-api ) -- kinda excited for the websocket support
[08:23:00] seanhandley: choke_: Likewise - I have some parts of a monolithic app I'd like to segment out into standalone API services
[08:23:15] seanhandley: Have you played with the beta choke_ ?
[08:23:20] rhizome: tread lightly
[08:23:25] vanne: has joined #RubyOnRails
[08:24:28] choke_: very little seanhandley, i re-did my machine to use rvm so i can have the different gemsets and i'll eventually get around to re-building the api for our mobile-only social network with it
[08:26:37] PedramT: has joined #RubyOnRails
[08:26:52] pawnbox: has joined #RubyOnRails
[08:27:45] roshanavand: has joined #RubyOnRails
[08:29:46] ur5us: has joined #RubyOnRails
[08:30:35] roshanavand: has joined #RubyOnRails
[08:31:13] choke_: and i do mean rebuilding it, 'cause the code is ugly and bad :(
[08:33:35] Cervajz: has joined #RubyOnRails
[08:34:31] jvanbaarsen: has joined #RubyOnRails
[08:34:53] Guest2279: so does ruby motion not have any db functions???
[08:35:09] AzaToth: has joined #RubyOnRails
[08:37:19] Guest2279: ruby motions irc is empty. where do i go to talk to ruby motion people?
[08:37:56] mark1: has joined #RubyOnRails
[08:38:05] choke_: #rubymotion is the rubymotion channel but it's dead ( i also write rubymotion )
[08:38:15] sevenseacat: i'm sure the rubymotion docs can answer your questions
[08:38:25] sandstrom: has joined #RubyOnRails
[08:38:26] choke_: there's also the forums on the docs...
[08:38:40] hypofyse: has joined #RubyOnRails
[08:38:48] blackmesa: has joined #RubyOnRails
[08:38:49] choke_: in terms of a "db" you can use the sqlite gem, but seems stagnant... other than that, it's all core data using cdq
[08:39:50] TheNet: has joined #RubyOnRails
[08:41:10] Dreeg: has joined #RubyOnRails
[08:47:31] d0nn1e: has joined #RubyOnRails
[08:49:09] steffkes: has joined #RubyOnRails
[08:49:09] steffkes: has joined #RubyOnRails
[08:50:31] quazimod1: has joined #RubyOnRails
[08:51:10] Megamos: has joined #RubyOnRails
[08:52:54] roshanavand: has joined #RubyOnRails
[08:54:47] rubyonrailed: has joined #RubyOnRails
[08:54:49] roshanav_: has joined #RubyOnRails
[08:56:48] srinidhi: has joined #RubyOnRails
[08:58:09] shibabu: has joined #RubyOnRails
[09:01:10] yfeldblum: has joined #RubyOnRails
[09:04:49] jsrn_: has joined #RubyOnRails
[09:11:07] craigp: has joined #RubyOnRails
[09:11:08] mmhan: has joined #RubyOnRails
[09:12:19] udiudi: has joined #RubyOnRails
[09:12:23] cornerma1: has joined #RubyOnRails
[09:12:43] peeja: has joined #RubyOnRails
[09:15:15] jvanbaarsen: has joined #RubyOnRails
[09:15:41] roshanavand: has joined #RubyOnRails
[09:17:57] udiudi: Hi guys, having issues with "image.png isn't precompiled" in Rails 3.2 -> Live compile is ON (config.assets.compile = true) with precompile as well, and this image is still missing. Any ideas?
[09:18:49] dmz: has joined #RubyOnRails
[09:18:49] dmz: has joined #RubyOnRails
[09:19:08] udiudi: Google results didn't raise any solutions. Seems like live precompile solved it for most people
[09:19:31] sevenseacat: live compilation wont help if the image doesnt exist
[09:19:42] DoubleMalt: has joined #RubyOnRails
[09:19:49] sevenseacat: and live compilation isnt a good thing anyway
[09:19:50] sevenseacat: can you be more specific about the problem?
[09:19:53] NodeNaga_: has joined #RubyOnRails
[09:19:54] NodeNagant: has joined #RubyOnRails
[09:19:54] NodeNagant: has joined #RubyOnRails
[09:19:55] Ergo: has joined #RubyOnRails
[09:21:14] teclator: has joined #RubyOnRails
[09:22:17] udiudi: Sorry, I misspoke. The image is there in the app server, but I get the same "isn't precompiled" error
[09:22:26] udiudi: no matter what I do.
[09:22:39] sevenseacat: ok, so lets be specific. whats the actual error, with no fake names?
[09:22:54] udiudi: "Error with NotificationsMailer.deliver_message: ActionView::Template::Error - tool_like.png isn't precompiled"
[09:23:07] sevenseacat: ok, so where is tool_like.png ?
[09:23:25] udiudi: This image does exist in the server. I see it: https://dapulse.dapulse.com/assets/tool_like.png
[09:23:53] sevenseacat: well that explains why Sprockets cant find it
[09:24:04] sevenseacat: please put it in app/assets/images
[09:24:16] sevenseacat: so sprockets can precompile it
[09:25:49] udiudi: Uh, wait. Someone messed up this thing. The file WAS in the app/assets/images folder, and was accessible online via assets/tool_like.png. I had a cached version, and now I missing it as well. I think one of the devs removed the image.
[09:26:27] sevenseacat: if it was in app/assets/images it would have a digest as part of the URL, unless that's been disabled for some reason
[09:27:39] snowy: has joined #RubyOnRails
[09:29:00] udiudi: you are correct, should've checked better. It was deleted in the last few hours under my nose.
[09:30:33] sandstrom: has joined #RubyOnRails
[09:30:57] pawnbox: has joined #RubyOnRails
[09:31:57] udiudi: sevenseacat: thank you!
[09:32:31] drale2k: has joined #RubyOnRails
[09:34:15] choke: has joined #RubyOnRails
[09:34:22] rubyonrails251: has joined #RubyOnRails
[09:34:43] Silex: any gotcha for rails with ruby 2.3? using rails 4.2.5 & ruby 2.2 atm
[09:35:06] artto: has joined #RubyOnRails
[09:35:15] sevenseacat: nope, upgrade away!
[09:36:30] rapha: has joined #RubyOnRails
[09:36:40] sevenseacat: rapha: howdy :)
[09:36:51] rapha: Can somebody help me figure out what "/home/jrs/.rvm/gems/ruby-2.2.3@rails42/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require': cannot load such file -- global (LoadError)" is all about?
[09:36:57] yfeldblum: has joined #RubyOnRails
[09:37:11] stannard: has joined #RubyOnRails
[09:37:26] rapha: sevenseacat: howdy, howdy :)
[09:38:49] sevenseacat: have you just upgraded this app in some way?
[09:38:56] sevenseacat: from a previous ruby or rails version?
[09:40:08] rapha: sevenseacat: yes, I pulled changes from Git. Also did a "bundle update". After that it stopped working. Deleted all gems and Gemfile.lock and did a fresh "bundle install", but to no avail. The changes that came in through git didn't touch anything that could have anything to do with this as far as I can see, but not really sure anymore at this point :-/
[09:41:17] rapha: (Interestingly, according to git, the newly created Gemfile.lock is unchanged from the previously committed one)
[09:41:43] sevenseacat: when you see problems like this, its usually due to a) upgrading ruby and not upgrading all the gems correctly, or b) corrupt gem installs
[09:41:51] blackmesa: has joined #RubyOnRails
[09:42:13] sevenseacat: is it possible to clear your gemset and reinstall your gems?
[09:42:20] sevenseacat: oh you said deleted all gems
[09:42:33] rapha: sevenseacat: that's exactly what I did ... "gem uninstall -aIx".
[09:42:47] rapha: I guess I can delete RVM alltogether and reinstall that, too, including Ruby.
[09:43:14] rromanchuk: has joined #RubyOnRails
[09:43:30] sevenseacat: rvm might be a bit extreme but reinstalling ruby cant hurt... i havent seen the actual 'global' error before, usually its openssl or bundler or something like that
[09:44:09] rapha: hmm okay let me try that ... also perhaps upgrading to 2.3.0 from 2.2.3 might change something
[09:44:36] baweaver: has joined #RubyOnRails
[09:46:13] pawnbox: has joined #RubyOnRails
[09:49:21] roshanav_: has joined #RubyOnRails
[09:49:44] rails753: has joined #RubyOnRails
[09:50:35] desmondhume: has joined #RubyOnRails
[09:51:25] gregf_: has joined #RubyOnRails
[09:52:13] Megamos: has joined #RubyOnRails
[09:52:23] arBmind: has joined #RubyOnRails
[09:52:42] rapha: sevenseacat: figured it out ... sort of. In the Gemfile there was a line "gem 'countries', require: 'global'" (I probably copy-pasted that from the Gem's website or somewhere). Once I removed the "require: 'global'", things started working again.
[09:52:58] sevenseacat: ooh interesting... yeah that sounds odd
[09:53:48] ubiks: has joined #RubyOnRails
[09:55:31] rubyonrailed: has joined #RubyOnRails
[09:56:16] srinidhi: has joined #RubyOnRails
[09:56:28] choke: has joined #RubyOnRails
[09:56:39] yfeldblum: has joined #RubyOnRails
[09:56:51] ubiks: has joined #RubyOnRails
[09:57:14] rapha: sevenseacat: anyways, it's working again, which is what's important. Thank you for getting me walking into the right direction :-)
[09:57:52] rails732: has joined #RubyOnRails
[09:58:22] gNoobie__: has joined #RubyOnRails
[09:58:22] Megamos: has joined #RubyOnRails
[09:59:22] marr: has joined #RubyOnRails
[09:59:37] rodfersou: has joined #RubyOnRails
[09:59:41] rails133: has joined #RubyOnRails
[09:59:46] riddled: has joined #RubyOnRails
[10:00:19] rails133: sup! I'm having a stupid issue but i cant seem to fix it. I have a 'code' in the galaxy table but when I attempt to do Galaxy.exists?(galaxy_params.code) galaxy_params being = params.permit(:name, :code) I get a nomethoderror (unidenified method 'code for....)
[10:00:53] sevenseacat: two problems with that code
[10:01:04] sevenseacat: galaxy_params is a hash, so you would need to call galaxy_params[:code]
[10:01:16] rails133: https://gist.github.com/marcguilera/30576d5a1a7475b12807 the issue is in line 16
[10:01:20] sevenseacat: also, exists? expects a hash, not a single value
[10:01:21] shibabu: has joined #RubyOnRails
[10:02:57] rails133: i saw here they use a value http://apidock.com/rails/ActiveRecord/FinderMethods/exists%3F
[10:03:38] sevenseacat: yep, thats when looking up by primary key, which you're not doing
[10:04:00] gregf_: has joined #RubyOnRails
[10:05:39] rails133: in any case thats not the issue tho :/
[10:08:45] blackmesa: has joined #RubyOnRails
[10:08:55] rvanlieshout: you don't have a primary key?
[10:09:22] sevenseacat: its one of the issues.
[10:10:03] lipoqil: has joined #RubyOnRails
[10:10:32] tlarevo: has joined #RubyOnRails
[10:10:40] nertzy: has joined #RubyOnRails
[10:11:17] AwchinBruh: has joined #RubyOnRails
[10:12:06] rvanlieshout: that clearly is an issue
[10:12:10] rvanlieshout: not even a composite primary key
[10:13:13] Megamosaren: has joined #RubyOnRails
[10:13:27] roshanavand: has joined #RubyOnRails
[10:15:38] rails133: i do have a primary key, but i want them to be able to create a code for their galaxy (a code they can remember)
[10:15:52] rails133: so they can enter and access their galaxy (kind of a username)
[10:16:30] rvanlieshout: ah right. but the docs say that if you use an integer or string it uses the primary key
[10:16:33] rvanlieshout: and you don't want that
[10:18:47] choke: has joined #RubyOnRails
[10:21:12] rails133: ok i'll solve that later, but only doing code = galaxy_params.code causes the app to crash.. in the crash I see {"code"=>"centaurus", "settler_id"=>"1"} but i'm doing POST to .../galaxies?code=galaxycode
[10:21:42] rails133: so it's sending the code but its gettinglost somewhere
[10:23:14] sevenseacat: rails133: so after you fixed the two issues I mentioned, whats the problem now?
[10:23:56] Megamosaren: has joined #RubyOnRails
[10:24:18] roshanav_: has joined #RubyOnRails
[10:24:50] rails133: well i didnt fix the issues you mentioned.. i don't get why that would cause galaxy_params.code (just accessing a http param) to break.. i'd like to focus on that first
[10:25:02] sevenseacat: because galaxy_params is a hash
[10:25:09] sevenseacat: a hash does not have the method .code
[10:25:27] sevenseacat: that was the first issue I pointed out
[10:25:43] rails133: oh damn true
[10:28:25] rails133: should just do [:code].. okay now i'll make code an index
[10:28:33] nerfando: has joined #RubyOnRails
[10:30:26] arup_r: has joined #RubyOnRails
[10:30:33] Juanchito: has joined #RubyOnRails
[10:34:23] startupality: has joined #RubyOnRails
[10:37:03] Grundell_: has joined #RubyOnRails
[10:39:09] roshanavand: has joined #RubyOnRails
[10:40:17] choke: has joined #RubyOnRails
[10:43:41] AwchinBruh: has joined #RubyOnRails
[10:45:42] baweaver: has joined #RubyOnRails
[10:45:49] pydave6367: has joined #RubyOnRails
[10:47:24] Grundell_: has joined #RubyOnRails
[10:49:10] herbst: has joined #RubyOnRails
[10:49:10] herbst: has joined #RubyOnRails
[10:50:10] herbst: can i somehow make find return a collection or do i need to us where in that case?
[10:50:33] rapha: has joined #RubyOnRails
[10:51:08] pawnbox: has joined #RubyOnRails
[10:51:16] herbst: i know it sounds stupid, but i have a find_each that i cant/wont change.
[10:52:55] rvanlieshout: show us what you have
[10:55:11] nerfando: has joined #RubyOnRails
[10:56:08] Hans267: has joined #RubyOnRails
[10:56:48] Scripore: has joined #RubyOnRails
[10:59:28] Ergo^: has joined #RubyOnRails
[11:01:50] choke: has joined #RubyOnRails
[11:03:05] Hans267: has joined #RubyOnRails
[11:05:23] dionysus69: has joined #RubyOnRails
[11:06:35] artto: has joined #RubyOnRails
[11:09:19] roshanavand: has joined #RubyOnRails
[11:09:46] FooMunki: has joined #RubyOnRails
[11:16:13] Xentil: has joined #RubyOnRails
[11:17:23] Grundell_: has joined #RubyOnRails
[11:18:31] AimlessRAven: has joined #RubyOnRails
[11:18:42] AimlessRAven: hi all, when i want to upload my rails project with haml to server
[11:18:50] AimlessRAven: how to export haml code to html/css
[11:18:58] AimlessRAven: something like middleman build but for rails
[11:19:03] AimlessRAven: anybody knows ?
[11:19:33] herbst: has joined #RubyOnRails
[11:19:34] herbst: has joined #RubyOnRails
[11:20:32] sevenseacat: AimlessRaven: thats not how it works
[11:20:35] rvanlieshout: AimlessRaven: ^
[11:22:47] choke: has joined #RubyOnRails
[11:23:15] ur5us: has joined #RubyOnRails
[11:23:20] stamina: has joined #RubyOnRails
[11:24:40] AimlessRAven: hah :) yea but its a good info for me and if you wont can help me
[11:25:41] PedramT: has joined #RubyOnRails
[11:26:00] mices: I have users has_one profile, profiles has_many schools, schools has_many teams I'm trying to write the new and create actions for the teams controller i'm not sure what they should be, i have something like @team= current_user.profile.build_team(team_params) which i've been trying different variations of
[11:26:24] Axsuul: has joined #RubyOnRails
[11:26:56] AimlessRAven: ok work questiong.. how to limit floating number to 2 char after .
[11:27:16] Grundell_: has joined #RubyOnRails
[11:27:30] zpe: has joined #RubyOnRails
[11:28:18] leonardoajim: has joined #RubyOnRails
[11:29:05] drale2k: has joined #RubyOnRails
[11:29:08] leksster: has joined #RubyOnRails
[11:30:06] arup_r: AimlessRaven: using migration you can do.. look up scale and precision option
[11:30:42] roshanavand: has joined #RubyOnRails
[11:31:26] efy: has joined #RubyOnRails
[11:33:38] jvanbaarsen: has joined #RubyOnRails
[11:33:55] Sylario: has joined #RubyOnRails
[11:33:56] pydave6367: has joined #RubyOnRails
[11:35:38] Sylario: I do not understand github interface. A pull request done in my fork will be the equivalent of doing git merge fork from the master repo?
[11:36:19] Sylario: i want to pull from the master to my fork, but it seems to do the opposite
[11:36:56] Grundell_: has joined #RubyOnRails
[11:37:01] rvanlieshout: pull from master to your fork != pull request
[11:37:42] adaedra: sylario: add the master as remote in your local git repository, then pull from this remote
[11:37:46] roshanavand: has joined #RubyOnRails
[11:37:57] Macaveli: has joined #RubyOnRails
[11:37:59] Sylario: adaedra: how do i do that on the web interface?
[11:38:10] adaedra: you do it on your local clone
[11:38:15] Macaveli: do i need to set "config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx" in production ?
[11:38:16] Sylario: I feel like console git and github are two different things
[11:38:17] Macaveli: It's enabled in staging
[11:38:22] adaedra: sylario: they are.
[11:38:42] rvanlieshout: has joined #RubyOnRails
[11:40:34] Sylario: adaedra: so a github repo does not work exactly like a git repo?
[11:41:03] adaedra: it does; but the web interface does not gives you the same access than cloning the repo and using the git command does.
[11:41:40] raunicolae: has joined #RubyOnRails
[11:41:53] raunicolae: has left #RubyOnRails: ()
[11:42:20] mices: in nested associations should controller new action always be build_association or can it be either of build_association or create_association
[11:42:31] mices: i thought build was for new and create for create
[11:44:17] rubyonrailed: has joined #RubyOnRails
[11:44:35] shibabu: has joined #RubyOnRails
[11:47:06] neredsenvy: has joined #RubyOnRails
[11:47:17] Cervajz: has joined #RubyOnRails
[11:47:44] startupality: has joined #RubyOnRails
[11:48:00] sankaber: has joined #RubyOnRails
[11:48:44] neredsenvy: In controller I have def new @patient = Patient.new end and in my view I have form_for @patient, url: {:action => :create} do |f| yet I get
[11:48:47] neredsenvy: First argument in form cannot contain nil or be empty
[11:51:51] doodlehaus: has joined #RubyOnRails
[11:52:43] sevenseacat: can you gist the controller and the view?
[11:53:13] sandstrom: has joined #RubyOnRails
[11:54:50] neredsenvy: sevenseacat: https://gist.github.com/anonymous/2a97d60c75a33238b6bc
[11:55:05] hannelita: has joined #RubyOnRails
[11:55:29] sevenseacat: what view is that?
[11:55:52] neredsenvy: sevenseacat: https://gist.github.com/anonymous/a44c1347cc5e65c8f3c4
[11:55:58] neredsenvy: The view is for new
[11:56:01] sevenseacat: is this form being re-rendered after you submit the form, by any chance?
[11:56:49] neredsenvy: sevenseacat: Well I do have if patient.save .. else render :new end
[11:56:51] neredsenvy: in the controller
[11:57:02] sevenseacat: i know that, but im asking you when the error occurs
[11:57:07] sevenseacat: given you havent told us
[11:57:54] neredsenvy: When submitting
[11:57:59] neredsenvy: seems render :new was the problem
[11:58:11] sevenseacat: so when submitting and re-rendering the form, it errors
[11:58:17] sevenseacat: because your create action does not define @patient
[11:58:59] neredsenvy: sevenseacat: You are correct
[12:00:32] sevenseacat: it seems very odd that you're using a CategoriesController to manage patients, not categories
[12:01:26] mices: what causes undefined method create_association
[12:01:33] mices: or build_association
[12:01:38] sevenseacat: mices: not having a method with that name defined.
[12:02:22] tetraktys: has joined #RubyOnRails
[12:02:23] mices: if a has_one or has_many has been declared the method should be defined?
[12:02:37] sevenseacat: where did you get that idea?
[12:03:13] mices: sorry, i meant belongs_to, not has_*
[12:03:31] sevenseacat: the question still stands
[12:03:44] sandstrom: has joined #RubyOnRails
[12:04:04] mices: if teams belongs to schools then there should be a build_team method available to the controller
[12:04:27] sevenseacat: if you dont want to answer the question, thats fine.
[12:04:55] mices: When you declare a belongs_to association, the declaring class automatically gains five methods related to the association:
[12:05:16] mices: including build_association and create_association
[12:05:24] sevenseacat: now read the line below the list of bullet points
[12:05:24] mices: http://guides.rubyonrails.org/association_basics.html
[12:06:16] sevenseacat: thats why you don't have a build_association or create_association method defined.
[12:09:04] roshanav_: has joined #RubyOnRails
[12:10:45] mices: but team model belongs_to :school so then the method should be available as build_team
[12:10:59] sevenseacat: that depends on what you're calling it on.
[12:11:31] sevenseacat: you may have to show some code and an error message.
[12:11:38] gaustin: has joined #RubyOnRails
[12:11:42] sevenseacat: I'm not a mindreader.
[12:13:29] mices: should i be expressing the whole chain in my @team = statement like @team = current_user.profile.school.build_team
[12:13:54] sevenseacat: or you can ignore what i said.
[12:13:57] mices: or should it just be current_user.build_team
[12:13:58] sevenseacat: that works too.
[12:14:06] mices: i'm tryint to put something normal together to paste
[12:16:35] neredsenvy: How can I avoid having to use params[:patient['name']] and just se params[:name]
[12:17:04] sandstrom: has joined #RubyOnRails
[12:17:10] AimlessRAven: has joined #RubyOnRails
[12:17:10] neredsenvy: In my view I'm using f.text_field :name .. which gets me input field with name="patient[name]"
[12:17:34] AimlessRAven: hi all how is the haml helper for parentheses
[12:17:37] RegulationD: has joined #RubyOnRails
[12:17:47] quazimod1: has joined #RubyOnRails
[12:18:27] mices: sevenseacat: https://gist.github.com/mices/63e56d7137b9bb261423
[12:20:06] arup_r: has joined #RubyOnRails
[12:21:24] AimlessRAven: hi all how is the haml helper tu put something in parentheses
[12:21:34] circ-user-AEU3r: has joined #RubyOnRails
[12:21:40] Detch: has joined #RubyOnRails
[12:22:13] rvanlieshout: AimlessRaven: wut?
[12:22:17] sevenseacat: mices: so how are users and teams associated?
[12:22:26] sevenseacat: given you're calling current_user.create_team
[12:22:49] mices: through profles and then schools yet
[12:23:06] sevenseacat: so why do you expect a user to have a create_team method if there is no association between them?
[12:23:14] AimlessRAven: amm if i have var = 5.. i want to put whis var in () but i wont use (#{@var}) .. i wanna use haml helper for this
[12:23:20] AimlessRAven: anyone knows ?
[12:23:30] sevenseacat: AimlessRaven: have you checked the haml docs?
[12:23:52] AimlessRAven: yea but dont fine
[12:24:09] rvanlieshout: i don't understand your question
[12:25:19] rvanlieshout: that exact issue is in the doc
[12:25:20] rvanlieshout: http://haml.info/docs/yardoc/Haml/Helpers.html#surround-instance_method
[12:26:08] atomical: has joined #RubyOnRails
[12:26:32] mices: sevenseacat: since user has only one profile current_user.profile is easy but then there's current_user.profile.school so refresh undefined method `school' for #<Profile:0xb2abfc18>
[12:26:54] sevenseacat: mices: and how are profiles and schools associated?
[12:29:05] AimlessRAven: tnx ravanlieshout
[12:29:13] mices: profile has_many schools and school belongs_to profile
[12:29:16] AimlessRAven: i have one more question
[12:29:21] AimlessRAven: for example if i have
[12:29:24] Mediogre: has joined #RubyOnRails
[12:29:25] AimlessRAven: content_tag(:span, "#{(a.to_f/b.to_f - 1) * 100}% Higher than last", :style => "color: green;")
[12:29:27] mices: sevenseacat: ^
[12:29:29] sevenseacat: mices: so should profile have a school method, given that association?
[12:30:11] drale2k: has joined #RubyOnRails
[12:30:23] AimlessRAven: i want to set view progress bar height to be equal ot variable
[12:30:31] sandstrom: has joined #RubyOnRails
[12:30:44] diegoviola: has joined #RubyOnRails
[12:31:18] rubyonrails556: has joined #RubyOnRails
[12:31:37] rvanlieshout: AimlessRaven: add it to the style? also note that a span is an inline element, without a height
[12:31:39] riddled: has joined #RubyOnRails
[12:32:20] AimlessRAven: no i dont wont to set width for this span
[12:32:27] mices: sevenseacat: only school should have a school method
[12:32:46] AimlessRAven: i have this and
[12:32:55] AimlessRAven: .progress-bar.progress-bar-orange{:style => "width:45%"}
[12:33:02] mices: i mean yes if you mean profile.build_school
[12:33:05] AimlessRAven: and wanna put this percentage to width
[12:33:20] mices: the method belongs to school
[12:33:23] mices: not profile
[12:33:33] mices: it's used in the school controller
[12:33:40] mices: in your example
[12:33:41] sevenseacat: mices: i dont think you know what you mean
[12:33:43] rvanlieshout: AimlessRaven: width: #{foo}%
[12:33:53] mices: you may be right
[12:34:22] blackmesa: has joined #RubyOnRails
[12:34:32] sevenseacat: mices: for example, why idnt your code just using Team.create ?
[12:35:08] mices: that's what i'm thinking, that i shouldn't be using the build_association or create_association methods
[12:35:21] mices: everything's in the url anyway
[12:35:50] mices: userid, profileid,schoolid it's all in the path, so why do i need this
[12:35:57] sevenseacat: the school_id is also part of the submitted form
[12:36:09] sevenseacat: so it would overwrite whatever you build in the association anyway
[12:36:12] diegoviola: my client basically wants me to write a script that fetches their date every 15 minutes and updates the data in the database, I know how to do this... however, they don't have an API that exposes their data and instead they are expecting me to download some Excel file and do parse it
[12:36:16] diegoviola: I have no idea how I'm going to script that
[12:36:16] emilkarl: has joined #RubyOnRails
[12:36:21] diegoviola: since it requires filling forms and such
[12:36:34] sevenseacat: *a wild diegoviola appears and immediately begins complaining about clients again
[12:36:50] diegoviola: sevenseacat: I'm not complaining
[12:36:52] diegoviola: sevenseacat: please stop trolling
[12:37:01] ChanServ: +q *!*@unaffiliated/diegoviola
[12:38:00] mices: sevenseacat: you're right, correction it's all in the url except the schoolid which is available in the form at @school.id and i thought that would be available to the controller at params[:school_id]
[12:38:42] mices: i mean params[:id]
[12:39:57] mices: sevenseacat: sorry i was confused your example vs what i'm doing
[12:40:17] sandstrom: has joined #RubyOnRails
[12:40:37] mices: sevenseacat: to the team controller school.id is available in the path
[12:41:02] mices: you were asking about profiles to schools
[12:41:55] mices: sevenseacat: here's the path for the form http://localhost:3000/users/3/profiles/1/schools/1/teams/new
[12:42:10] mices: everything's there, so what am i using build_ anything for
[12:42:14] artto: has joined #RubyOnRails
[12:42:24] sevenseacat: mices: thats what I was asking :)
[12:43:00] pawnbox: has joined #RubyOnRails
[12:44:17] dkam: has joined #RubyOnRails
[12:45:11] pawnbox: has joined #RubyOnRails
[12:46:25] kitsuneyo: has joined #RubyOnRails
[12:47:58] kitsuneyo: i have a question about test fixtures. i have a user model and a user::profile model. each profile record belongs to a user. how do i associate profile fixtures with user fixtures, since i don't know the id of my user fixtures?
[12:48:01] neredsenvy: Can someone tell me why I'm getting patietns id= could not be found id is null
[12:48:04] neredsenvy: https://gist.github.com/anonymous/68233d372fef2944b8d8
[12:48:15] rvanlieshout: kitsuneyo: consider using factories (factory girl rails)
[12:48:17] neredsenvy: Route matched link_to is correct
[12:48:31] universa1: kitsuneyo: you can reference them by the name of the fixture iirc
[12:48:35] kitsuneyo: rvanlieshout i would rather not do that
[12:48:46] universa1: kitsuneyo: so in the profiles.yml: one:; user: two
[12:49:17] universa1: kitsuneyo: http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures
[12:49:30] rvanlieshout: kitsuneyo: then refer to them using their name
[12:50:36] neredsenvy: ok so I have to use patients_destroy_path(patient)
[12:51:17] rvanlieshout: neredsenvy: destroy_patient_path(patient)
[12:51:36] rvanlieshout: also there should be no collection destroy path
[12:51:40] rvanlieshout: gist your routes
[12:51:45] srinidhi: has joined #RubyOnRails
[12:51:59] kitsuneyo: universa1, so i just use the plain name? not even users(:two) or users(:two).id ?
[12:52:15] rvanlieshout: just the name
[12:52:22] universa1: kitsuneyo: looks like it, from a quick look at the guide. haven't used fixtures in years
[12:52:51] neredsenvy: oh good now I get a server error xD
[12:53:21] kitsuneyo: thanks... i will try factory girl at some point
[12:54:37] tvw: has joined #RubyOnRails
[12:57:01] diego2: has joined #RubyOnRails
[12:57:13] arup_r: kitsuneyo: you should use factorygirl right away.. it is awesome! :)
[12:57:46] Cervajz: has joined #RubyOnRails
[12:58:05] kitsuneyo: arup_r i'm fed up trying to learn a new gem every single time i do anything... so i'll put it on the to-do list
[12:58:05] universa1: factories being nice, are not always the best solution ;)
[12:58:18] neredsenvy: rvanlieshout: It's pateints_destroy_path(patient) but it's always missing id
[12:58:22] insu: has joined #RubyOnRails
[12:58:40] rvanlieshout: hewhomust: that's because it should be destroy_patient_path(patient)
[12:59:04] arup_r: kitsuneyo: learning gem is one time activity.. once you will get it.. next all projects you will be using the same standard gems.. so then u can chill..
[12:59:18] neredsenvy: rvanlieshout: https://gist.github.com/anonymous/13a35341ef09aef77fde my routes
[12:59:44] rvanlieshout: neredsenvy: you're not using resources in your routes.rb are you?
[12:59:47] kitsuneyo: arup_r, true but i think fixtures can do what i need for now
[12:59:55] diego2: has joined #RubyOnRails
[12:59:55] arup_r: ok.. np :)
[13:00:09] neredsenvy: rvanlieshout: No I'm not I have what rails generate controller generated
[13:00:29] neredsenvy: except I fixed as I go get > post for create get > delete for destroy
[13:00:48] neredsenvy: do I also need to add resources :patients on top of all that ?
[13:00:50] xvikvi: has joined #RubyOnRails
[13:01:13] rvanlieshout: neredsenvy: if you don't have resources switch to them
[13:01:22] rvanlieshout: using plain routes is not a good approach
[13:01:39] sandstrom: has joined #RubyOnRails
[13:04:49] neredsenvy: rvanlieshout: So delete the routes and set resources :patients
[13:04:55] neredsenvy: but wont this register even routes I don't ened
[13:05:05] neredsenvy: for instance in my case show
[13:05:07] rvanlieshout: it will, but they are different
[13:05:17] rvanlieshout: and it should be patient_path(patient), method: :destroy
[13:05:24] rvanlieshout: (excuse my former mistakes on that)
[13:05:33] rvanlieshout: link_to 'hi', patient, method: :destroy
[13:05:55] diego2: has left #RubyOnRails: ()
[13:06:11] IFrank00: has joined #RubyOnRails
[13:07:58] doodlehaus: has joined #RubyOnRails
[13:08:02] neredsenvy: rvanlieshout: Same problem it appends id as destroy.2 instead of destroy/2 and gives no id found
[13:08:12] rvanlieshout: did you use resources in your routes?
[13:08:16] rvanlieshout: gist your routes.rb
[13:09:18] neredsenvy: rvanlieshout: https://gist.github.com/anonymous/21097a38c91ad5d377de
[13:09:40] rvanlieshout: that's not routes.rb
[13:09:44] rvanlieshout: and it's still patients_path
[13:09:47] dkam: has joined #RubyOnRails
[13:09:48] futilegames: has joined #RubyOnRails
[13:09:48] rvanlieshout: not patient_path
[13:09:52] mrfoto: has joined #RubyOnRails
[13:10:47] rvanlieshout: patient_path != patientS_path
[13:10:53] neredsenvy: In my routes.rb I have root "patients#index" and resource :patients
[13:10:54] rvanlieshout: and you didn't gist your routes.rb
[13:11:21] neredsenvy: that's all I have in there the ide gives me patients_path if I use patient_path I get an error
[13:11:26] gaustin: has joined #RubyOnRails
[13:12:06] neredsenvy: undefined mathod patient_path
[13:12:19] universa1: resource vs resources
[13:12:28] universa1: rake routes
[13:12:44] rvanlieshout: ah. didn't even notice that from the output
[13:13:23] rvanlieshout: good call universa1 :)
[13:13:34] neredsenvy: should I use resources ?
[13:13:51] universa1: neredsenvy: depends on what you want.
[13:13:56] helpa: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[13:13:59] rvanlieshout: if you want to use it for different patients
[13:14:03] neredsenvy: I thot you can use resource :name to list each one in it's own line and resource to do resources :resource1, :resource2
[13:14:46] neredsenvy: this is making so little sense
[13:14:56] rvanlieshout: resource = used for a single resource
[13:15:02] rvanlieshout: resources = used for multiple
[13:15:12] rvanlieshout: like patient_path versus patient_path(patient)
[13:16:04] neredsenvy: for the love of god finally it works
[13:16:08] sandstrom: has joined #RubyOnRails
[13:16:27] nocontrol: has joined #RubyOnRails
[13:16:30] snowy: has joined #RubyOnRails
[13:17:04] embr: has joined #RubyOnRails
[13:17:09] riddled: has joined #RubyOnRails
[13:17:49] wkoszek: has joined #RubyOnRails
[13:18:02] neredsenvy: universa1: Tho using routes why do I get two routes for update PATCH & PUT
[13:18:07] rvanlieshout: has joined #RubyOnRails
[13:18:40] mices: sevenseacat: but if i just use def create @team = Team.new(team_params) then the school_id value doesn't get passed
[13:18:53] universa1: rails prior to 4.x(?) used put for update, but that isn't the correct http verb for update, which is PATCH, so it creates both for now and with rails 5 there will only be patch.
[13:18:58] sevenseacat: mices: why not?
[13:20:22] phon: has joined #RubyOnRails
[13:21:12] mices: sevenseacat: if it's available to the form as @school.id how would it be available to the controller
[13:21:44] sevenseacat: i presumed it was a field on the form, given you permitted it in your controller
[13:21:57] AimlessRAven: i have 1 more question for example if i have helper with content_tag(:span, "#{(a.to_f/b.to_f - 1) * 100}" "% Lower than last", :style => "color: red;")
[13:22:03] AimlessRAven: and this retur me 33.333333333333333333333
[13:22:10] AimlessRAven: how to limit to 33.3
[13:22:17] mices: sevenseacat: it's not a field in the form, it comes from the url
[13:22:36] mices: there's no id field in the form
[13:22:52] sevenseacat: then you'll have to assign it in your controller
[13:23:27] Hates_: AimlessRaven: use the number_to_percentage helper
[13:23:50] mices: (team_params, params[:school_id]) ?
[13:26:31] dionysus69: has joined #RubyOnRails
[13:26:47] mices: sevenseacat: ^
[13:26:57] mices: that didn't pass the school_id either
[13:27:09] sevenseacat: how would that assign the school id of the created team?
[13:27:24] rogue_koder: has joined #RubyOnRails
[13:29:07] dkam: has joined #RubyOnRails
[13:29:29] drale2k: has joined #RubyOnRails
[13:31:35] AimlessRAven: Hates_ tnx this work !
[13:32:11] Grundell: has joined #RubyOnRails
[13:32:52] kitsuneyo: this test of my namespaced user/profile model fails and i'm not sure why: https://gist.github.com/kitsuneyo/2d03056ae59747b7545f
[13:33:38] mices: sevenseacat: @team = Team.new(params[:user_id, :profile_id, :school_id])
[13:33:59] sevenseacat: mices: that doesnt even make sense.
[13:34:16] mices: all those params are in the path so how else can i get them
[13:35:22] dkam: has joined #RubyOnRails
[13:35:22] mices: here's the path /users/:user_id/profiles/:profile_id/schools/:school_id/teams/new
[13:35:36] differentreality: has joined #RubyOnRails
[13:35:42] dcunit3d: has joined #RubyOnRails
[13:35:46] mices: yikes, i forgot the form params
[13:36:00] sandstrom: has joined #RubyOnRails
[13:36:15] roshanavand: has joined #RubyOnRails
[13:36:22] bePolite: has joined #RubyOnRails
[13:36:22] bePolite: has joined #RubyOnRails
[13:36:25] selfagency: has joined #RubyOnRails
[13:36:50] mices: how do i include the values from the path with the forms' params
[13:37:19] peeja: has joined #RubyOnRails
[13:37:20] kitsuneyo: i guess it could be due to user authorisation...
[13:38:31] mices: sevenseacat: why would it all be in team_params
[13:38:35] dkam: has joined #RubyOnRails
[13:38:36] mices: why wouldn't
[13:38:58] lacrymology: has joined #RubyOnRails
[13:39:39] sevenseacat: because team_params are the selected params from the form.
[13:39:39] neredsenvy: Is it possible to undo last rails generate controller ?
[13:39:48] neredsenvy: or do I have to delte the files manually
[13:39:49] sevenseacat: neredsenvy: rails destroy controller
[13:40:39] dkam_: has joined #RubyOnRails
[13:41:59] lxsameer: has joined #RubyOnRails
[13:43:33] roshanavand: has joined #RubyOnRails
[13:46:55] dstarh: has joined #RubyOnRails
[13:47:02] sandstrom: has joined #RubyOnRails
[13:48:58] dkam__: has joined #RubyOnRails
[13:52:29] arup_r: If you look at the sign_out method, it needs atleast one argument. ( https://github.com/plataformatec/devise/blob/7df57d5081f9884849ca15e4fde179ef164a575f/lib/devise/controllers/sign_in_out.rb#L53 ). Then how inside the session controller such a bare sign_out call worked? https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb#L26
[13:52:42] Detch: has joined #RubyOnRails
[13:53:56] shibabu: has joined #RubyOnRails
[13:54:22] dkam___: has joined #RubyOnRails
[13:55:52] Macaveli: has joined #RubyOnRails
[13:56:29] adaedra: There's a default value
[13:57:48] arup_r: adaedra: link please, I am scratching my head since 15 mins..
[13:58:06] adaedra: arup_r: l56 on the file you linked?
[13:58:20] adaedra: > def sign_out(resource_or_scope=nil)
[13:59:04] arup_r: hmm.. ohh yes, that `nil` i didn't see.. thanks :p
[14:00:19] adaedra: arup_r: better look in the doc than in the source, also? http://www.rubydoc.info/gems/devise/Devise%2FControllers%2FSignInOut%3Asign_out :)
[14:00:49] arup_r: adaedra: thanks..
[14:04:27] ramortegui: has joined #RubyOnRails
[14:04:33] krz: has joined #RubyOnRails
[14:06:09] sandstrom: has joined #RubyOnRails
[14:07:40] aadam21: has joined #RubyOnRails
[14:09:28] roshanav_: has joined #RubyOnRails
[14:10:08] mary5030: has joined #RubyOnRails
[14:10:21] dkam___: has joined #RubyOnRails
[14:11:06] arup_r: capybara + poltergeist how to reload the current page ?
[14:11:40] mrgreenfur: has joined #RubyOnRails
[14:13:07] aerook: has joined #RubyOnRails
[14:14:14] centrx: has joined #RubyOnRails
[14:15:40] dkam___: has joined #RubyOnRails
[14:15:53] gaustin: has joined #RubyOnRails
[14:17:51] arup_r: ok, took help of JS.. page.execute_script('location.reload();') and it does what I wanted
[14:17:59] dkam___: has joined #RubyOnRails
[14:18:38] bcrails: has joined #RubyOnRails
[14:19:08] sandstrom: has joined #RubyOnRails
[14:19:08] neredsenvy: https://gist.github.com/anonymous/db0b21f5027c8bfe8396 undefined method `map' for nil:NilClass
[14:19:19] neredsenvy: But I declared the @wards
[14:19:34] fmcgeough: has joined #RubyOnRails
[14:19:51] neredsenvy: and It's an array of arrays as options_for_select expects
[14:20:20] arup_r: @ward << [ward.name, ward.id] should be @wards << [ward.name, ward.id]
[14:20:36] arup_r: neredsenvy: ^^
[14:21:56] diegoviola: has joined #RubyOnRails
[14:22:14] sevenseacat: ACTION gets crystal ball and predicts the page is erroring when re-rendering the new template from the create action
[14:22:46] aerook: Hello! I'm interested the difference in behavior on AR#select and AR#where detailed here:
[14:22:48] aerook: https://gist.github.com/anonymous/8603ac8b20ee1c5927bc
[14:23:17] ChanServ: -q *!*@unaffiliated/diegoviola
[14:23:29] aerook: is there an idiomatic way to avoid sql injections in a select statement?
[14:24:25] gNoobie__: has joined #RubyOnRails
[14:24:29] adaedra: Never do your 3rd sample
[14:24:45] Papierkorb: aerook: What are you trying to do exactly? Count all rows where some_column > some_value ?
[14:25:55] matthewd: aerook: You might be able to achieve something with direct Arel, maybe?
[14:25:57] sankaber: has joined #RubyOnRails
[14:26:08] Papierkorb: aerook: try this: TheTable.where("foo > ?", the_value).count
[14:26:26] aerook: Papierkorb: that works - it doesnt when you do the same syntax with #select
[14:26:40] Papierkorb: aerook: why do you want to use #select ?
[14:27:29] aerook: i'd like to keep the calculations at the db level, rather than pull the records back into ruby
[14:27:53] Papierkorb: aerook: It does the calculations in the DB. Look at the SQL query Rails generates.
[14:28:05] aerook: oh right - this is part of a much larger query
[14:28:08] aerook: there are several things being selected
[14:28:13] sankaber: has joined #RubyOnRails
[14:28:28] aerook: this is the only part that requires something to be inserted into the select statement
[14:28:39] Papierkorb: aerook: !gist
[14:28:40] fryguy: aerook: there's always AREL
[14:29:03] aerook: Papierkorb: one sec
[14:29:15] aerook: https://gist.github.com/anonymous/8603ac8b20ee1c5927bc was just an example, you want the full query?
[14:29:28] Papierkorb: Yes, the complete code please.
[14:29:51] aerook: ok one moment
[14:30:47] rubyonrailed: has joined #RubyOnRails
[14:30:52] aegis3121: has joined #RubyOnRails
[14:31:18] qejk: has joined #RubyOnRails
[14:31:44] dkamioka: has joined #RubyOnRails
[14:32:11] neredsenvy: arup_r: It just my mistake at copy/paste
[14:32:45] arup_r: neredsenvy: And also one advise to make your code more readble.. use `.map` ...
[14:33:34] arup_r: ar = []; [1,2].each { |e| ar << e * 2 } is same as ar = [1,2].map { |e| e * 2 } is same as
[14:33:38] arup_r: neredsenvy: ^^
[14:34:44] doodlehaus: has joined #RubyOnRails
[14:35:23] neredsenvy: still not sure why it does not work : ((
[14:36:05] arup_r: what is not working..
[14:36:15] neredsenvy: https://gist.github.com/anonymous/db0b21f5027c8bfe8396 undefined method `map' for nil:NilClass
[14:36:24] neredsenvy: @wards = [["Mystery novels",5],["Detective novels",6],["Science fiction",7]]
[14:36:29] neredsenvy: when I output it
[14:37:05] dkamioka: has joined #RubyOnRails
[14:37:36] arup_r: did you change https://gist.github.com/anonymous/db0b21f5027c8bfe8396#file-c-rb-L6 ?
[14:37:43] arup_r: it is still wrong
[14:37:51] arup_r: it is should be @wards
[14:37:52] aerook: Papierkorb: https://gist.github.com/anonymous/50fec3b0df2174ec234d
[14:37:58] fryguy: neredsenvy: @wards = Ward.all.map { |w| [w.name, w.id] }
[14:38:05] neredsenvy: arup_r: I know about that the output is correct
[14:38:08] neredsenvy: ok let me check
[14:38:35] fryguy: which should just be changed to #pluck
[14:39:35] Zadrel: has joined #RubyOnRails
[14:39:39] mices: sevenseacat: https://gist.github.com/mices/63e56d7137b9bb261423
[14:39:49] mices: the school_id doesn't get passed
[14:39:53] Papierkorb: aerook: that's above of what I use AR for
[14:40:03] neredsenvy: nevermind my approach also worked just post/problem : P
[14:40:20] arup_r: I said u :)
[14:40:31] aerook: yea it's basically just raw sql
[14:41:09] chouhoulis: has joined #RubyOnRails
[14:41:13] mices: https://gist.github.com/mices/63e56d7137b9bb261423 in this form and controller the team gets created with a null value school_id
[14:41:32] safetypin: has joined #RubyOnRails
[14:41:34] aerook: Papierkorb: I can manually escape them with http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Quoting.html#method-i-quote, it's not NOT doable, it's just not pretty. I was just curious if there was a more 'correct' way
[14:42:04] twilling: has joined #RubyOnRails
[14:42:07] marahin: has joined #RubyOnRails
[14:42:27] sameerynho: has joined #RubyOnRails
[14:42:32] Papierkorb: aerook: as far standard AR goes, AFAIK(!), using #quote is the 'correct' solution if the method really does not support placeholders
[14:43:23] pyemkey: has joined #RubyOnRails
[14:43:47] NodeNagant: has joined #RubyOnRails
[14:45:10] daivyk: has joined #RubyOnRails
[14:47:35] NodeNaga_: has joined #RubyOnRails
[14:47:46] dkamioka: has joined #RubyOnRails
[14:47:48] cswelin: has joined #RubyOnRails
[14:48:04] loveablelobster: has joined #RubyOnRails
[14:48:30] baweaver: has joined #RubyOnRails
[14:49:07] guiNoobie: has joined #RubyOnRails
[14:49:09] lxsameer__: has joined #RubyOnRails
[14:49:58] guiNoobie: has joined #RubyOnRails
[14:50:06] stannard: has joined #RubyOnRails
[14:50:41] stannard: has joined #RubyOnRails
[14:50:49] tetraktys: has joined #RubyOnRails
[14:52:25] sameerynho: has joined #RubyOnRails
[14:52:39] HalcyonicStorm: has joined #RubyOnRails
[14:53:07] dkam_____: has joined #RubyOnRails
[14:53:38] FooMunki: has joined #RubyOnRails
[14:54:49] sandstrom: has joined #RubyOnRails
[14:55:31] lxsameer: has joined #RubyOnRails
[14:55:38] universa1: aerook: SomeModel.where("some condition ? bla", "blub").sum(:some_column) ?!
[14:57:47] polishdub: has joined #RubyOnRails
[14:58:18] lxsameer__: has joined #RubyOnRails
[14:59:50] matthewd: aerook: Yeah.. still Arel.
[15:00:26] dkam_____: has joined #RubyOnRails
[15:00:30] mices: https://gist.github.com/mices/63e56d7137b9bb261423 team gets inserted with null school_id
[15:00:58] universa1: mices: https://gist.github.com/mices/63e56d7137b9bb261423#file-teams_controller-rb-L28 -- why should this set the school id?
[15:02:04] shibabu: has joined #RubyOnRails
[15:02:22] mices: universal: i don't know, it's a primitive attempt
[15:03:17] mices: universal: if i just use (team_params) the result is the same
[15:03:21] sameerynho: has joined #RubyOnRails
[15:03:33] universa1: mices: what makes you think you can just pass in another parameter?
[15:04:09] DonOtreply: has joined #RubyOnRails
[15:04:09] mices: it's all been passed by the url in show.html.erb i don't see why i need to pass anything
[15:04:21] aerook: matthewd: using AR::Base.connection.quote works just fine
[15:04:50] matthewd: > I was just curious if there was a more 'correct' way
[15:04:59] sergey_makagon: has joined #RubyOnRails
[15:05:10] matthewd: But yes, #quote is a perfectly reasonable option
[15:05:15] mices: universal: it's all been passed by the url in show.html.erb i don't see why i need to pass anything
[15:05:54] universa1: mices: so imagine you're the model. now someone comes a long and gives you a hash with column name -> value combinations and as a second argument lets say 37
[15:06:11] fmcgeough: has joined #RubyOnRails
[15:06:22] bbrowning: has joined #RubyOnRails
[15:06:24] universa1: mices: now what are you going to do with it? you just see a random number...
[15:06:32] mices: universal: why do i have to pass a second argument
[15:06:41] mices: if it's in the url
[15:06:42] universa1: mices: that is what you're doing.
[15:06:54] universa1: mices: trying to show you, that it is wrong.
[15:07:11] universa1: mices: does the model know about urls? does it care about such kind of things?
[15:07:14] matthewd: mices: Have you looked at what's in team_params ?
[15:07:14] StevenXL: has joined #RubyOnRails
[15:07:18] artto: has joined #RubyOnRails
[15:07:36] mices: matthewd: how can i see what's in team_params
[15:07:47] twilling: has joined #RubyOnRails
[15:09:03] matthewd: p, puts, log, inspect, byebug, pry... you should know how to wield at least one of those by now
[15:09:07] treehug88: has joined #RubyOnRails
[15:09:08] aadam21: has joined #RubyOnRails
[15:09:11] mices: universal: if i just use (team_params) school_id ends up being null
[15:09:41] universa1: mices: so have you looked at the docs for create i linked you?
[15:10:22] lenage: has joined #RubyOnRails
[15:11:56] mices: universal: you linked me to line 28 of teams_controller.rb in my own gist
[15:13:00] mices: universal: you haven't sent me a link to docs for create
[15:13:47] StevenXL: has left #RubyOnRails: ()
[15:14:00] StevenXL: has joined #RubyOnRails
[15:14:33] dkam_____: has joined #RubyOnRails
[15:15:11] mices: universal: refresh
[15:15:35] StevenXL: Hello everyone. I am successfully creating a foreign key constraint at the database level. However, the database still allows me to save a record if the foreign key column is nil.
[15:15:52] StevenXL: This is unexpected, but I imagine the answer is simply to add a not null constraint. Unfortunately, that is not working.
[15:15:55] StevenXL: I'll link to my migration file:
[15:16:46] StevenXL: http://pastebin.com/8qVLKSdi
[15:17:02] StevenXL: Can someone tell me why my not null constraint is not being applied?
[15:17:03] bsamson: has joined #RubyOnRails
[15:17:15] StevenXL: oops, I'll use pastie from now onw
[15:17:19] universa1: mices: http://api.rubyonrails.org/classes/ActiveRecord/Persistence/ClassMethods.html#method-i-create
[15:19:07] StevenXL: http://pastie.org/10676174
[15:19:48] mag42c: has joined #RubyOnRails
[15:19:51] dkam_____: has joined #RubyOnRails
[15:20:54] kies^: has joined #RubyOnRails
[15:21:39] zpe: has joined #RubyOnRails
[15:21:56] rubyonrailed: has joined #RubyOnRails
[15:22:02] jkamenik: has joined #RubyOnRails
[15:22:18] lxsameer__: has joined #RubyOnRails
[15:22:42] bricker: has joined #RubyOnRails
[15:23:27] StaticVoid: has joined #RubyOnRails
[15:25:13] dkam_____: has joined #RubyOnRails
[15:25:29] sandstrom: has joined #RubyOnRails
[15:27:02] tenderlove: has joined #RubyOnRails
[15:28:08] Sylario: The get you use in functionnal testing, from where in rails does it come from?
[15:28:16] Cervajz: has joined #RubyOnRails
[15:28:23] rogue_koder: has joined #RubyOnRails
[15:28:23] krz: has joined #RubyOnRails
[15:29:39] guiNoobie: has joined #RubyOnRails
[15:30:59] universa1: sylario: a quick look for get on api.rubyonrails.org suggests: http://api.rubyonrails.org/classes/ActionDispatch/Integration/RequestHelpers.html#method-i-get
[15:31:50] chimche: has joined #RubyOnRails
[15:32:00] Sylario: universa1: thanks
[15:32:02] mrtomme: has joined #RubyOnRails
[15:32:25] chimche: has left #RubyOnRails: ()
[15:33:31] chimche: has joined #RubyOnRails
[15:33:37] hypofyse: isnt that the integration testing version of 'get' ?
[15:34:30] universa1: might be. pry show-source or looking through the docs a bit more will give you the other ones, too...
[15:34:47] Sylario: I am working to add functionnalities on the API of an existing open source project. This project use multi tenancy, and it was not needed until now in the API. SInce i added multi tenancy into it : https://github.com/bsylvain/brimir/commit/fdd1dd501709789b1b78c29b1690a94fbc7e98e8 integration tests fails
[15:35:10] hypofyse: ActionController::TestCase::Behavior::ClassMethods
[15:35:49] Sylario: here is the failling test : https://github.com/ivaldi/brimir/blob/master/test/integration/api/v1/api_login_test.rb
[15:36:12] defsdoor: has joined #RubyOnRails
[15:36:22] momomomomo: has joined #RubyOnRails
[15:36:24] Sylario: I am not sure how does the test works with subdomains
[15:36:55] Sylario: does a test environnement even use a domain name?
[15:37:08] soahccc: has joined #RubyOnRails
[15:37:31] Sylario: Also it is supposed to run in Travis
[15:38:02] universa1: sylario: googling your problem: second or third hit: http://stackoverflow.com/questions/10193213/rails-how-to-test-subdomains-with-rspec
[15:39:45] dkam_____: has joined #RubyOnRails
[15:39:49] Sylario: universa1: there is no rspec
[15:39:52] diegoviola: can capybara handle downloading files and things like that?
[15:40:20] diegoviola: because I need to download a excel file and parse the data, I'm not sure if I should just use a HTTP request but I also have to log in, etc
[15:40:29] diegoviola: any advices, please?
[15:40:30] universa1: sylario: you might adopt the code...
[15:40:52] diegoviola: capybara/poltergeist
[15:41:09] universa1: diegoviola: !g capybara download file
[15:41:14] fox_mulder_cp: diegoviola: first links from google try?
[15:41:49] brunto: has joined #RubyOnRails
[15:42:42] Sylario: universa1: i am not sure a first time contributor can ask for a new test suite immediately
[15:42:46] diegoviola: universa1: well, I'm mostly unsure about what's the right thing to use here... capybara or just a curl/http request from ruby
[15:43:18] diegoviola: universa1: I'm pretty sure I can use either, I'm just unsure about which one would be better
[15:43:25] universa1: sylario: adopt the code from rspec to whatever you're using.
[15:43:29] symbol: has joined #RubyOnRails
[15:43:59] universa1: diegoviola: then ask that. and the answer to that would be: try out the different solutions, and select whatever you like most.
[15:44:13] diegoviola: universa1: ok
[15:44:21] universa1: sylario: you don't need to adopt the test code to rspec.
[15:44:44] lacrymology: has joined #RubyOnRails
[15:45:24] sameerynho: has joined #RubyOnRails
[15:46:22] rubyonrails687: has joined #RubyOnRails
[15:46:23] universa1: sylario: but then you haven't even shown the error... so it might be something else...
[15:46:42] Sylario: the error is in the pull request
[15:46:55] Scripore: has joined #RubyOnRails
[15:47:06] Sylario: https://github.com/ivaldi/brimir/pull/245
[15:47:07] universa1: sylario: which pull request?!
[15:47:35] smathy: has joined #RubyOnRails
[15:47:42] pawnbox_: has joined #RubyOnRails
[15:48:04] universa1: sylario: https://travis-ci.org/ivaldi/brimir/jobs/100800386#L637
[15:48:17] arup_r: has joined #RubyOnRails
[15:48:33] universa1: sylario: so it is the test mailer configuration that is wrong...
[15:48:34] Axsuul: has joined #RubyOnRails
[15:48:44] Sylario: it is because of the multi tenancy
[15:49:00] guiNoobie: has joined #RubyOnRails
[15:49:10] jagira: has joined #RubyOnRails
[15:49:11] universa1: sylario: nevertheless... you need to adopt the mailer configuration for the test environment.
[15:49:18] kies^: has joined #RubyOnRails
[15:49:33] gheegh: has joined #RubyOnRails
[15:50:17] dici: has joined #RubyOnRails
[15:50:26] teaearlgraycold: So when I deploy via capistrano my server seems to run fine, but I can't open the console
[15:50:36] pawnbox: has joined #RubyOnRails
[15:50:48] universa1: teaearlgraycold: how are you trying to open the console?
[15:50:50] teaearlgraycold: It used to give me some error about bundler/setup, but someone on SO mentioned spring, so I disabled spring in prod
[15:50:58] dkam______: has joined #RubyOnRails
[15:50:58] guiNoobie: has joined #RubyOnRails
[15:50:59] teaearlgraycold: universa1: with both rails c and bundle exec rails c
[15:51:13] universa1: teaearlgraycold: full error + command you entered => gist.
[15:51:14] sandstrom: has joined #RubyOnRails
[15:51:23] teaearlgraycold: I've also tried SPRING_DISABLE=true bundle exec rails c or whatever that is exactly
[15:51:29] chimche: has joined #RubyOnRails
[15:52:05] baweaver: has joined #RubyOnRails
[15:52:06] guiNoobie: has joined #RubyOnRails
[15:52:20] AckZ: has joined #RubyOnRails
[15:52:30] guiNoobie: has joined #RubyOnRails
[15:52:42] chimche: Anyone have recommendation for simple gem to add FAQ with search to existing site?
[15:53:01] safetypin: has joined #RubyOnRails
[15:53:34] twilling: has joined #RubyOnRails
[15:53:44] jagira: Has anyone managed to deploy rails 5 app with actioncable behind nginx proxy?
[15:54:03] teaearlgraycold: universa1: http://pastie.org/private/we7gikcgah0xx6fcswc6g
[15:54:37] teaearlgraycold: "$ DISABLE_SPRING=true bundle exec rails c production" yields the same result
[15:54:49] twilling: has joined #RubyOnRails
[15:55:01] universa1: teaearlgraycold: RAILS_ENV=production bundle exec rails c
[15:55:09] universa1: could you try that
[15:55:20] teaearlgraycold: I have RAILS_ENV=production set in my .bashrc, but I'll try that too
[15:56:02] teaearlgraycold: Same result with that var set
[15:56:10] dkam______: has joined #RubyOnRails
[15:56:54] teaearlgraycold: Do I need spring?
[15:57:13] matthewd: teaearlgraycold: Sounds like you have the spring binstub, but don't have spring available
[15:57:14] universa1: teaearlgraycold: it should not be active on the server
[15:57:40] teaearlgraycold: matthewd: so check ~/.rbenv/shims ?
[15:57:43] universa1: teaearlgraycold: you could try to rename the bin folder and check if bundle exec rails c works
[15:58:08] matthewd: teaearlgraycold: No, check bin/rails:4 (per the backtrace)
[15:58:13] sandstrom: has joined #RubyOnRails
[15:58:16] teaearlgraycold: Thanks, universa1 matthewd
[15:58:35] universa1: anyways, gtg :-) good luck
[15:58:55] momomomomo: has joined #RubyOnRails
[16:00:52] bePolite: has joined #RubyOnRails
[16:01:10] atumzin: has joined #RubyOnRails
[16:02:04] Macaveli: has joined #RubyOnRails
[16:04:34] DonOtreply: has joined #RubyOnRails
[16:04:35] rubyonra_: has joined #RubyOnRails
[16:04:44] lacuna: has joined #RubyOnRails
[16:04:44] lacuna: has joined #RubyOnRails
[16:06:09] lacuna: has joined #RubyOnRails
[16:06:10] lacuna: has joined #RubyOnRails
[16:06:38] chouhoulis: has joined #RubyOnRails
[16:07:04] dionysus69: has joined #RubyOnRails
[16:10:46] twilling: has joined #RubyOnRails
[16:10:57] RegulationD: has joined #RubyOnRails
[16:11:22] chouhoul_: has joined #RubyOnRails
[16:15:04] tcmzeal: has joined #RubyOnRails
[16:15:05] Rodya_: has joined #RubyOnRails
[16:16:15] mary5030: has joined #RubyOnRails
[16:16:24] pawnbox: has joined #RubyOnRails
[16:16:32] baweaver: has joined #RubyOnRails
[16:17:03] maxx88: has joined #RubyOnRails
[16:19:48] edwinvdgraaf: has joined #RubyOnRails
[16:19:53] SteenJobs: has joined #RubyOnRails
[16:20:22] krz: has joined #RubyOnRails
[16:24:00] pyemkey: has joined #RubyOnRails
[16:24:20] pyemkey: Hello, can anyone look into my code and help me do refactor? My task is to count years in given period of times. https://gist.github.com/pyemkey/1303a22757224542890e
[16:25:14] tubbo: pyemkey: if end_date and start_date are Time objects, i'm pretty sure you can just return the year as a number and then subtract the two dates.
[16:25:23] tubbo: pyemkey: so like start_date.year - end_date.year
[16:25:56] dkam______: has joined #RubyOnRails
[16:26:59] smathy: I don't even want to ask about INSURANCE_PERIOD_IN_DAYS = 364
[16:31:02] ankhers: pyemkey: Out of curiosity, you say that the instance period is one year - one day. Is it always 364 days, or on leap years (like this year) is it 365?
[16:31:09] dkam______: has joined #RubyOnRails
[16:31:15] ankhers: s/instance/insurance
[16:31:39] riddled: has joined #RubyOnRails
[16:32:14] Yomero3: has joined #RubyOnRails
[16:32:23] pyemkey: Ankhers: That's true, I did not cover a leap year.
[16:32:32] sandstrom: has joined #RubyOnRails
[16:33:21] DaniG2k: has joined #RubyOnRails
[16:33:33] DaniG2k: hello all :)
[16:34:18] DaniG2k: I have a simple question. I have a really simple helper method called set_html_lang that does the following: I18n.locale.to_s I'm just wondering how I'd test this in RSpec.
[16:34:37] DaniG2k: this seems to work: expect(view.set_html_lang).to eq('en')
[16:34:53] DaniG2k: but basically it needs to work for all available locales
[16:35:07] DaniG2k: is there a way I can change locale from RSpec
[16:35:14] sandstrom: has joined #RubyOnRails
[16:35:15] DaniG2k: to test if it returns the correct strings for each locale?
[16:35:29] pvertenten: has joined #RubyOnRails
[16:36:42] pawnbox: has joined #RubyOnRails
[16:37:28] pawnbox: has joined #RubyOnRails
[16:40:22] matthewd: DaniG2k: How do you change the locale in your application?
[16:41:51] dkam______: has joined #RubyOnRails
[16:42:11] DaniG2k: matthewd: the only place this is used is in my application.html.erb file, with the following line: <html lang="<%= set_html_lang %>">
[16:42:32] DaniG2k: so that when a route goes to one of my locales, it sets the html language in the template
[16:42:37] matthewd: DaniG2k: No, how do you *set* the locale?
[16:43:13] doodlehaus: has joined #RubyOnRails
[16:43:18] [Butch]: has joined #RubyOnRails
[16:43:53] DaniG2k: matthewd: with routes :P I guess that checking the routes should be enough then
[16:44:07] DaniG2k: its not a big problem just a question I had
[16:44:26] Megamos: has joined #RubyOnRails
[16:44:30] jvanbaarsen: has joined #RubyOnRails
[16:44:35] matthewd: It wasn't supposed to be a trick question ??\_(???)_/??
[16:45:18] matthewd: You presumably have code that's setting the locale based on the route
[16:45:52] matthewd: Said code should answer the question: "is there a way I can change locale from RSpec"
[16:46:13] DaniG2k: there are links to different languages
[16:46:23] DaniG2k: but that's not testing the helper per-se
[16:46:28] DaniG2k: that's testing the routes
[16:46:36] DaniG2k: I don't like tests anyway :P
[16:47:15] dkam______: has joined #RubyOnRails
[16:47:45] sergey_makagon: has joined #RubyOnRails
[16:48:17] matthewd: DaniG2k: FYI, "oh well" is a deeply unpleasant response to an attempt to help solving your problem
[16:49:11] mostlybadfly: has joined #RubyOnRails
[16:49:20] sandstrom: has joined #RubyOnRails
[16:52:34] dkam______: has joined #RubyOnRails
[16:54:57] lenage: has joined #RubyOnRails
[16:55:19] DaniG2k: matthewd: so in my routes.rb I have a default locale which is english: get '' => redirect("/#{I18n.default_locale}")
[16:55:21] elaptics: DaniG2k: what does your actual set_html_lang method do?
[16:55:37] shibabu: has joined #RubyOnRails
[16:55:40] DaniG2k: elaptics: it literally just returns the following: I18n.locale.to_s
[16:55:46] DaniG2k: nothign fancy
[16:55:57] pipework: has joined #RubyOnRails
[16:56:00] DaniG2k: that gets set in the application.html.erb's <html lang="">
[16:56:13] elaptics: DaniG2k: so then somewhere in your controller/s you probably have something that's actually setting the locale according to some criteria
[16:56:58] elaptics: quite possibly something like I18n.locale = <some locale key>
[16:57:21] elaptics: and whatever that is - that's your answer - do the same thing in your specs
[16:57:27] DaniG2k: elaptics: ah yes! precisely that
[16:57:51] DaniG2k: I18n.locale = params[:locale] || I18n.default_locale
[16:57:56] dkam______: has joined #RubyOnRails
[16:57:58] matthewd: Yeah.. that's what I was trying to drag out of you before.
[16:58:14] DaniG2k: matthewd: sorry :/
[16:58:41] Andr3as: what js image stuff is best used nowadays for rails 4 and image popups.. something like flexbox, lightbox or so, if there isnt anything more modern out there
[16:58:52] Andr3as: anyone has a suggestion?
[16:59:31] hobodave: has joined #RubyOnRails
[17:01:14] DonOtreply: has joined #RubyOnRails
[17:01:27] jvanbaarsen: has joined #RubyOnRails
[17:02:14] startupality: has joined #RubyOnRails
[17:04:17] Mirry: has joined #RubyOnRails
[17:09:05] nerfando: has joined #RubyOnRails
[17:10:44] mary5030: has joined #RubyOnRails
[17:11:08] tibra: has joined #RubyOnRails
[17:11:38] Guest26953: has left #RubyOnRails: ()
[17:12:38] bricker: has joined #RubyOnRails
[17:12:41] dkam______: has joined #RubyOnRails
[17:12:59] sandstrom: has joined #RubyOnRails
[17:13:03] craigp: has joined #RubyOnRails
[17:14:24] duderonomy: has joined #RubyOnRails
[17:16:02] Diabolik: does anyone know of any other open source projects built on top of spree, like https://github.com/openfoodfoundation/openfoodnetwork
[17:16:47] Bloomer: has joined #RubyOnRails
[17:17:22] rubyonrailed: has joined #RubyOnRails
[17:17:55] safety_cut: has joined #RubyOnRails
[17:17:59] IFrank00: has joined #RubyOnRails
[17:18:11] dkam______: has joined #RubyOnRails
[17:21:06] atumzin: has joined #RubyOnRails
[17:21:06] atumzin: has joined #RubyOnRails
[17:23:00] shinnya: has joined #RubyOnRails
[17:23:12] koryteg: has joined #RubyOnRails
[17:23:31] dkam______: has joined #RubyOnRails
[17:23:42] dangeranger: has joined #RubyOnRails
[17:24:09] dideler: has joined #RubyOnRails
[17:25:26] jmignault: has joined #RubyOnRails
[17:26:31] startupality: has joined #RubyOnRails
[17:28:54] dkam______: has joined #RubyOnRails
[17:29:33] tibra: has joined #RubyOnRails
[17:29:49] celly: has joined #RubyOnRails
[17:30:01] [Butch]: has joined #RubyOnRails
[17:30:41] momomomomo: has joined #RubyOnRails
[17:30:47] benlieb: has joined #RubyOnRails
[17:32:20] craigp: has joined #RubyOnRails
[17:32:53] nertzy: has joined #RubyOnRails
[17:34:25] baweaver: has joined #RubyOnRails
[17:34:42] dkam______: has joined #RubyOnRails
[17:34:52] snowy: has joined #RubyOnRails
[17:35:07] hobodave_: has joined #RubyOnRails
[17:35:18] momomomomo: has joined #RubyOnRails
[17:38:31] luther07: has joined #RubyOnRails
[17:39:18] disgrntld: has joined #RubyOnRails
[17:39:52] mordof1: has joined #RubyOnRails
[17:39:54] dkam______: has joined #RubyOnRails
[17:39:58] rtl_: has left #RubyOnRails: ()
[17:40:13] rtl: has joined #RubyOnRails
[17:40:40] mordof1: has left #RubyOnRails: ()
[17:41:57] mordof_work: has joined #RubyOnRails
[17:42:18] momomomomo: has joined #RubyOnRails
[17:42:33] mordof_work: is there a way with ActiveRecord to include an extra field in the response for a model that isn't part of the database?
[17:43:31] sandstrom: has joined #RubyOnRails
[17:45:17] ascarter: has joined #RubyOnRails
[17:45:18] dkam______: has joined #RubyOnRails
[17:45:21] mordof_work: http://pastebin.com/h0XTE70a weight_percent isn't a database field on ShortUrlPathEntry, but i want it to show up in the results from that association extension
[17:45:22] mordof_work: anyone know how to make that happen?
[17:46:12] mordof_work: http://pastie.org/10676434
[17:50:37] dkam______: has joined #RubyOnRails
[17:51:25] craigp: has joined #RubyOnRails
[17:52:02] snowy: has joined #RubyOnRails
[17:52:22] upgrayeddd: has joined #RubyOnRails
[17:52:39] smathy: mordof_work, just a method on ShortUrlPathEntry
[17:53:03] mordof_work: smathy: i added that, but it doesn't show in the results from with_normalized_weights
[17:54:08] smathy: mordof_work, explain what "show in the results" means.
[17:54:47] mordof_work: smathy: i want to be able to do steps.with_normalized_weights.first.weight_percent, for example
[17:55:16] Mirry: has joined #RubyOnRails
[17:55:53] smathy: mordof_work, with a method on ShortUrlPathEntry you can just do: steps.first.weight_percent
[17:57:03] mordof_work: that is true - i was originally overwriting the weight field.. but i wanted to avoid people being able to save bad values. hm
[17:57:31] shibabu: has joined #RubyOnRails
[17:57:38] mordof_work: i'll have to modify to_json, and other group helpers for .steps though if i do that
[17:57:55] axl_: has joined #RubyOnRails
[17:58:19] mordof_work: i generally just do .steps - and pass that to the json renderer
[17:58:19] Jasaka: has joined #RubyOnRails
[17:59:18] dopie2: has joined #RubyOnRails
[17:59:19] smathy: mordof_work, right, so this is why I was asking about "show in the results", yes you will need to do that. Those group helpers use .attributes - which comes from the DB - so yeah, no way to inject into that unless you have an actual DB field. Ie. you have to add other attributes that you want displayed in things like to_json manually.
[18:00:14] Megamos: has joined #RubyOnRails
[18:00:39] claytonzaugg: has joined #RubyOnRails
[18:01:41] jmfurlott: has joined #RubyOnRails
[18:03:02] markh: has joined #RubyOnRails
[18:05:04] nunchuck: has joined #RubyOnRails
[18:05:19] smathy: mordof_work, of course it's simple to override as_json in your model: def as_json options={}; super options.merge methods: :weight_percent; end
[18:05:30] dkam______: has joined #RubyOnRails
[18:05:44] Scriptonaut: has joined #RubyOnRails
[18:06:10] baweaver: has joined #RubyOnRails
[18:06:11] guacamole: has joined #RubyOnRails
[18:06:16] lacuna: has joined #RubyOnRails
[18:06:17] lacuna: has joined #RubyOnRails
[18:09:07] sleungcy: has joined #RubyOnRails
[18:10:17] startupality: has joined #RubyOnRails
[18:10:49] aegis3121: has joined #RubyOnRails
[18:10:53] dkam______: has joined #RubyOnRails
[18:11:52] guacamole: has joined #RubyOnRails
[18:11:52] northfurr: has joined #RubyOnRails
[18:12:00] chipotle: has joined #RubyOnRails
[18:12:13] mag42c: has joined #RubyOnRails
[18:12:17] northfurr: does github have a cdn for hosting images for readme files?
[18:12:18] drale2k: has joined #RubyOnRails
[18:14:54] iateadonut: has left #RubyOnRails: ()
[18:15:34] Jasaka|NA: has joined #RubyOnRails
[18:15:54] mordof_work: smathy: ends up being easier/less hassle just to include a weight_percent field in the database, and update that alongside weight itself
[18:16:33] rubyonrailed: has joined #RubyOnRails
[18:17:45] northfurr: has joined #RubyOnRails
[18:20:30] roshanavand: has joined #RubyOnRails
[18:20:52] JakFrist: has joined #RubyOnRails
[18:21:41] dkam______: has joined #RubyOnRails
[18:23:58] hypofyse: has joined #RubyOnRails
[18:24:26] akshat: has joined #RubyOnRails
[18:24:59] chimche: has joined #RubyOnRails
[18:25:41] Andr3as: if i'd wanted to change some options of lightbox ( http://lokeshdhakar.com/projects/lightbox2/#options ) how am i supposed to do that in my coffeescript? i've tried a thousand possibilities and dont get it.. anyone able to give me a hint?
[18:25:42] seaworthy: hi i have render json: { error_code: ERROR_NOERROR, status: "ok", sell_transactions: sell_transactions, buy_transactions: buy_transactions } but the api does not generate output that contains 'includes '. how woudl i make that happen?
[18:26:15] jvanbaarsen: has joined #RubyOnRails
[18:26:56] dkam______: has joined #RubyOnRails
[18:27:27] meoblast001: has joined #RubyOnRails
[18:27:59] guacamole: has joined #RubyOnRails
[18:30:55] bePolite: has joined #RubyOnRails
[18:30:56] bePolite: has joined #RubyOnRails
[18:32:16] dkam______: has joined #RubyOnRails
[18:32:41] brycesenz: has joined #RubyOnRails
[18:33:00] pawnbox: has joined #RubyOnRails
[18:37:09] mcr-credil: has joined #RubyOnRails
[18:37:15] chipotle: has joined #RubyOnRails
[18:37:33] n00bDev: has joined #RubyOnRails
[18:37:42] dkam______: has joined #RubyOnRails
[18:38:43] pawnbox: has joined #RubyOnRails
[18:40:43] smathy: seaworthy, you need to include the `:include` in your `to_json` (or `as_json`) too, Rails doesn't automatically include associations.
[18:41:04] smathy: seaworthy, simplest might be to override `as_json` in your own models to include that option.
[18:41:32] seaworthy: i figured out
[18:42:21] chimche: has joined #RubyOnRails
[18:42:59] dkam______: has joined #RubyOnRails
[18:43:18] startupality: has joined #RubyOnRails
[18:44:05] amortimer: has joined #RubyOnRails
[18:44:20] edwinvdgraaf: has joined #RubyOnRails
[18:44:44] stannard: has joined #RubyOnRails
[18:46:03] chimche: has joined #RubyOnRails
[18:46:47] Frem: has joined #RubyOnRails
[18:48:19] dkam______: has joined #RubyOnRails
[18:49:24] momomomomo: has joined #RubyOnRails
[18:49:55] pawnbox: has joined #RubyOnRails
[18:50:50] test22: has joined #RubyOnRails
[18:50:55] alex88: has joined #RubyOnRails
[18:51:07] steffkes: has joined #RubyOnRails
[18:51:07] steffkes: has joined #RubyOnRails
[18:52:05] dopie: has joined #RubyOnRails
[18:53:16] northfurr: has joined #RubyOnRails
[18:53:31] Cervajz: has joined #RubyOnRails
[18:53:40] dkam______: has joined #RubyOnRails
[18:54:34] cswelin: has left #RubyOnRails: ("WeeChat 1.3")
[18:54:43] snowy: has joined #RubyOnRails
[18:55:06] tvw: has joined #RubyOnRails
[18:56:23] hobodave: has joined #RubyOnRails
[18:57:33] momomomomo: has joined #RubyOnRails
[18:57:37] Megamos: has joined #RubyOnRails
[18:58:26] tubbo: Andr3as: what's the issue you're having with it?
[18:58:57] tubbo: Andr3as: the example code given in that documentation should work if you have the lightbox js script loaded
[18:59:01] dkam______: has joined #RubyOnRails
[19:01:42] Andr3as: tubbo: i've added that into my coffescript
[19:02:05] Andr3as: and it didnt work or sort of "disabled" the js
[19:02:34] Andr3as: e.g. it just loaded the file when clicking on the link, instead of triggering light box
[19:02:49] rhizome: code sounds incomplete, then
[19:03:45] juddey: has joined #RubyOnRails
[19:03:51] Andr3as: maybe, but i dont know whats missing :/
[19:04:10] guacamole: has joined #RubyOnRails
[19:04:21] dkam______: has joined #RubyOnRails
[19:04:38] rogue_koder: has joined #RubyOnRails
[19:04:50] Megamos: has joined #RubyOnRails
[19:05:09] hobodave_: has joined #RubyOnRails
[19:05:47] Andr3as: hmm.. just thought i might just add it into the vew, as a test
[19:05:52] Andr3as: doesnt even work there
[19:05:56] Andr3as: interesting
[19:06:33] edwinvdgraaf: has joined #RubyOnRails
[19:07:26] ur5us: has joined #RubyOnRails
[19:07:26] Megamosaren: has joined #RubyOnRails
[19:07:36] tubbo: Andr3as: no JS errors?
[19:07:43] tubbo: should be in your console
[19:07:45] Andr3as: nope, nothing
[19:07:51] futilegames: has joined #RubyOnRails
[19:07:56] Andr3as: it opens the image in the "box"
[19:08:00] Andr3as: but ignores the options
[19:08:18] jmfurlott: has joined #RubyOnRails
[19:08:34] edwinvdgraaf: has joined #RubyOnRails
[19:09:41] Andr3as: Uncaught ReferenceError: lightbox is not defined
[19:09:43] dkam______: has joined #RubyOnRails
[19:10:27] jklass: has joined #RubyOnRails
[19:11:24] pawnbox: has joined #RubyOnRails
[19:12:35] tubbo: there u go
[19:12:48] chipotle: has joined #RubyOnRails
[19:13:01] Andr3as: you remember the lack of knowledge part yesterday?
[19:13:13] Andr3as: the js file is included
[19:13:17] edwinvdgraaf: has joined #RubyOnRails
[19:13:22] Andr3as: and linked as an asset
[19:13:36] Andr3as: and the lightbox does work
[19:13:42] Andr3as: opens up the images as expected
[19:13:52] Andr3as: how cant it not be defined?
[19:13:53] baweaver: has joined #RubyOnRails
[19:14:23] edwinvdgraaf: has joined #RubyOnRails
[19:14:39] ur5us: has joined #RubyOnRails
[19:15:03] dkam______: has joined #RubyOnRails
[19:15:11] andrew-l: hi - I have two models connected via has_many relation, A has_many B. when A is saving, B saves as well. When A is being saved, I want to set an attribute in B. How can I do this?
[19:15:48] tubbo: Andr3as: !code
[19:15:48] helpa: Andr3as: We cannot help you with your problem if you don't show us your code. Please put it on http://gist.github.com and give us the URL so we can see it.
[19:16:23] srinidhi: has joined #RubyOnRails
[19:16:26] nertzy: has joined #RubyOnRails
[19:18:12] Andr3as: tubbo: https://gist.github.com/awunder/7811bf3032ca269fb0b9
[19:18:52] brycesenz: andrew-l - you can use before_save/after_save hooks.
[19:19:15] edwinvdgraaf: has joined #RubyOnRails
[19:19:35] brycesenz: andrew-l - I would probably put those hooks in model B though, otherwise it'll be much harder to reason about where those attribute values are coming from later
[19:20:30] andrew-l: brycesenz: hmm... put before_save hooks in B to have A set data in B?
[19:20:34] dkam______: has joined #RubyOnRails
[19:20:45] tubbo: Andr3as: hmm, i can't see anything wrong with the code you wrote
[19:20:56] brycesenz: andrew-I - can you elaborate more on what you're trying to do?
[19:21:12] tubbo: the only reason i can see for this issue is that the `this` that's supposed to be `window` is not what we think it is.. https://github.com/lokesh/lightbox2/blob/master/src/js/lightbox.js#L14-L27
[19:21:24] andrew-l: brycesenz: let me put together a gist
[19:21:32] brycesenz: andrew-l - that would be helpful, thanks
[19:23:08] edwinvdgraaf: has joined #RubyOnRails
[19:24:26] NoTroutAboutIt: has joined #RubyOnRails
[19:24:54] Andr3as: tubbo: hmm. idont grasp your implication, though ;)
[19:25:10] Papierkorb: Does someone know how I can match a path like /:uuid+:extra ? https://gist.github.com/Papierkorb/7417dd2eed940854a17a does not work, without the constraint every request like /the-uuid+foo goes to the :show action, and with the constraint, I get to see the 404 route page
[19:25:20] Andr3as: however, i g2g for an hour or so, need to get some dinner
[19:25:21] tubbo: Andr3as: well i'm not sure what is actually causing it but that's the only way i can see this not working
[19:25:28] tubbo: unless there's something else going on
[19:25:37] Andr3as: thank you for jumping in
[19:25:39] Papierkorb: I'd be happy to take any other character than + but / and -
[19:26:00] andrew-l: brycesenz: here's basically what I want to do: https://gist.github.com/a-leung/4b9df65ed98f82e1baac
[19:26:07] smathy: Papierkorb, why not / ?
[19:26:13] andrew-l: thanks for checking it out. i really appreciate it
[19:26:28] Papierkorb: smathy: because the /after paths are reserved for stuff like the /info
[19:26:55] Papierkorb: and I would like to not mix those two
[19:28:22] dopie: has joined #RubyOnRails
[19:28:23] brycesenz: andrew-l - see the comment I made on that gist. Does that work for you?
[19:29:23] smathy: Papierkorb, can :shadow ever be the string "info" ?
[19:29:23] pvertenten: has joined #RubyOnRails
[19:29:29] pvertenten: has left #RubyOnRails: ()
[19:29:30] WhereIsMySpoon_: has left #RubyOnRails: ()
[19:29:33] Papierkorb: smathy: technically, yes
[19:30:02] matthewd: Papierkorb: Arbitrary non-special characters in routes always confuse me, so, while there may be a way to do it "nicely", I'd probably just do `get '/file/:uuid_and_shadow'`, with an appropriate constraint, and then split it manually
[19:30:16] mordof_work1: has joined #RubyOnRails
[19:30:42] aegis3121: has joined #RubyOnRails
[19:30:55] Papierkorb: matthewd: Good call, that will probably just work
[19:31:11] lbotos_: has joined #RubyOnRails
[19:31:32] ur5us_: has joined #RubyOnRails
[19:31:37] treehug88: has joined #RubyOnRails
[19:32:08] ArTiSTiX: has joined #RubyOnRails
[19:32:15] treehug88: has joined #RubyOnRails
[19:32:22] brycesenz: andrew-l - I've updated that gist again. You can use the same pattern, but just refer back to A's value
[19:32:32] borkdude: has joined #RubyOnRails
[19:32:35] _3dwardsharp: has joined #RubyOnRails
[19:32:37] hannelita: has joined #RubyOnRails
[19:32:41] chaas_: has joined #RubyOnRails
[19:32:53] Dreeg_: has joined #RubyOnRails
[19:32:57] webhat_: has joined #RubyOnRails
[19:33:05] neanderslob_: has joined #RubyOnRails
[19:33:26] badeball_: has joined #RubyOnRails
[19:33:37] fox_muld1r_cp: has joined #RubyOnRails
[19:33:51] aujt74_: has joined #RubyOnRails
[19:33:52] gregf: has joined #RubyOnRails
[19:34:02] guacamole: has joined #RubyOnRails
[19:34:17] mrbubbles: has joined #RubyOnRails
[19:34:20] xhoy_: has joined #RubyOnRails
[19:34:21] darrik_: has joined #RubyOnRails
[19:34:22] andrew-l: brycesenz: would it be easier to just follow the comments on the gist?
[19:34:26] justinweiss_: has joined #RubyOnRails
[19:34:32] jxf_: has joined #RubyOnRails
[19:34:38] brycesenz: andrew-l sure
[19:34:51] sdn90_: has joined #RubyOnRails
[19:35:18] dkam______: has joined #RubyOnRails
[19:35:26] spastorino_: has joined #RubyOnRails
[19:35:28] baweaver: has joined #RubyOnRails
[19:36:20] mary5030: has joined #RubyOnRails
[19:36:24] DoubleMalt: has joined #RubyOnRails
[19:36:51] dcunit3d: has joined #RubyOnRails
[19:37:16] constantinexvi_: has joined #RubyOnRails
[19:37:19] teaearlgraycold_: has joined #RubyOnRails
[19:37:19] Plas: has joined #RubyOnRails
[19:37:23] JonasOSDever_: has joined #RubyOnRails
[19:37:28] dshoreman_: has joined #RubyOnRails
[19:38:05] martinbjeldbak: has joined #RubyOnRails
[19:38:49] nizmow: has joined #RubyOnRails
[19:38:53] NoTroutAboutIt: has joined #RubyOnRails
[19:38:55] nunchuck: has joined #RubyOnRails
[19:38:59] brycesenz: andrew-l - are you all set now? Does what I said make some sense, and (more importantly), is your code working?
[19:39:18] Haydos: has joined #RubyOnRails
[19:39:29] Meow-J_: has joined #RubyOnRails
[19:40:04] cookiez: has joined #RubyOnRails
[19:40:05] LBRapid: has joined #RubyOnRails
[19:40:42] dkam______: has joined #RubyOnRails
[19:40:50] mrbubbles: Does rails have a callback mechanism so that when a property on a model changes you can fire a function
[19:41:18] arup_r: has joined #RubyOnRails
[19:41:37] Denarii: mrbubbles: http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
[19:41:46] Denarii: But if you value your sanity, just don't even go there.
[19:41:50] mices: has joined #RubyOnRails
[19:41:56] sublimate: has joined #RubyOnRails
[19:42:02] mrbubbles: Hahah thanks Denarii
[19:42:12] mrbubbles: I was going to send out notifications when the status of an alarm chnages
[19:42:32] mrbubbles: But I guess you're saying it's more sensible to be in control and send out the notifications myself rather than having rails do the "magic"
[19:42:49] brycesenz: Denarii - aw, ActiveRecord callbacks aren't *all* bad
[19:43:04] drale2k: has joined #RubyOnRails
[19:43:25] Denarii: Not joking. Unless your app is very small and will stay that way, callbacks are more trouble than they're worth. I work on a large Rails app full of callbacks. Some models have dozens, and trying to reason about its behavior is insane.
[19:43:30] brycesenz: mrbubbles - it sounds like you'd be well off implementing kind of a state machine then. Then you can more easily control what happens on transitions.
[19:44:17] mrbubbles: Okay I'll do some reading
[19:44:17] cnk: has joined #RubyOnRails
[19:44:21] mrbubbles: Thakns brycesenz
[19:44:26] ziyadb: has joined #RubyOnRails
[19:44:54] flashpoint9: has joined #RubyOnRails
[19:44:54] eggoez: has joined #RubyOnRails
[19:45:03] brycesenz: Denarii - for business logic, I totally agree with you. But I love them for some situations. E.g. we have a Phone model that has a phone_number attribute, but we like to store a separate field for area_code. So we have a before_validation hook to populate that derived field correctly.
[19:45:05] DonOtreply: has joined #RubyOnRails
[19:45:10] amitchellbullard: has joined #RubyOnRails
[19:46:00] dkam______: has joined #RubyOnRails
[19:48:03] nibbo: has joined #RubyOnRails
[19:48:41] mices: has joined #RubyOnRails
[19:48:47] mices: if this works @school = current_user.profile.schools.new(school_params) then how would i take it a step further into the next joined table, teams, which belongs_to school
[19:48:55] arup_r: has joined #RubyOnRails
[19:49:29] mices: that's the create in my schools_controller
[19:49:54] Denarii: brycesenz: I prefer to just avoid them entirely. We've been trying to move toward using service objects that handle all of the side effects that need to happen when changing a model or processing a request. The only place we use callbacks where I don't really mind it is a pubsub system we have that we use for updating elasticsearch when things change.
[19:50:20] brycesenz: mices - you could have schools accept_nested_params for teams
[19:51:10] brycesenz: Denarii - I get that. We use service objects for all side effects as well. I guess where I see things kind of differently is for derived fields. That to me falls under the idea of "a model should know how to persist itself", and callbacks can be nice for that IMO
[19:51:44] FailBit: #ruby-java
[19:51:45] cvikvi: has joined #RubyOnRails
[19:51:48] dkam______: has joined #RubyOnRails
[19:52:34] manfrin: has joined #RubyOnRails
[19:53:54] mices: brycesenz: params or attributes?
[19:53:57] Sawbones: has joined #RubyOnRails
[19:54:13] brycesenz: mices - sorry, attributes
[19:54:35] brycesenz: mices - I personally don't like using nested_attributes, so I don't really do it, but it is the most Rails-y way to do what you're talking about
[19:55:00] mices: how would you do it then
[19:55:43] claytonzaugg: has joined #RubyOnRails
[19:55:44] mices: i don't like it either i shouldn't have to resort to that when everything's in the url
[19:55:50] mrbubbles: brycesenz can you recommend a state machine tutorial :)
[19:56:13] mices: users/:user_id/profiles/:profile_id/schools/:school_id/teams/new
[19:56:25] brycesenz: mices - Personally, I would create a service object that takes in the params from your form and persists them correctly. It's more overhead, but I think it's cleaner and easier to test.
[19:56:26] arup_r: mrbubbles: there is gem of same name ..
[19:56:37] FailBit: what happened here
[19:56:41] mrbubbles: thanks arup_r
[19:56:44] FailBit: ACTION reads backlog
[19:56:57] diegoviola: Radar: I was already unmuted and apologized to sevenseacat
[19:56:59] diegoviola: thanks anyway
[19:57:00] brycesenz: mrbubbles - https://github.com/aasm/aasm
[19:57:05] dkam______: has joined #RubyOnRails
[19:57:25] cschneid: has joined #RubyOnRails
[19:57:29] mrbubbles: Oh wow that looks ace
[19:57:32] mrbubbles: Keeps things nice and clean
[19:57:58] diegoviola: do you guys have any experience with mechanize?
[19:58:03] FailBit: acts as shit machine
[19:58:16] arup_r: diegoviola: yes..
[19:58:20] FernandoBasso: has joined #RubyOnRails
[19:58:24] diegoviola: I'm trying to download a file with mechanize
[19:58:30] brycesenz: FailBit - you dislike that gem, or state machines in general?
[19:58:33] diegoviola: but I get the same form where I submit the data to donnload the file
[19:58:42] diegoviola: I don't know what's going on
[19:58:54] [Butch]_: has joined #RubyOnRails
[19:58:54] diegoviola: I can share some code if you want to
[19:59:19] FailBit: brycesenz: tbf
[19:59:23] FailBit: most of my experience with that gem
[19:59:30] FailBit: was when we were using mongo
[19:59:38] Denarii: brycesenz: Yeah, fair enough. I guess if it's not doing anything outside the model it's not too bad.
[19:59:49] zpe: has joined #RubyOnRails
[19:59:56] helpa: Show rather than tell. Explaining your problem with code, stacktraces or errors is always preferred to explaining it with just text. Show us what's happening, rather than telling us. Put the code on https://gist.github.com and then give us the HTTP link to the Gist.
[20:00:07] shibabu: has joined #RubyOnRails
[20:00:10] Palsson: has joined #RubyOnRails
[20:00:28] netzfisch: has joined #RubyOnRails
[20:00:47] brycesenz: FailBit - that's totally fair. I haven't had much experience with that particular gem honestly. I still use the old "state_machine" gem by pluginaweek, but it's deprecated.
[20:01:13] FailBit: I haven't had any complains since we switched to postgres
[20:01:16] mices: brycesenz: so now that i added it the schools model what would the create action line look like?
[20:01:23] draig: has joined #RubyOnRails
[20:01:28] brycesenz: FailBit - I just really like state machines as a pattern. I've worked on enough projects that try to replicate the same idea with a handful of boolean fields and timestamps, and it's a nightmare.
[20:01:32] FailBit: thankfully..
[20:01:54] edwinvdgraaf: has joined #RubyOnRails
[20:01:56] FailBit: that works if you have 2 states
[20:02:04] FailBit: if you have more you should use a state machine
[20:02:33] dkam______: has joined #RubyOnRails
[20:02:41] brycesenz: mices - so if schools can accept nested attributes for team, then you can pass the nested parameters directly into something like School.new(), or School.create()
[20:03:19] Oog: has joined #RubyOnRails
[20:03:30] Radar: state_machine is deprecated?
[20:03:32] Pazician: has joined #RubyOnRails
[20:03:58] arup_r: who said ?
[20:04:10] Radar: brycesenz
[20:05:08] brycesenz: This gem - https://github.com/pluginaweek/state_machine . It hasn't been worked on in years and has problems with Rails 4 validations
[20:05:11] DEA7TH: has joined #RubyOnRails
[20:05:21] mices: brycesenz: as in something like @team = current_user.profile.schools.teams.new()
[20:05:34] brycesenz: Deprecated may be the wrong word, but if I were to rebuild the state machines in our project, I'd use a gem that's being maintained
[20:06:15] brycesenz: mices - what are the parameters that you're trying to pass in to create new teams? I thought you were trying to pass in "team" parameters along with "school" parameters.
[20:06:27] mrfoto: has joined #RubyOnRails
[20:06:36] mices: brycesenz: team_params
[20:06:57] mices: brycesenz: plus school_id
[20:07:27] eljimmy: has joined #RubyOnRails
[20:07:27] brycesenz: mices - if all you're trying to do is pass in team params to an existing school, why not use "School.find(school_id).teams.build(team_param)"?
[20:07:55] dkam______: has joined #RubyOnRails
[20:08:09] mices: brycesenz: because i already have the school id in the url
[20:08:20] Megamos: has joined #RubyOnRails
[20:08:47] brycesenz: mices - I don't follow why that would be a problem
[20:09:44] mices: just passing the params from the url to the controller together with the params from the form
[20:10:40] brycesenz: mices - Again, I'm unclear on what the issue is. If you submit a form to a controller action, and that action has access to :school_id, what is the problem?
[20:10:57] brycesenz: mices - could you put together a gist showing where things are going wrong?
[20:12:10] mices: if the url is users/:user_id/profiles/:profile_id/teams/new then what would be the corresponding create action for the controller when the form brought up by this link is submitted is my question, i have something like @team = Team(team_params) but that ends up not including the school_id
[20:12:16] akshat: has joined #RubyOnRails
[20:12:23] maximski: has joined #RubyOnRails
[20:12:25] mices: i'm sorry i left out schools in the url
[20:12:42] mices: users/:user_id/profiles/:profile_id/schools/:school_id/teams/new
[20:12:47] diegoviola: arup_r:
[20:12:54] SteenJobs: has joined #RubyOnRails
[20:12:56] diegoviola: https://gist.github.com/diegoviola/52440365df05f84d388f
[20:13:07] dkam______: has joined #RubyOnRails
[20:13:25] diegoviola: after the second form submit, I get the same form html page
[20:13:41] diegoviola: on the browser, I would get an actual excel file
[20:13:47] mices: brycesenz: ^
[20:13:53] diegoviola: I'm trying to download the xls file
[20:14:21] nerfando: has joined #RubyOnRails
[20:14:46] mices: brycesenz: https://gist.github.com/mices/63e56d7137b9bb261423
[20:14:56] brycesenz: mices - again, why not "@team = School.find(params[:school_id]).teams.build(team_params)"?
[20:15:28] nerfando: has joined #RubyOnRails
[20:15:46] arup_r: diegoviola: http://stackoverflow.com/questions/4360043/using-wwwmechanize-to-download-a-file-to-disk-without-loading-it-all-in-memory
[20:15:47] mices: brycesenz: if that's the way to do it, i never would have figured that out
[20:16:08] mices: i don't like having to use find i don't see why i have to
[20:16:23] pawnbox: has joined #RubyOnRails
[20:17:28] brycesenz: mices - You could also probably do "@team = Team.new(team_params.merge(:school_id => params[:school_id})". But it depends on your Team validations on whether or not that model would be valid.
[20:18:02] JonasOSDever: has joined #RubyOnRails
[20:18:04] edwinvdgraaf: has joined #RubyOnRails
[20:18:10] mices: brycesenz: i'm surprised rails can't figure all this out from the path an easier way
[20:18:13] brycesenz: mices - also, what's wrong with using find? It's like, basically the point of having IDs.
[20:18:24] mices: brycesenz: ok
[20:18:27] dkam______: has joined #RubyOnRails
[20:18:28] guacamole: has joined #RubyOnRails
[20:18:47] mices: brycesenz: is this method for use with accepts_nested_attributes or can i remove that
[20:18:59] test: has joined #RubyOnRails
[20:19:07] mices: i can remove it
[20:19:10] arup_r: mices: did you ready any books before you start building your own.. May be you didn't. But you should do it.. it will pay you off
[20:19:13] brycesenz: mices - Rails isn't going to just assign values to your models based on path. I know you might not believe me, but that would be bad.
[20:19:22] maximski: anyone building angular + rails apps and can tell me if you can sign in users in the angular and rails part of your app at once?
[20:19:26] brycesenz: mices - you can remove "accepts_nested_attributes".
[20:19:58] mices: brycesenz: it knows the user_id, profile_id, school_id all from the path
[20:20:15] futilegames: has joined #RubyOnRails
[20:20:28] mices: if you look at the route it tells you whatever's in those placeholders will be taken as values for those keys
[20:20:55] brycesenz: mices - yes, it does know those IDs. And to get the corresponding models, you can use User.find(params[:user_id]), Profile.find(params[:profile_id]), et.c
[20:21:00] JonasOSDever: has joined #RubyOnRails
[20:21:35] brycesenz: mices - where I'm confused is that you know that it takes in all of those IDs, which is great, but I'm confused what *else* you think rails should be doing?
[20:21:54] markh: has joined #RubyOnRails
[20:22:14] mices: just give me an easy way to pass whatever else is missing from the request, in my case school_id, with the rest of the request
[20:22:20] mices: which is team_params
[20:22:35] drjimmy: has joined #RubyOnRails
[20:23:02] mices: you know i tried (team_params, params[:school_id])
[20:23:07] mices: didn't work
[20:23:30] brycesenz: mices - that's what I suggested with team_params.merge(schoold_id: params[:school_id])
[20:23:55] stannard: has joined #RubyOnRails
[20:23:55] dkam_______: has joined #RubyOnRails
[20:24:08] brycesenz: mices - you can merge that ID into the params hash. but Team.new() accepts a hash of parameter arguments, not a second parameter for association ids
[20:24:19] guacamole: has joined #RubyOnRails
[20:24:34] brycesenz: mices - oops, that should read "school_id", not "schoold_id"
[20:25:07] momomomomo_: has joined #RubyOnRails
[20:25:31] safety_cut: has joined #RubyOnRails
[20:25:37] mices: brycesenz: when you suggested accepts_nested_attributes did you understand that i had all my params available in the url?
[20:25:59] mices: because you said that's the railsy way to do it
[20:26:04] baweaver: has joined #RubyOnRails
[20:26:05] RegulationD: has joined #RubyOnRails
[20:26:06] yfeldblum: has joined #RubyOnRails
[20:26:07] mices: maybe i wanna do it the railsy way
[20:26:25] brycesenz: mices - I did, but I thought that what you were trying to do was create a new School and several new Teams all with one call. I didn't realize that you had an existing School and just want to add Teams to it.
[20:26:43] tubbo: schooled_id
[20:27:01] brycesenz: mices - "accepts_nested_params" is useful in the former case. Like, you can imagine submitting a form for a new object and it's child objects all together.
[20:27:01] diegoviola: arup_r: I can't use form.submit when using Mechanize::Download
[20:27:29] mices: brycesenz: i see, ty
[20:27:47] arup_r: diegoviola: what is the manual process to download the excel? Steps please..
[20:27:48] brycesenz: mices - I do really like the comment in your gist "# Never trust parameters from the scary internet, only allow the white list through."
[20:27:58] DonOtreply: has joined #RubyOnRails
[20:28:21] arup_r: brycesenz: that probably came from scaffold.. it is not what mice would write.. really
[20:28:50] diegoviola: arup_r: 1) login in on the site 2) open this url: 3) add the start date and end date, click on generate button
[20:28:58] tubbo: definitely comes from the scaffold
[20:29:01] diegoviola: arup_r: then the download will start
[20:29:10] dkam_______: has joined #RubyOnRails
[20:29:11] brycesenz: arup_r - I feel like such a lame dev. I still never use scaffold. I entirely don't trust it.
[20:29:26] tubbo: brycesenz: scaffolds are for novices
[20:29:46] tubbo: literally...they're designed to give you tangible examples of rails code, you're not really supposed to "take them to production"
[20:29:48] arup_r: brycesenz: my point was something different.. hope you got it.. :)
[20:30:11] brycesenz: arup_r - I know, haha
[20:30:47] brycesenz: tubbo - yeah, that's fair. it was more of a joke
[20:30:52] arup_r: diegoviola: ok, so you post the form and it starts download
[20:32:02] tubbo: winning at life...takes me up to about 15-30 seconds now to realize my trackpad has died
[20:32:10] _3dwardsharp: has joined #RubyOnRails
[20:32:15] mices: brycesenz: i like the find method
[20:32:17] tubbo: everything is in the shell!
[20:32:21] tubbo: so i don't need it very often
[20:32:33] mdw: has joined #RubyOnRails
[20:32:55] arup_r: diegoviola: http://stackoverflow.com/a/16502820
[20:33:22] brycesenz: tubbo - yeah, but still. broken trackpad :(
[20:33:39] Sirithcam: has joined #RubyOnRails
[20:33:40] arup_r: diegoviola: After post your are getting a response back from the server, like you do get when you work with Rails app.. think that way.. and you need to use the reponse
[20:34:04] tubbo: brycesenz: it's a magic trackpad so it's battery operated...it's not like broken
[20:34:27] brycesenz: tubbo - oh, haha, that's a much better situation
[20:34:30] dkam_______: has joined #RubyOnRails
[20:35:48] Detch: has joined #RubyOnRails
[20:36:12] sonofdirt: has joined #RubyOnRails
[20:38:23] Ringo: has joined #RubyOnRails
[20:39:50] Pumukel: has joined #RubyOnRails
[20:39:52] dkam_______: has joined #RubyOnRails
[20:39:53] treehug88: has joined #RubyOnRails
[20:40:31] diegoviola: arup_r: finally!
[20:40:41] arup_r: diegoviola: \o/
[20:40:45] diegoviola: agent.submit(form, button)
[20:40:47] diegoviola: agent.submit(form, button).save
[20:42:30] corioliss: has joined #RubyOnRails
[20:44:04] futilegames: has joined #RubyOnRails
[20:44:36] jmfurlott: has joined #RubyOnRails
[20:45:22] dkam_______: has joined #RubyOnRails
[20:45:58] Pumukel: has joined #RubyOnRails
[20:48:19] dangeranger: has joined #RubyOnRails
[20:49:11] dcunit3d: has joined #RubyOnRails
[20:50:34] dkam_______: has joined #RubyOnRails
[20:51:20] arBmind: has joined #RubyOnRails
[20:52:56] safety_cut: has joined #RubyOnRails
[20:53:10] guacamole: has joined #RubyOnRails
[20:53:32] mices: brycesenz: you're saying this would be the controller's create action or new action?
[20:53:39] mices: @team = School.find(params[:school_id]).teams.build(team_params)
[20:54:17] eljimmy: has joined #RubyOnRails
[20:54:20] mices: between the new action and create action is the form
[20:54:22] Scriptonaut: has left #RubyOnRails: ()
[20:54:25] dopie: has joined #RubyOnRails
[20:54:28] mices: so how's the value gonna be on the form
[20:54:36] mices: if not in a hidden field
[20:54:56] brycesenz: mices - that code will instantiate a new Team model, with the school association in place. If you want to then try to save it, you would do @team.save
[20:54:58] daande: New Action -> New VIEW -> (on form submit) -> Create Action
[20:55:27] brycesenz: mices - I'm not sure I understand the point you're trying to make around Views. daande is correct that a view can be thought of as between the new action and the create action
[20:55:48] mices: brycesenz: that's what i'm saying
[20:55:57] dkam_______: has joined #RubyOnRails
[20:56:08] brycesenz: mices - ok. so what's the confusion?
[20:56:23] mices: what the form's submitted how shall the school_id have been included in the team_params hash
[20:56:45] mices: s/what/when/
[20:56:56] arup_r: has joined #RubyOnRails
[20:57:09] Grundell: has joined #RubyOnRails
[20:57:11] daande: the school_id doesnt get created until it is created in the database during a .save()
[20:57:13] mices: in the form, it's available at @school.id
[20:57:22] baweaver: has joined #RubyOnRails
[20:57:32] mices: i'm creating a team not a school heh
[20:57:37] daande: well whatever
[20:57:49] mices: schools has many teams
[20:57:50] daande: calling team.new then going to the view
[20:58:17] daande: you will need to select the school id in the form
[20:58:51] brycesenz: daande - he doesn't need the school_id in the form, since it's included in the URL. the school is already in the DB in his use case
[20:59:19] daande: oh well you need to pass it as a hidden field in the form then no?
[20:59:47] brycesenz: daande - not if it's in the url. It's part of the path
[20:59:52] daande: I assume you have something like /school_id/team/new
[21:00:27] brycesenz: daande - he does yes. It's something like ".../schools/:school_id/teams/new"
[21:00:31] daande: sorry I wasnt paying attention to what the full usecase is in this scenario
[21:00:50] brycesenz: mices - Ok, so in your "new" action, you have @team = Team.new. That's totally fine.
[21:01:12] brycesenz: mices - then in your create action, you take in the params and build a new Team object using those params and the school id
[21:01:16] dkam_______: has joined #RubyOnRails
[21:01:27] safety_c_: has joined #RubyOnRails
[21:01:39] brycesenz: mices - so, "@team = Team.new(team_params.merge(school_id: params[:school_id])"
[21:01:56] brycesenz: mices - then you can try to save that new @team object. If it is valid, it will save
[21:02:45] daande: Also in the form if you want to say something like "Creating a team for <school name> you should be able to access the school name via: @team.school.name
[21:02:45] snowy: has joined #RubyOnRails
[21:02:47] brycesenz: mices - does that make sense conceptually? Or is there something that still isn't clicking?
[21:03:51] daande: Heh im trying to change a webapp / iphone app from pusher to actioncable for the last 3 days
[21:03:57] mices: brycesenz: yes that makes sense, i thought the team_params hash had to be built before being passed to create
[21:04:18] StaticVoid: has joined #RubyOnRails
[21:04:28] brycesenz: mices - oh, no. I apologize if I gave you that impression
[21:04:54] mices: brycesenz: ty
[21:04:57] brycesenz: mices - in your new action you *can* also say "@team = Team.new(school_id: params[:school_id])"
[21:05:08] brycesenz: mices - but practically, that won't do anything, you know?
[21:05:15] flashpoint9: has joined #RubyOnRails
[21:05:30] mices: because the form will be submitted without the school_id right?
[21:05:46] mices: unless that's gonna create a hidden field
[21:06:33] pawnbox: has joined #RubyOnRails
[21:06:36] dkam_______: has joined #RubyOnRails
[21:06:42] daande: do you have Rails Panel running in chrome or something?
[21:06:48] daande: you can easily see what params are being submitting
[21:06:51] daande: submitted*
[21:06:54] daande: or you can see in the logs
[21:07:05] brycesenz: mices - the form will be submitted with out the "school_id" in the form params, but school_id will come over as part of the URL.
[21:07:11] flashpoint9: Im trying to grab data from an external source that is json, currently i can grab the entire bit. The issue is I can't seem to manipulate the data or grab specific parts. http://paste.ofcode.org/Kc8xFBXfbtyreT5qPtvQvd
[21:07:37] guacamole: has joined #RubyOnRails
[21:07:47] sleungcy: has joined #RubyOnRails
[21:07:53] brycesenz: mices - daande's idea is a good one. I think if you look at what raw params are coming over, you will have a better sense of what's happening
[21:08:36] daande: mices - thats what I do all the time. Look at the raw params coming over
[21:08:50] flashpoint9: For example I want to grab the latest gold price from that json object, I've googled a ton but cant get it working
[21:09:44] mices: https://gist.github.com/mices/63e56d7137b9bb261423 still the school_id is null when the record is added
[21:10:13] brycesenz: flashpoint9 - so what is failing for you? Can you not then do @data["dataset"]["id"] to get the id (for example)?
[21:10:21] emilkarl: has joined #RubyOnRails
[21:11:17] brycesenz: mices - is "school_id" an assignable parameter for Team?
[21:11:30] Radar: @data["dataset"]["data"].first
[21:11:43] brycesenz: accessible attribute, sorry.
[21:11:52] Pazician: has joined #RubyOnRails
[21:11:54] flashpoint9: brycesenz: yes that worked perfectly, could it have been me using single qoutes? if not I messed up somehwere else
[21:11:57] daande: mices - check your logs and see if there are any errors
[21:12:00] Macaveli: has joined #RubyOnRails
[21:12:07] dkam_______: has joined #RubyOnRails
[21:12:13] Radar: flashpoint9: single quoted strings are interpreted almost the same as double quoted strings
[21:12:18] Radar: double quoted allows for interpolation, that's all
[21:12:23] daande: as brycesenz said it might not be assignable
[21:12:25] Radar: flashpoint9: It'd be helpful to see what you tried.
[21:12:26] brycesenz: flashpoint9 - single strings shouldn't matter
[21:13:13] brycesenz: mices - if you just open rails console and try "team = Team.new(school_id: 4)", does that new object have a school id of 4? or does it not get assigned?
[21:13:28] threeminutemonta: has joined #RubyOnRails
[21:13:37] flashpoint9: Radar: oh you know what I believe maybe I tried that in the view, I tried so much I cannot really remember but you guys cleared up everything for me thanks!
[21:13:59] drale2k: has joined #RubyOnRails
[21:15:56] Megamos: has joined #RubyOnRails
[21:17:07] baweaver: has joined #RubyOnRails
[21:17:19] dkam_______: has joined #RubyOnRails
[21:17:50] momomomomo: has joined #RubyOnRails
[21:17:58] dopie: has joined #RubyOnRails
[21:19:06] sonofdirt: has joined #RubyOnRails
[21:20:07] mices: brycesenz: yes
[21:20:25] Grundell: has joined #RubyOnRails
[21:21:42] mary5030: has joined #RubyOnRails
[21:22:40] dkam_______: has joined #RubyOnRails
[21:23:55] Coldblackice: has joined #RubyOnRails
[21:24:52] brycesenz: mices - Ok, so you were able to assign 'school_id' through the initializer? Awesome.
[21:25:29] momomomomo_: has joined #RubyOnRails
[21:25:39] mices: brycesenz: yes
[21:26:17] brycesenz: mices - do you use pry? If so, can you break before you try to save the @team object in your create action? If not, can you do like a 'puts "#{@team.inspect}"' there, so that we can see the details of the object before you persist it but after you assign the attributes?
[21:26:22] xnp70: has joined #RubyOnRails
[21:27:21] flashpoint9: omfg i love rails
[21:27:41] Radar: we have so much in common
[21:28:01] dkam_______: has joined #RubyOnRails
[21:28:23] tfitts: flashpoint9: you coming from PHP or something?
[21:28:24] brycesenz: get a room you two
[21:28:28] roshanavand: has joined #RubyOnRails
[21:28:55] xnp70: I did PHP and I too love rails so much
[21:29:23] Radar: ok this is getting weird bue
[21:29:33] xdccMule[5720KI]: has joined #RubyOnRails
[21:30:02] xnp70: my dilema: buy RIA4 or wait for a Rails v5 offering ?
[21:30:20] Sawbones: has joined #RubyOnRails
[21:30:22] brycesenz: mices - any update?
[21:30:30] tubbo: xnp70: the syntax won't be different enough for it to matter IIRC
[21:30:33] Grundell: has joined #RubyOnRails
[21:31:10] Dbugger: has joined #RubyOnRails
[21:31:14] Dbugger: Hello everyone
[21:31:56] Dbugger: I was looking at this question, which is what I want to do exactly, and I am curious... how exactly is @selected_day built, from a string like "2016-10-10" ?
[21:32:41] sonofdirt: has joined #RubyOnRails
[21:33:05] edwinvdgraaf: has joined #RubyOnRails
[21:33:30] mices: brycesenz: puts "#{team.inspect}" had no effect
[21:33:34] brycesenz: dbugger - what is the context of your question?
[21:34:02] brycesenz: mices - it should have output the details of @team to your "rails s" console
[21:34:12] brycesenz: mices - can you see that output in the request?
[21:34:19] mices: lemme try again wait
[21:34:38] Dbugger: brycesenz, no matter. I was wondering if I had to parse somehow the string, but apparently I just found out that I can use the string directly :)
[21:35:01] xdccMule[5720KI]: i'm having issue with a static select in form, i use this code: <%= f.select :tipo, [['sms', 'sms'], ['email', 'email']] %> , looking in the page html it's ok, i can see the select tab with option but it is not rendered in web page with other fields
[21:35:35] baweaver: has joined #RubyOnRails
[21:35:35] j_mcnally: has joined #RubyOnRails
[21:35:51] Radar: xnp70: There won't be a Rails 5 in Action.
[21:36:03] roshanavand: has joined #RubyOnRails
[21:36:13] xdccMule[5720KI]: * i just can see the select tag in html code but it is not show in browser
[21:36:15] mices: brycesenz: two nils
[21:36:18] Radar: xnp70: Source: I am one of the authors
[21:36:35] mices: brycesenz: if i type the puts command in the console
[21:36:38] cnk: xdccMule[5720KI]: so you see it in page source but not visible?
[21:37:00] xdccMule[5720KI]: only in page source (html in chrome)
[21:37:01] Radar: xnp70: There's nothing exceptionally special about Rails 5. You could read Rails 4 in Action and develop in Rails 5 just fine.
[21:37:04] cnk: Can you use your browser's debugger to see if somehow it has a style with visibility none
[21:37:12] Radar: (no, ActionCable is not "special")
[21:37:23] brycesenz: mices - what do you mean "two nils"?
[21:37:32] xdccMule[5720KI]: yes.... no debug problems, i removed all styles, no materialize.... nothing
[21:38:42] IFrank00: has joined #RubyOnRails
[21:38:55] cnk: If you see it in the page source in your browser, it has to be CSS or that it is somehow in an html comment
[21:39:48] cnk: Yes though I doubt I have any more guesses
[21:40:06] xdccMule[5720KI]: this is a pastebin
[21:40:12] xdccMule[5720KI]: there are some style
[21:40:20] xdccMule[5720KI]: but also without there aren't
[21:40:27] xdccMule[5720KI]: http://pastebin.com/pJ0X4pEG
[21:41:04] xdccMule[5720KI]: ok i use pastie :D
[21:41:08] mices: brycesenz: nil => nil ( on 2 indented lines)
[21:41:20] brycesenz: mices - can you show me the output of the inspect statement after the params have been assigned?
[21:41:43] pydave6367: has joined #RubyOnRails
[21:42:05] brycesenz: mices - so like, you build a Team object, named @team, in your create action. I want to see an inspection of that object before you save it.
[21:42:13] xdccMule[5720KI]: http://pastie.org/10676820
[21:42:36] mices: brycesenz: that's where it is, between the assigment and save
[21:42:39] xdccMule[5720KI]: this is the form
[21:43:08] mag42c: has joined #RubyOnRails
[21:43:50] brycesenz: mices - ok, and what's the output of "@team.inspect"?
[21:44:14] baweaver: has joined #RubyOnRails
[21:44:24] northfurr: has joined #RubyOnRails
[21:44:27] mices: brycesenz: nil
[21:45:19] mices: brycesenz: put it after respond_to ?
[21:45:25] brycesenz: mices - @team is not nil. It can't be. If it were nil, when you called "save" on it, you would get an error
[21:45:54] fox_mulder_cp: has joined #RubyOnRails
[21:46:25] fox_mulder_cp: xnp70: r5 as for me - r5 intrests in websockets aka Cable
[21:46:47] mordof_work: has joined #RubyOnRails
[21:47:07] brycesenz: mices - I commented on your gist. Can you look at the and replace your create action with the debug one I've suggested?
[21:47:25] brycesenz: mices - then start your local Rails server, try that action, and look at the console to see the output of that inspection
[21:48:11] fox_mulder_cp: but default example chat for me - ok, but not ok for a ... as example twiiter-style app for learning it (
[21:48:20] edwinvdgraaf: has joined #RubyOnRails
[21:48:39] brycesenz: mices - also, remove ":school_id" from the list of permitted params under "team_params"
[21:49:47] roshanavand: has joined #RubyOnRails
[21:50:22] mices: brycesenz: ok i did all that but i get an error from active::record so i'm not gonna see the output of puts
[21:50:27] manfrin_: has joined #RubyOnRails
[21:50:52] Jasaka: has joined #RubyOnRails
[21:50:55] brycesenz: mices - ok, cool. what was the error?
[21:50:59] emilkarl: has joined #RubyOnRails
[21:51:17] mices: Mysql2::Error: Field 'school_id' doesn't have a default value
[21:51:38] stannard: has joined #RubyOnRails
[21:51:38] cschneid: has joined #RubyOnRails
[21:51:38] eggoez: has joined #RubyOnRails
[21:51:38] constantinexvi_: has joined #RubyOnRails
[21:51:38] borkdude: has joined #RubyOnRails
[21:51:38] phon: has joined #RubyOnRails
[21:51:38] wkoszek: has joined #RubyOnRails
[21:51:38] insu: has joined #RubyOnRails
[21:51:38] craysiii: has joined #RubyOnRails
[21:51:38] mduca: has joined #RubyOnRails
[21:51:38] webdestroya: has joined #RubyOnRails
[21:51:38] Dfoolz: has joined #RubyOnRails
[21:51:40] edwinvdgraaf: has joined #RubyOnRails
[21:51:48] martinbjeldbak: has joined #RubyOnRails
[21:51:54] brycesenz: mices, ok, so we know that school_id is not being set. What was the output of the "puts" statement?
[21:51:59] constantinexvi: has joined #RubyOnRails
[21:52:05] cschneid: has joined #RubyOnRails
[21:52:15] Aherin: has joined #RubyOnRails
[21:52:22] northfurr: anyone familiar with the error ???does not implement??? when trying to create a test double??? i.e articles = double(all_published)?
[21:52:33] DEA7TH: Something which comes up a lot in my code: views get an object for an ActiveRecord class and they do something like this: <%= @trip_item.address.customer.nickname %>. Is that ok? It's also very heterogeneous and can't be solved by e.g. adding a def customer_nickname on trip_item - each case is somewhat unique.
[21:53:14] eggoez: has joined #RubyOnRails
[21:53:41] mices: brycesenz: i have the request parameters on the same page below the error no mention of school_id, all form fields and values are present
[21:53:45] mordof_work: has joined #RubyOnRails
[21:54:13] fox_mulder_cp: DEA7TH: no external work. @trip_item.address.customer.nickname - normal, as for me
[21:54:13] mices: brycesenz: no output from puts where should i look for it
[21:54:20] brycesenz: mices - can you update your gist with those parameters that came through in the request?
[21:54:51] tubbo: DEA7TH: that's ok to a point, it's breaching on the "law of demeter".
[21:54:56] mices: brycesenz: refresh
[21:55:03] futilegames: has joined #RubyOnRails
[21:55:16] tubbo: which isn't a real "law", it's just a guideline/code smell you should be aware of
[21:55:27] mordof_work: has joined #RubyOnRails
[21:55:50] fox_mulder_cp: DEA7TH: @payment.payment_line.summ, @client.customer.subscription.web.limit .. readable...
[21:56:01] rhizome: DEA7TH: if that bugs you, it looks mostly your datamodel. why are those things so far away?
[21:56:04] fox_mulder_cp: client = reseller
[21:56:08] nomadicoder: has joined #RubyOnRails
[21:56:21] DEA7TH: tubbo: I know, but I have some disagreements with that law. It would lead me to declare lots classes which are used only once; also Clojure works fine without it (am I allowed to make use of that fact when dealing with an OO language and framework?).
[21:56:29] rhizome: why associate to address and then customer beyond that?
[21:56:43] sonofdirt: has joined #RubyOnRails
[21:56:46] brycesenz: mices - try specifying the url in your form. The URL for the create action needs to be like "user_profile_school_teams_path(current_user.id, current_user.profile.id, @school.id)"
[21:56:49] DEA7TH: rhizome: It doesn't bug me, I'm ok with it but I just don't know whether it would work fine.
[21:57:04] DEA7TH: right, seems like I'll keep it.
[21:57:10] tubbo: DEA7TH: i have no idea how Clojure is at all relevant in this discussion...but i put "law" in quotes for a reason :) that's literally what it's called, the law of demeter, but it's not really a law. it's a guideline, disregard it if you wish.
[21:57:11] rhizome: it has three points of failure
[21:57:15] tubbo: but yeah what rhizome said
[21:57:27] brycesenz: mices - I believe that's why the IDs aren't coming over. It's just POSTing the request to "team_path"
[21:57:28] brunto: has joined #RubyOnRails
[21:57:32] fox_mulder_cp: DEA7TH: don't worry. it your test and visual page seem ok - it works
[21:57:40] tubbo: the point we're all trying to make is that any code is better when you can reduce the points of failure or at the very least write tests to ensure that kind of thing can never happen...
[21:58:21] rhizome: you might be interested in presenters, which I'd assume were already mentioned
[21:58:30] Megamos: has joined #RubyOnRails
[21:59:21] brycesenz: DEA7TH - why couldn't you just add a method to TripItem called "address_customer_nickname" that handles that logic? That's how I solve many of my "Law of Demeter" problems. It makes testing and debugging much easier
[21:59:45] futilegames_: has joined #RubyOnRails
[22:00:19] tubbo: brycesenz: but that's a useless method that really has no functional merit
[22:00:24] DEA7TH: And a second question: do I gain anything by moving trivial accessors from views to controllers? Like this: view code will change from `@customer.nickname` to `@nickname`, controller will get a few extra lines and won't expose the @customer object. This really nicely declares the dependencies explicitly, but do I ever need that? I feel like I don't need that much flexibility for usual templates.
[22:00:30] tubbo: it just gives you a "good grade" on a law that doesn't even really exist
[22:00:52] tubbo: it really depends on where Customer comes from, and how your data is designe
[22:00:52] mices: brycesenz: i don't know what you mean but how do i pass the "url" to form_for(@team)
[22:00:53] tubbo: designed*
[22:01:02] DEA7TH: brycesenz: That adds a little bit of extra code (and complexity), but I don't see practical benefits.
[22:01:17] fox_mulder_cp: DEA7TH: you now learn rails?
[22:01:20] tubbo: like if there's a potential address.customer might be nil, then yeah you need some way of handling that because you don't want a NoMethodError to get thrown
[22:01:22] safety_cut: has joined #RubyOnRails
[22:01:26] sarink: has joined #RubyOnRails
[22:01:42] DEA7TH: fox_mulder_cp: long time ago and have an already working application, but I like to improve code quality
[22:01:47] xnp70: Radar: you just sold another copy
[22:01:56] tubbo: but if (and i'm assuming here) Customer has_one Address, and then it also has a nickname property, we can be pretty damn confident that if we have an Address, it's *probably* related to a Customer.
[22:02:07] tubbo: because a Customer has an Address, right? an Address doesn't have a Customer...
[22:02:20] shibabu: has joined #RubyOnRails
[22:02:34] fox_mulder_cp: DEA7TH: you can reread rails in action 4, agile web demelopment with r4, or default guides blogapp )
[22:02:41] threeminutemonta: has joined #RubyOnRails
[22:02:48] Radar: xnp70: Yaaaayyy :D
[22:02:52] Radar: xnp70: Another $4 for me
[22:02:56] Radar: I'm rich!
[22:03:08] DEA7TH: (2 years are long time for me anyway :D)
[22:03:13] fox_mulder_cp: Radar: may i send for u 4$ too?)
[22:03:19] Radar: fox_mulder_cp: yup
[22:03:44] brycesenz: mices - =form_for(@team, url: user_profile_school_teams_path(current_user.id, current_user.profile.id, @school.id))
[22:04:52] brycesenz: tubbo - but the method does have functional merit. Conceptually, it hold's the logic of a customer's nickname for a particular TripItem. It may just be a simple delegation now, but as that concept evolves, it gives a central place for understanding that property of TripItem
[22:05:18] fox_mulder_cp: Radar: and you send me your personally signed PDF?%)
[22:05:28] srinidhi: has joined #RubyOnRails
[22:05:29] tubbo: brycesenz: why does TripItem need to know about a Customer's nickname? talk about coupling...
[22:05:39] Radar: fox_mulder_cp: I can sign the PDF if you send it to me
[22:05:39] brycesenz: tubbo - that's assuming that the property is a logical one for a TripItem to have, which I'm not sure about
[22:06:02] fox_mulder_cp: Radar: mwahaha )
[22:06:13] brycesenz: tubbo - haha, yeah, that's a different question though. I'm presupposing that it's a valid property, in which case, I'd prefer to have a method that does little vs. drilling down through three other objects
[22:06:15] Radar: fox_mulder_cp: me@ryanbigg.com
[22:06:45] mordof_work: has joined #RubyOnRails
[22:06:46] fox_mulder_cp: Radar: i think, that scanned book - is piracy way )
[22:07:05] mices: brycesenz:
[22:07:05] mices: NoMethodError in Teams#new
[22:07:25] xnp70: fox_mulder_cp: cc me on that email
[22:07:38] tubbo: brycesenz: it's not a different question, it's a choice you make when you define a method on TripItem that has nothing to do with TripItem.
[22:07:57] brycesenz: mices - can you run "rake routes" and show me the output?
[22:08:01] tubbo: brycesenz: it all depends on what "drilling down" actually means here.
[22:08:12] Grundell: has joined #RubyOnRails
[22:08:23] fox_mulder_cp: xnp70: mwahahaha twice
[22:08:28] tubbo: if you can be sure that without intervention, those methods are *always* going to return the objects you want, then adding a special method just to figure that shit out is pointless.
[22:08:30] yardenbar: has joined #RubyOnRails
[22:09:04] tubbo: basically if your method isn't doing *something* to return a different value when any one of those things are nil, it's not necessary IMHO.
[22:09:51] brycesenz: tubbo - handling nil cases is typically a big part of those little helper functions though. Certainly it would have to be in this case, in the event that address was nil
[22:09:52] tubbo: example -> https://gist.github.com/tubbo/ee3fa2ce7cb2af7b3915
[22:10:04] tubbo: brycesenz: but "law of demeter" doesn't specify that, does it :)
[22:10:08] tubbo: that's why it's incomplete,
[22:10:17] tubbo: and why i say it's a guideline
[22:11:23] brycesenz: tubbo - I apologize if it seemed like I was arguing something I wasn't. He simply said "Something which comes up a lot in my code: views get an object for an ActiveRecord class and they do something like this: <%= @trip_item.address.customer.nickname %>. Is that ok?"
[22:11:41] brycesenz: And my answer still is "it's not ideal, I'd rather have a separate method"
[22:11:50] tubbo: brycesenz: oh no not at all, i think we're closer to agreement :)
[22:11:53] brycesenz: in large part to handle nil cases and errors
[22:12:22] brycesenz: mices - any luck with "rake routes"?
[22:13:15] brycesenz: tubbo - yeah, what you said makes sense. I think we were just speaking past each other. You're right that "Law of Demeter" alone isn't reason to change things, but your nil example illustrates why it can be an important consideration
[22:15:22] shibabu: has joined #RubyOnRails
[22:17:40] fox_mulder_cp: oh. on my usd card only two dollars. kekeke.
[22:18:07] fox_mulder_cp: must enlarge balance
[22:18:56] AntiSpamMeta: has joined #RubyOnRails
[22:20:29] clamstar: has joined #RubyOnRails
[22:21:18] AntiSpamMeta: has joined #RubyOnRails
[22:23:09] brycesenz: mices - any update?
[22:24:52] creyes: has joined #RubyOnRails
[22:26:50] creyes: I'm building an app that needs to assign a user a number of forms to fill out every week, and then track the progress of the completion of those forms. My idea is to create a "packet" that has_many "forms" - then every week make a new packet that generates X blank forms for the user and then measure their completion. I'm looking for "on monday user.packet.build"
[22:27:04] creyes: What's the best way to achieve that
[22:27:04] mices: brycesenz: refresh
[22:28:11] zpe: has joined #RubyOnRails
[22:28:18] brycesenz: mices - I hit refresh. And I'm looking at your form, and I don't see the URL specified, nor do I see any output from "rake routes"...
[22:28:29] rhizome: creyes: you'll want to familiarize yourself with workflows, state machines, and something for the collection, which I'd use a nested set for but you might need associations
[22:28:35] rhizome: depending on what you mean by "track"
[22:28:57] centrx: has joined #RubyOnRails
[22:28:58] creyes: rhizome: I actually have most of the app built, I need scheduling done
[22:29:09] Scripore: has joined #RubyOnRails
[22:29:20] creyes: rhizome: form completion I'm just checking the entry string is blank or not
[22:29:38] mices: brycesenz: refresh
[22:29:49] rhizome: creyes: not sure what you're asking then
[22:30:22] creyes: rhizome: I have a function that will build 4 blank forms for a user. I need a way to make that run every week
[22:31:13] mices: brycesenz: refresh sorry
[22:31:13] brycesenz: mices - Ok, so you want your form to submit to the URL "user_profile_school_teams(user, profile, school)", right?
[22:32:17] brycesenz: mices - Ok, so one problem is that your ":new" view is trying to access a @school variable, but you never set that in the "new" action.
[22:32:40] brycesenz: mices - so add "@school = School.find(params[:school_id]" to that action
[22:32:58] brycesenz: oops, make sure to close those parantheses
[22:33:14] antgel: has joined #RubyOnRails
[22:36:19] mdw: has joined #RubyOnRails
[22:36:23] nerfando: has joined #RubyOnRails
[22:36:52] momomomomo: has joined #RubyOnRails
[22:37:28] nerfando: has joined #RubyOnRails
[22:37:44] baweaver: has joined #RubyOnRails
[22:40:02] brycesenz: mices - I have to roll out man. Your code is almost there though, I can feel it
[22:41:10] mices: lol wait i did the editing let me try
[22:41:12] mary5030: has joined #RubyOnRails
[22:41:38] dkam_______: has joined #RubyOnRails
[22:41:41] mary5030_: has joined #RubyOnRails
[22:43:09] mices: brycesenz: ok it's working now thanks
[22:44:11] Guest24140: has joined #RubyOnRails
[22:44:29] rodfersou: has joined #RubyOnRails
[22:44:47] drale2k: has joined #RubyOnRails
[22:46:05] fox_mulder_cp: creyes: form completion -> js
[22:46:14] rjs90: has joined #RubyOnRails
[22:46:51] a1fa: has joined #RubyOnRails
[22:47:40] fox_mulder_cp: creyes: when you moved from field to another, ru simple js, which if $('fieldname').length = 0 then $(add failutre text to some dom element)...
[22:47:54] creyes: fox_mulder_cp: Usually yea but I want them to be able to submit forms with blank fields. They have a week to complete it, so then I just count the fields, count how many are empty and return a % in the dashboard. The form validation part is not my concern
[22:48:03] creyes: fox_mulder_cp: its a scheduler to build blank forms weekly
[22:48:08] a1fa: ugh,... cancancan, i'm having some issues with ability, ie: searching for specific model. if i do can :manage, Model it works, but if i do can :read, Model, it breaks the search
[22:48:11] fox_mulder_cp: creyes: it rails this called validations
[22:48:39] a1fa: or if i do can :read, :all
[22:48:59] maximumgeek: has joined #RubyOnRails
[22:49:04] fox_mulder_cp: a1fa: oh. when i quested - have a some recommendations to Devise..
[22:49:25] fox_mulder_cp: so i try and use it (
[22:49:37] iamse7en: has joined #RubyOnRails
[22:49:40] dkam_______: has joined #RubyOnRails
[22:50:52] Grundell: has joined #RubyOnRails
[22:51:28] nfk|laptop: has joined #RubyOnRails
[22:51:40] fox_mulder_cp: creyes: i can't knows this own-bike-styled idea ((
[22:51:52] wethu: has joined #RubyOnRails
[22:52:03] a1fa: i dont even know where to start troubleshooting this
[22:52:07] a1fa: it sounds like a gem bug
[22:52:28] rjs90: has left #RubyOnRails: ()
[22:53:17] fox_mulder_cp: a1fa: can you switch to devise? it seems simple, quick and easy in use..
[22:53:42] fox_mulder_cp: a1fa: or paste your code and exeprtions log to gist
[22:53:46] rjs90: has joined #RubyOnRails
[22:54:25] fox_mulder_cp: creyes: what data, what forms, what source of this nullable fields
[22:54:29] a1fa: i'm using devise and cancancan
[22:55:04] paradisaeidae: has joined #RubyOnRails
[22:55:26] fox_mulder_cp: cancancan i't not login/register....
[22:55:45] fox_mulder_cp: my idiotic mistakes make me idior
[22:55:48] DonOtreply: has joined #RubyOnRails
[22:56:04] fox_mulder_cp: i think about pundit, but entered devise ((
[22:56:07] rodfersou: has joined #RubyOnRails
[22:56:23] a1fa: skip_authorize_resource :only => :show
[22:56:28] a1fa: skip_authorize_resource :only => :search
[22:56:32] a1fa: going to add that to my code
[22:56:39] a1fa: i think this is a bug
[22:57:19] a1fa: because can :manage, Model works, but can :read, Model doesnt
[22:57:31] a1fa: according to source code "search" falls under "read"
[22:58:17] a1fa: read == show, index, search
[22:58:29] a1fa: https://github.com/CanCanCommunity/cancancan/wiki/Abilities-in-Database
[22:58:35] a1fa: when "index", "show", "search"
[22:58:35] a1fa: cancan_action = "read"
[22:59:58] rjs90: has left #RubyOnRails: ()
[23:00:19] Grundell: has joined #RubyOnRails
[23:00:36] a1fa: ok this is cute
[23:00:43] a1fa: i added can :search, :all
[23:00:48] a1fa: and that worked -_-
[23:01:19] quazimod1: has joined #RubyOnRails
[23:02:12] lastk: has joined #RubyOnRails
[23:03:14] Grundell: has joined #RubyOnRails
[23:05:32] guacamole: has joined #RubyOnRails
[23:06:27] _3dwardsharp: has joined #RubyOnRails
[23:08:10] guacamole: has joined #RubyOnRails
[23:10:30] Sirithcam: has joined #RubyOnRails
[23:14:54] edwinvdgraaf: has joined #RubyOnRails
[23:15:15] mary5030: has joined #RubyOnRails
[23:15:29] d0nn1e: has joined #RubyOnRails
[23:19:41] pyemkey: has joined #RubyOnRails
[23:19:42] neanderslob: has joined #RubyOnRails
[23:21:37] mices: foreign keys don't have to be included in the whitelist if they're just id's ?
[23:25:20] yfeldblum: has joined #RubyOnRails
[23:30:18] DonOtreply: has joined #RubyOnRails
[23:31:39] DEA7TH: After a few gem updates, Time is suddenly no longer printed as hh:mm, but instead as 2000-01-01 hh:mm:00 UTC. What went wrong?
[23:32:09] DEA7TH: My code is: <%= f.input :time_ironed, as: :string, label: 'Time ironed (hours:minutes)', required: true %>
[23:33:06] roshanavand: has joined #RubyOnRails
[23:34:43] Coldblackice_: has joined #RubyOnRails
[23:36:30] fox_mulder_cp: DEA7TH: Time.now.strftime('%T')
[23:37:29] fox_mulder_cp: DEA7TH: and remind to set properly utc zone in application config
[23:38:05] DEA7TH: fox_mulder_cp: timezone is irrelevant, I don't know why Time has it, but it's Time in the sense of duration.
[23:38:08] baweaver: has joined #RubyOnRails
[23:38:25] M-shine: has joined #RubyOnRails
[23:40:24] neanderslob_: has joined #RubyOnRails
[23:40:56] fox_mulder_cp: DEA7TH: http://api.rubyonrails.org/classes/ActiveSupport/Duration.html
[23:41:07] smathy: DEA7TH, so what's it stored as in the DB?
[23:41:47] luther07: has left #RubyOnRails: ()
[23:42:09] DEA7TH: smathy: create_table :ironings { |t| t.time :time_ironed [...] }
[23:42:40] DEA7TH: adding input_html: {value: ... } solved my problem, but it's weird that it appeared.
[23:43:14] fox_mulder_cp: DEA7TH: see a rails g model help
[23:43:15] Scripore: has joined #RubyOnRails
[23:43:18] lastk: has joined #RubyOnRails
[23:43:24] fox_mulder_cp: for supported datatypes
[23:48:01] Kneecaps: has joined #RubyOnRails
[23:48:07] SteenJobs: has joined #RubyOnRails
[23:48:15] pvertenten: has joined #RubyOnRails
[23:48:31] shibabu: has joined #RubyOnRails
[23:48:44] guacamole: has joined #RubyOnRails
[23:51:19] guacamole: has joined #RubyOnRails
[23:53:34] SteenJobs: has joined #RubyOnRails
[23:55:20] stannard: has joined #RubyOnRails
[23:57:47] guacamole: has joined #RubyOnRails
[23:58:11] cassioscabral: has joined #RubyOnRails
[23:58:40] d5sx43: has joined #RubyOnRails