#RubyOnRails - 20 September 2017
« Back 1 day Forward 1 day »
[00:29:33] mars777: I need to have 7 forms on the same model load in one view and save each form in database on new row. and also be able to insert and update on same view. Can that be achieved via nested forms? Any web articles would help?
[01:39:32] tcopeland: mars777: FWIW sounds like a good case for a form object https://ducktypelabs.com/how-to-keep-your-controllers-thin-with-form-objects/
[03:11:47] matthewd: andrewray: In what way are you finding them to be non-deterministic? Ordering? :/
[03:12:57] andrewray: No, I learned their horrible truth, that they're loaded on demand, meaning the order in which your files are called through your website can change your module and class namespacing non-deterministically through reopening modules and classes
[03:13:37] andrewray: I tried looping through all the autoload dirs and requiring the *.rb files in each dir, but that doesn't work
[03:14:37] andrewray: I think so but I don't think I found a good resource explanining it - rails eager loading searches seem to be about models, not this
[03:16:10] andrewray: I was trying to do eager loading with the above but wasn't sure how to duplicate autoload magic to make it work, probably the wrong path anyway
[03:52:54] xco: hi, i have ‘data’ variable here, which is a String but on clicking “delete” that param becomes a string string like “shoe/boots”. “shoe” and “boots” are in the data but i don’t know why 1. it’s turning it into a string 2. why it’s adding “/“ to the data. here’s a gist https://gist.github.com/xcobar/bf368b5cd38778744e625e7089979c73#file-params-rb-L2
[03:58:55] xco: ok. here’s the gist of log, we’re interested in the “id” key part https://gist.github.com/xcobar/bf368b5cd38778744e625e7089979c73#file-log-log-L15
[03:59:59] xco: i want the id to be like [“shoe”, “boots”] like it is when i do “data.inspect” in a <td> element
[04:00:52] fryguy: this won't work out how you want it to, but i'll humor you and help you do what you think you want
[04:03:08] fryguy: a call to `#to_param` happens for you because HTTP doesn't have the concept of a ruby array in a url parameter
[04:05:54] mars777: tcopeland thanks for the info I will try that, i was already using nested forms but maybe i can use form object in conjuction with it or maybe separately.
[04:08:01] elomatreb: You can submit an array in e.g. get params though, maybe you can use that without too much work
[04:09:14] xco: fryguy: i can’t start over, i’ll end up in the same place, with the knowledge i have
[04:09:27] elomatreb: The part after ? in URLs are sometimes called GET params, and they can represent arrays
[04:10:23] elomatreb: I.e. ?something=1&something=2 would result in an array parameter called "something", with the values 1 and 2
[04:11:53] elomatreb: Yes, but it being part of the URL means it works (in theory) with any request method
[06:42:37] pavelz: anyone knows of a good rails/ruby traceer? I need to trace calls see where project I got gets stuck
[08:46:16] dupondje: Hi All. Got some small question. I'm migrating some prehistoric rails app. Which is started via a dispatch.fcgi file. Now I want to change it to the 'correct' way via a config.ru, but then I get 'undefined method `application' for Rails:Module (NoMethodError)'
[08:46:22] dupondje: The config.ru contains: require ::File.expand_path('../config/environment', __FILE__)
[08:47:15] matthewd: dupondje: Have you just grabbed a more recent config.ru and dropped it into an ancient application? That's not likely to work.
[08:49:08] dupondje: matthewd: well i'm not an ruby expert :) But yes. Thing is we need to migrate an old RoR application to a new server. but its not going perfect ;)
[08:56:02] dupondje: matthewd: mmm ok. Just need to find out the way to use another ruby version in the dispatch.fcgi
[09:00:21] matthewd: dupondje: I should of course note that whatever version this is is waay out of support, and thus full of known security issues
[09:11:23] dupondje: matthewd: ofcourse ... they should fix their application, but thats to much work/cost ... :(
[11:54:43] lignux: Hi, is there any gem out there that i can use to implement infinite scrolling? I am pulling data from a third party api and i would like to make another request as soon as the user goes to the end of page
[12:00:02] lignux: I should note that i am not using a model besides users in my app and all of the tutorials i have found online have pagination that requires a model and not just api calls
[15:56:11] FrostCandy: Also, does thread 1 wait for thread 2 to complete before moving on in the code?
[15:57:12] FrostCandy: oh ok, but if i don't join them, then i can spin off another task in thread 2 to complete on its own time?
[16:09:54] FrostCandy: oh I see, if you don't join you run the risk of one thread beign killed regardless of it's state.
[16:40:36] maryo_: tHurst0n, i have installed fusioncharts gem and tried this example http://jsfiddle.net/fusioncharts/ZjyJT/ however it doesn't work for me.. The graph is not getting loaded.
[19:24:35] ivanskie_: a. How can I add a button on a view, that would execute a method in controller or what have you? without necessarily changing the view. so no redirect or anything. (I want to click a button on the view, and add an ActiveJob to a queue)
[19:25:21] ivanskie_: b. Can I somehow show progress of the activejob in view? at very least if the job is qeued/running/done?
[20:48:34] FrostCandy: Is .join the same as .joins ? Rails 4. I can't find reference to .join singular