#RubyOnRails - 16 October 2017
« Back 1 day Forward 1 day »
[08:09:53] timdotrb: I’ve setup a has_many through association, but I can’t remember if I need to explicitly create each of the associations after selecting them in my form? I’m getting the IDs in my controller, and have allowed them as params, but they’re not auto saving
[09:02:01] timdotrb: dminuoso: https://gist.github.com/willc0de4food/88413f56069022308d0d7342b0aaa09e
[09:04:36] dminuoso: timdotrb: Curious why you are not getting a warning for un-permitted security_ids.
[09:07:17] timdotrb: dminuoso: renaming the permitted param correctly didn’t resolve the issue. Could the null value at the beginning of the array be the problem?
[09:16:03] tomoyuki28jp: I use rails 5.1.4. How can I get rid of this warning? `ERROR -- : Couldn't cleanly terminate all actors in 10 seconds!`
[09:17:41] matthewd: tomoyuki28jp: Step one will be to work out where the message is coming from, because that's not Rails.
[09:19:58] matthewd: tomoyuki28jp: It's probably coming from a gem you've added to your application, but it's not coming from Rails itself
[09:20:35] tomoyuki28jp: matthewd: Oh, really. Is there a easy way to figure out where the error come from?
[09:25:10] dminuoso: timdotrb: You are using a stand-allone "collection_select", rather than f.collection_select.
[09:25:35] timdotrb: dminuoso: figured it out. changed the permitted params from :security_ids to security_ids: 
[09:27:04] dminuoso: https://gist.github.com/willc0de4food/88413f56069022308d0d7342b0aaa09e#file-portfolios_controller-rb-L3
[09:28:07] timdotrb: dminuoso: the sanitize? I just added that to get rid of the null value from the array
[09:28:29] dminuoso: timdotrb: I recommend not mutating things like that in filters (it makes it super hard to reason about data). It's generally easier to just provide a lens that does the filtering.
[11:27:52] worknick: how scalable / recommended is this type of if condition on application layout? https://stackoverflow.com/questions/22646048/rails-render-a-different-header-just-on-homepage
[12:06:15] xco: hi. if i have a route like this admin_user GET /admin/users/:id(.:format) admin/users#show
[13:38:45] Kilo`byte: question regarding actioncable: how can i broadcast a message to all subscribers of a certain channel? ActionCable.server.broadcast('channel', foo: 'bar') does not seem to work (no target clients)
[14:54:57] daveomcd: I'm using Action Cable to render a partial, but it's being called twice from one call. I'm guessing this is due to turbolinks? Is there a way I can eliminate the second call from turbolinks? https://gist.github.com/daveomcd/bd221c5270ce4f075bf861ba0eba71c3
[15:03:18] solars: hi, when doing a PG raw query: ActiveRecord::Base.connection.execute("select booking_count from statistics").first I keep getting a hash with integer db fields as strings - how can I get the right types?
[19:11:48] wnel: Im pretty new to rails (couple months experience now) and I am having a really hard time getting some logic around my head using has_many through and accepts_nested_attributes_for. Everything seems to be working in my rails console but for whatever reason im confusing myself when it comes to writing the values from my view. I would really appreciate some guru help me out with this. It has honestly been days and I have confused mysel
[19:14:43] wnel: I did try and ask for some guidence on stackoverflow but never recieved any replies.
[19:18:56] FrostCandy: In my rake routes I get paths like controller/:id/method(.:format) what is the .:format? In my urls it's just controller/10/method no format ?
[20:02:42] wnel: I just wanted to share my stackoverflow link with you guys incase someone has the time to give me some guidence how to approach my issue: https://stackoverflow.com/questions/46752360/assigning-additional-values-with-has-many-through Thanks
[22:05:42] lupine: Never done it in ruby. I go, I just stand up a server or client and send messages through it
[22:18:24] lupine: https://medium.com/@tomekw/unit-testing-actioncable-channels-with-rspec-ca67ca6834af
[23:23:23] wnel: Using has_many through, I am able to assign values on the rails console, however I am having trouble replicating it for my UI. how can I have my view execute the logic I would in my rails console?
[23:24:38] wnel: i have created a stackoverflow post which outlines my whole problem im having. Ive been working whole days on trying to solve this one issue. Any advice would be very VERY much appreciated. thanks https://stackoverflow.com/questions/46752360/assigning-additional-values-with-has-many-through
[23:27:51] lupine: Accepts_nested_attributes_for in the model. Fields_for in the view and don't forget hidden_field :id
[23:29:37] wnel: hidden_field! I havent tried anything with hidden_field. I will have a look into that. Thank you
[23:33:20] wnel: so accept_nested_attributes :results in my appointment model and look into using hidden_field for the question_id in my view?
[23:42:24] wnel: would i need to nest 2 fields_for? or does the hidden_field take care of that for me?