« Back to channel list

#RubyOnRails - 19 March 2018

« Back 1 day Forward 1 day »
[00:01:14] cstls: has joined #RubyOnRails
[00:09:24] quazimodo: has joined #RubyOnRails
[00:19:42] darkhanb: has joined #RubyOnRails
[00:28:00] cstls: has joined #RubyOnRails
[00:31:39] gravity_pope: has joined #RubyOnRails
[00:42:06] cstls: has joined #RubyOnRails
[01:06:55] LambdaSource: has joined #RubyOnRails
[01:22:10] duderonomy: has joined #RubyOnRails
[01:25:08] cstls: has joined #RubyOnRails
[01:29:40] espressocannon: has joined #RubyOnRails
[01:30:20] espressocannon: can you use instance variables in loops?....
[01:30:21] espressocannon: https://gist.github.com/ELI7VH/35cc2e8e9ba93ef8df8701666035d86c
[01:31:32] espressocannon: I'm getting the strangest bug. I get a "SystemStackError (stack level too deep)" error when using instance variables for "response" I would like to use @response, to have an initialized response for my front-end, but I Get a stack error, meaning I have to write the same thing at the start of every action.
[01:32:52] espressocannon: when I remove the @ from in front of "response" (as seen in my gist) it works fine...
[01:38:36] drale2k_: has joined #RubyOnRails
[01:41:26] cstls: has joined #RubyOnRails
[01:47:30] ebsen: has joined #RubyOnRails
[01:51:13] workmad3: has joined #RubyOnRails
[01:52:05] unreal: has joined #RubyOnRails
[01:54:19] espressocannon: is @response reserved somehow
[01:55:47] alfiemax: has joined #RubyOnRails
[01:56:43] elomatreb: A system stack error means infinite recursion, that's probably more of a logic error you have somewhere
[02:00:52] espressocannon: i don't get how.. the only difference is that I used @response instead of response
[02:01:15] espressocannon: when I change it back - and that's all I do, it works perfectly
[02:02:39] espressocannon: lol.. fakkkkkkkkk
[02:02:57] espressocannon: nvm. I just said render json: response... and not render json: @response
[02:09:05] alfiemax: has joined #RubyOnRails
[02:20:10] LambdaSource: has joined #RubyOnRails
[02:24:44] kapil___: has joined #RubyOnRails
[02:25:42] alfiemax: has joined #RubyOnRails
[02:28:23] LambdaSource: has joined #RubyOnRails
[02:33:20] Radar: espressocannon: @response is probably a rails controller's response that it's going to send.
[02:33:33] Radar: https://gist.github.com/ELI7VH/35cc2e8e9ba93ef8df8701666035d86c#file-dashboard_controller-rb-L21-L23
[02:33:36] Radar: This is probably not a great idea.
[02:33:49] Radar: Call it osmething other than response, otherwise it will get confused with Rails' own `response` methods.
[02:36:37] espressocannon: what should I call it?
[02:36:45] espressocannon: I always have trouble coming upwith good names
[02:36:59] Radar: https://en.wikipedia.org/wiki/List_of_pirates
[02:37:03] Radar: Lots of good names here.
[02:39:08] duderonomy: has joined #RubyOnRails
[02:49:36] alfiemax: has joined #RubyOnRails
[03:01:17] espressocannon: ill remember this when my wife is doped up during birth
[03:02:28] espressocannon: also my sensei would slap my wrists if I named my response variable a pirate name
[03:04:57] Radar: so name it something that does not result in wrist slapping
[03:05:01] Radar: you're a smart person
[03:05:16] espressocannon: it's highly debated
[03:08:08] espressocannon: like. actual thanks for this list
[03:08:16] espressocannon: me and my wife are legit considering some of these
[03:14:57] sevenseacat: has joined #RubyOnRails
[03:26:36] orbyt_: has joined #RubyOnRails
[03:33:16] LambdaSource: has joined #RubyOnRails
[03:36:26] Saukk: has joined #RubyOnRails
[03:49:58] quazimodo: has joined #RubyOnRails
[03:51:28] workmad3: has joined #RubyOnRails
[03:52:01] KeyJoo: has joined #RubyOnRails
[03:52:57] LambdaSource: has joined #RubyOnRails
[03:59:32] Dimik: has joined #RubyOnRails
[04:06:29] gravity_pope: has joined #RubyOnRails
[04:25:14] trautwein: has joined #RubyOnRails
[04:28:54] jcarl43: has joined #RubyOnRails
[04:39:04] srinidhi: has joined #RubyOnRails
[04:43:14] srinidhi: has joined #RubyOnRails
[05:15:13] za1b1tsu: has joined #RubyOnRails
[05:15:36] duderonomy: has joined #RubyOnRails
[05:47:27] sidx64: has joined #RubyOnRails
[05:51:47] workmad3: has joined #RubyOnRails
[05:53:18] reber: has joined #RubyOnRails
[05:54:04] quazimodo: has joined #RubyOnRails
[05:58:03] duderonomy: has joined #RubyOnRails
[06:38:53] sidx64_: has joined #RubyOnRails
[06:44:12] sidx64: has joined #RubyOnRails
[06:51:05] morfin60: has joined #RubyOnRails
[06:51:39] morfin60: is there good solutions to bulk upload file(just email per line) with validations etc?
[06:52:45] morfin60: 1. I need valid emails only. 2. I need unique emails list(so i have uniqueness validation). 3. Better if it would bulk upload instead of saving every contact separately
[06:53:23] sevenseacat: I think you need to unpack that a little bit
[06:54:21] morfin60: well, i have txt file where every line have one email and i need to upload this list into database with validations etc.
[06:54:48] sevenseacat: save the file into the db? or create records based on the data in the file?
[07:00:12] morfin60: create records
[07:00:30] morfin60: as i said i have validation of email + validation of uniqueness
[07:00:30] shpoont: has joined #RubyOnRails
[07:04:04] dminuoso: Oh yes. Side effects in validations are perfectly fine - I mean you really do want .valid? to call .launchMissiles() right?
[07:04:28] za1b1tsu: has joined #RubyOnRails
[07:04:52] dminuoso: I mean the phrasing of your whole statement is rather unclear.
[07:05:14] apeiros: has joined #RubyOnRails
[07:06:14] za1b1tsu: So if I have this in my routes get '/ivr', to: 'twilio#ivr', as: 'user_trust_ivr', user_trust_ivr_path or _url should work no?
[07:06:38] syndikate: Upload the file, save it, run a job to parse it line by line in async, profit?
[07:07:10] syndikate: Radar, I did see your solution, I will test It out and get back to you
[07:07:11] dminuoso: za1b1tsu: `rails routes` will tell you the names of the url/path helpers in the first column.
[07:07:26] dminuoso: (i.e. you could trivially verify this yourself)
[07:07:54] za1b1tsu: dminuoso, I know, but I though using "as:" should change the path/url and it does not
[07:08:23] dminuoso: za1b1tsu: So why dont you start with _that_. Gist your config/routes.rb, as well as the code that causes the problem.
[07:11:42] sidx64: has joined #RubyOnRails
[07:12:57] za1b1tsu: it's the company api dude :(, I have this in my routes: '/ivr', to: 'twilio#ivr', as: 'user_trust_ivr', this is routes output: init_trust_v3_channel_user POST /v3/channels/:channel_id/users/:id/init_trust(.:format) v3/users#init_trust, and Im simply going in the console and I type this: Rails.application.routes.url_helpers.user_trust_ivr_url
[07:13:36] sevenseacat: thats not the same route.
[07:13:48] sevenseacat: please gist your routes and output.
[07:14:17] za1b1tsu: "as:" should've changed the route, no?
[07:14:35] sevenseacat: again, its not the same route.
[07:14:57] sevenseacat: the routes output you posted is not for that line of code.
[07:16:15] za1b1tsu: v3_user_trust_user_trust_ivr GET /v3/user_trust/ivr(.:format) v3/user_trust/twilio#ivr
[07:16:22] za1b1tsu: oh you are right, my appologies
[07:16:38] za1b1tsu: so it automatically adds the namespaces to the route specified in as
[07:16:41] za1b1tsu: I understand
[07:18:54] sidx64: has joined #RubyOnRails
[07:23:56] sidx64: has joined #RubyOnRails
[07:26:00] sidx64: has joined #RubyOnRails
[07:28:32] sidx64: has joined #RubyOnRails
[07:31:17] conta: has joined #RubyOnRails
[07:41:11] schneider: has joined #RubyOnRails
[07:51:37] drale2k_: has joined #RubyOnRails
[07:52:06] workmad3: has joined #RubyOnRails
[08:00:20] srinidhi: has joined #RubyOnRails
[08:05:44] ryan_ford: has joined #RubyOnRails
[08:12:44] duderonomy: has joined #RubyOnRails
[08:19:40] ferr1: has joined #RubyOnRails
[08:19:45] DrYockel: has joined #RubyOnRails
[08:29:53] schneider: has joined #RubyOnRails
[08:33:58] sidx64: has joined #RubyOnRails
[08:34:55] defsdoor: has joined #RubyOnRails
[08:35:48] MrCrackPotBuilde: has joined #RubyOnRails
[08:40:43] schneider: has joined #RubyOnRails
[08:48:47] mtkd: has joined #RubyOnRails
[08:49:08] riotjones: has joined #RubyOnRails
[08:50:03] mikecmpbll: has joined #RubyOnRails
[09:19:11] za1b1tsu: has joined #RubyOnRails
[09:22:47] marr: has joined #RubyOnRails
[09:23:09] darthShadow: has joined #RubyOnRails
[09:23:15] darthShadow: has left #RubyOnRails: ()
[09:43:53] sidx64: has joined #RubyOnRails
[09:46:00] Fernando-Basso: has joined #RubyOnRails
[09:51:38] ss942: has joined #RubyOnRails
[09:52:20] workmad3: has joined #RubyOnRails
[09:53:01] ss942: Ok ladies and gentelmens. I had never wrote single line nor in ruby nor rails. But now is my time. I were Python/Django dev back days. (ok it was just intern) Now I have to write rest API for an open source project - ERPmine (redmine plugin)
[09:53:01] ss942: Right now it even have "some" API, but it makes only one feature from whole system usable from API. I have to contribute, and make more jsons that returns more data, and more actions possible.
[09:53:02] ss942: I'm wondering where the hell should I start with this? Any tips? Ruby in X minutes, Rails in X minutes, then Rails API, then reading ERPmine code and contributing to it?
[10:05:56] DrYockel: has joined #RubyOnRails
[10:11:29] rikkipitt: has joined #RubyOnRails
[10:12:14] workmad3: has joined #RubyOnRails
[10:12:32] srinidhi: has joined #RubyOnRails
[10:51:55] quazimodo: has joined #RubyOnRails
[10:52:37] ferr1: has left #RubyOnRails: ("WeeChat 2.0.1")
[10:53:56] mtkd: has joined #RubyOnRails
[10:54:03] DrYockel: has joined #RubyOnRails
[10:57:14] quazimodo: has joined #RubyOnRails
[11:03:27] apparition: has joined #RubyOnRails
[11:09:02] drale2k_: has joined #RubyOnRails
[11:11:13] cstls: has joined #RubyOnRails
[11:11:14] Ergo: has joined #RubyOnRails
[11:13:44] KeyJoo: has joined #RubyOnRails
[11:14:12] dminuoso: !books ss942
[11:14:12] helpa: https://www.leighhalliday.com/best-ruby-and-ruby-on-rails-resources
[11:18:22] srinidhi: has joined #RubyOnRails
[11:24:39] cschneid: has joined #RubyOnRails
[11:32:18] cstls: has joined #RubyOnRails
[11:36:02] Cavallari: has joined #RubyOnRails
[11:36:55] apeiros: has joined #RubyOnRails
[11:43:20] dionysus69: has joined #RubyOnRails
[11:52:19] dionysus69: has joined #RubyOnRails
[11:55:14] quazimodo: has joined #RubyOnRails
[12:01:08] tcopeland: has joined #RubyOnRails
[12:02:42] sameerynho: has joined #RubyOnRails
[12:04:02] antoine1: has joined #RubyOnRails
[12:06:25] fcser__: has left #RubyOnRails: ()
[12:12:38] sidx64: has joined #RubyOnRails
[12:19:58] ryan_ford: has joined #RubyOnRails
[12:25:34] sidx64: has joined #RubyOnRails
[12:35:35] ebsen: has joined #RubyOnRails
[12:39:34] za1b1tsu: has joined #RubyOnRails
[12:44:47] cstls: has joined #RubyOnRails
[12:47:48] p8m: has joined #RubyOnRails
[12:58:05] DrYockel: has joined #RubyOnRails
[13:00:24] fcser_: has joined #RubyOnRails
[13:02:53] am55: has joined #RubyOnRails
[13:14:53] sidx64: has joined #RubyOnRails
[13:19:21] sidx64: has joined #RubyOnRails
[13:22:54] tcopeland: has joined #RubyOnRails
[13:30:56] sidx64: has joined #RubyOnRails
[13:36:46] ghormoon: has joined #RubyOnRails
[13:45:15] sidx64: has joined #RubyOnRails
[13:46:06] am55: has joined #RubyOnRails
[13:55:07] boena: has joined #RubyOnRails
[13:57:25] ghormoon: has joined #RubyOnRails
[13:57:29] boena: I'm seeing a weird error using ´validates_acceptance_of :accepted_terms´. The validations works as expected but now I can't access the value anymore from ex. ´current_user.accepted_terms´ - it just says nil even though the User actually has accepted the terms. Anyone know what is causing this?
[13:57:59] sevenseacat: without seeing your code, no
[13:58:06] sevenseacat: can you gist your user model?
[13:59:26] allcentury: has joined #RubyOnRails
[14:02:57] boena: Well it's basically only that there and some other validations. I'm thinking if this might have something to do that we are using ActiveResource talking to the API - but can't find anyone else with the same problem. If I remove the validation of terms I can access the value correctly.
[14:18:50] gravity_pope: has joined #RubyOnRails
[14:21:24] tens0r: has joined #RubyOnRails
[14:23:12] Dimik: has joined #RubyOnRails
[14:25:02] boena: Could this be something? "If the database column does not exist, the terms_of_service attribute is entirely virtual."
[14:27:41] rikkipitt: has joined #RubyOnRails
[14:28:32] tcopeland: has joined #RubyOnRails
[14:31:07] ghormoon: has joined #RubyOnRails
[14:32:01] DrYockel: has joined #RubyOnRails
[14:34:47] drale2k_: has joined #RubyOnRails
[14:36:20] kn-928: has joined #RubyOnRails
[14:40:46] SteenJobs: has joined #RubyOnRails
[14:46:28] SteenJobs: has joined #RubyOnRails
[14:46:52] samort7: has joined #RubyOnRails
[14:47:23] samort7: I'm learning Ruby/Rails and am trying to get my head around active record before my supervisor kills me
[14:49:15] dminuoso: samort7: Are you looking for a lawyer to write your last will?
[14:49:29] dminuoso: We could help you with that.
[14:49:31] dminuoso: ACTION pokes havenwood
[14:49:47] samort7: dminuoso: haha something like that
[14:50:08] samort7: So if I have a line like :dog = "Fido"
[14:50:24] sevenseacat: thats a syntax error
[14:53:08] samort7: One sec. Trying to figure basic syntax out
[14:55:24] samort7: argh. I guess I"m not fully understanding the difference between a symbol and a variable
[14:56:20] sevenseacat: symbols can be thought of like strings. their name is their value. you can't assign something to a string.
[14:56:29] samort7: Ah, ok, that makes sense
[14:56:42] samort7: so I can do something like `puts :dog`
[14:56:56] samort7: Now, here's the bigger question
[14:57:20] samort7: client = Client.order(:first_name).first
[14:58:01] samort7: Is :first_name a symbol, or is it something special in activerecord?
[14:58:29] mtkd: has joined #RubyOnRails
[14:58:47] samort7: which is kinda like an immutable string
[14:58:59] sevenseacat: kind of. in this case, a string would also work.
[15:00:48] dminuoso: samort7: Keep in mind that this does not hold true in general. That is, not all methods that expect a string seamlessly also work with a symbol.
[15:01:02] samort7: understood
[15:01:14] MasterAsia: I need to create batches of cookies. A batch record will claim cookie records without a batch id - is just update cookies where batch_id=null etc atomic enough?
[15:01:32] MasterAsia: I wouldn't want to claim cookies that another batch just claimed
[15:01:43] samort7: Thank you for that. I've been learning Ruby/Rails for like 3 weeks and have been given the task of writing RSpec tests for our existing codebase. Was having trouble when I was trying to pass in variables to a .join query when they weren't variables but symbols :-(
[15:02:34] dminuoso: samort7: It's sometimes a bit confusing, but if you take the time to inspect the API documentation of methods before using them, you can generally find this out (and many other things).
[15:03:06] sevenseacat: that being said, trying to find where things are defined in rails can be a total crapshoot
[15:03:56] samort7: Yea, I seem to keep running into stuff where if you didn't know it worked that way, you would have a really hard time finding it out
[15:04:00] dminuoso: masterasia: What's the underlying database engine?
[15:04:08] rikkipit1: has joined #RubyOnRails
[15:04:09] MasterAsia: dminuoso, postgres
[15:04:26] MasterAsia: I don't think it will be an issue - low traffic app
[15:04:29] MasterAsia: batches are manual
[15:04:32] dminuoso: masterasia: Then you can simply do `Cookie.where(batch_id: nil).update(...)` - database transactions will guarantee atomicity.
[15:04:51] MasterAsia: Is that atomic?
[15:04:56] MasterAsia: that looks like a select and an update
[15:06:06] MasterAsia: Book.where('title LIKE ?', '%Rails%').order(:created_at).limit(5).update_all(author: 'David')
[15:06:06] MasterAsia: <-- wouldn't that be better? as it generates a single update query
[15:06:21] dminuoso: masterasia: Ah sorry. You might have to wrap it inside a #transaction block =)
[15:06:56] sevenseacat: that looks pretty similar except it uses update_all instead of update.
[15:07:28] sevenseacat: I don't think update would work on a relation anyhoo
[15:07:32] dminuoso: masterasia: Regardless I would simply specify an explicit transaction block. It certainly wont be harmful, and it will denote the intend clearly.
[15:27:39] thesubr00t: has joined #RubyOnRails
[15:31:06] thesubr00t: I'm trying to define a method inside a BaseSerializer class (parent class of other serializers) to transform all string attributes, but my implementation does not work. Please point me to the right direction. Here is a gist https://gist.github.com/anonymous/df62dbc0a30887eab5b59097297ea745
[15:31:42] sevenseacat: define 'does not work'
[15:33:24] thesubr00t: it does not seem to define the methods as I want, but when i replace object.attributes.symbolize_keys.each_key with a list of manually typed attributes and move it out of the "attributes" method it works
[15:34:20] apeiros: has joined #RubyOnRails
[15:34:24] mordof: has joined #RubyOnRails
[15:35:06] sevenseacat: ok, so are you calling this attributes method?
[15:36:45] thesubr00t: Sure, here is the other class https://gist.github.com/anonymous/7c4c024dcbe1b5567680f30f7af98d8e
[15:36:58] allcentury: which version of AMS?
[15:37:03] mordof: i've got nginx proxying to unicorn with rails. currently if a request takes too long, our nginx times out (we get a 404.. not sure if that's our config or default) - what is the expected behavior of unicorn/rails in that situation? our production logs just stop after that (for that request). is that what we should be seeing?
[15:37:46] allcentury: mordof: Unicorn has it’s own default timeout, i can’t remember if it’s 30 or 60 seconds
[15:37:51] thesubr00t: sevenseacat, allcentury AMS v 0.10.6
[15:38:06] mordof: allcentury: looks like our config is set to 60s
[15:38:53] allcentury: so, which ever timeout is less will get triggered first. unicorn on timeouts can be configured but I believe they raise a 5XX
[15:39:08] sevenseacat: so what does object.attributes.symbolize_keys return ?
[15:39:14] allcentury: we have our nginx configured to show a 503 when unicorn timesout
[15:39:45] thesubr00t: allcentury, the object's list of attributes as symbols
[15:40:13] mordof: allcentury: so let's say it goes over both timeouts. ignoring the actual response to the browser(client.. w/e) - would it make sense for the rails production.log to just not spit out anything further for that request?
[15:40:23] sevenseacat: I don't think you could call each_key on it if it did
[15:40:39] mordof: currently looking through my unicorn logs
[15:41:01] allcentury: mordof: I don’t recall unicorn logging anything when it exceeds the timeout
[15:41:15] thesubr00t: sevenseacat, sorry its a hash with attributes as symbolized keys
[15:41:39] mordof: allcentury: found one - it does
[15:41:54] mordof: allcentury: lists a SIGKILL and to which worker it brings down. then shows when it's ready again
[15:42:11] apeiros: has joined #RubyOnRails
[15:42:23] mordof: so that means it's 100% making sense that the production.log just stops
[15:42:26] mordof: because it's a kill -9
[15:42:45] allcentury: yep, i see that in the docs here: https://bogomips.org/unicorn/Unicorn/Configurator.html (see: timeout)
[15:43:34] thesubr00t: sevenseacat, {:id=>30, :title=>"Some title here?", :kind=>"single_choice", :rank=>1, :allows_free_answer=>true, :survey_id=>3, :created_at=>Mon, 19 Mar 2018 13:53:15 CET +01:00, :updated_at=>Mon, 19 Mar 2018 13:53:15 CET +01:00}
[15:43:45] crankharder: has joined #RubyOnRails
[15:43:46] dionysus69: has joined #RubyOnRails
[15:44:47] sevenseacat: so which methods aren't being defined where?
[15:45:00] sevenseacat: where are you expecting them to be created and how are you checking
[15:45:35] mordof: allcentury: awesome. so that properly explains the production logs, and those timeouts. the 404 i guess is a different issue. can i ask how you've got yours configured (roughly) to show a 503?
[15:47:07] thesubr00t: sevenseacat, I'm expecting them to be defined on the child class's
[15:47:08] jcarl43: has joined #RubyOnRails
[15:47:18] sevenseacat: on which class?
[15:47:35] thesubr00t: Im trying to DRY that bit of code by defining it in the parent class
[15:47:52] thesubr00t: QuestionSerializer < BaseSerializer
[15:49:16] thesubr00t: sevenseacat, I'm expecting them to be defined on the QuestionSerializer class
[15:49:22] allcentury: mordof: I think the best thing to do is use nginx to group 500’s and respond with a consistent msg, ie: https://serverfault.com/questions/642705/request-timeout-issue-with-nginx-unicorn-and-rails (`error_page`)
[15:51:30] cagomez: has joined #RubyOnRails
[15:53:08] [Butch]: has joined #RubyOnRails
[15:53:46] thesubr00t: sevenseacat, I test it by defining the method on the same class with no luck
[15:54:43] sevenseacat: I mean, how do you know this code isnt working
[15:55:12] thesubr00t: The gsub part is not working
[15:55:31] sevenseacat: so... it is defining the methods?
[15:55:57] roca: has joined #RubyOnRails
[15:56:31] SteenJobs: has joined #RubyOnRails
[15:56:44] sevenseacat: there's a bug in the logic used to gsub strings?
[15:57:28] desperek: has joined #RubyOnRails
[16:01:11] sevenseacat: if the methods werent being defined, when you call them you'd get an error
[16:02:07] Saukk: has joined #RubyOnRails
[16:03:00] srinidhi: has joined #RubyOnRails
[16:03:34] allcentury: thesubr00t: sorry just looking at this again, shouldn’t `attributes` be a class method in your BaseSerializer?
[16:03:57] allcentury: you call it as a class method: https://gist.github.com/anonymous/7c4c024dcbe1b5567680f30f7af98d8e#file-questions_serializer-rb-L2
[16:04:10] thesubr00t: sevenseacat, allcentury https://gist.github.com/anonymous/13a54c052b0307d9d3de7dc21bcd6183
[16:05:09] duderonomy: has joined #RubyOnRails
[16:05:39] sevenseacat: I think allcentury is correct - I thought when you gave the output of object.attributes.symbolize_keys you were getting it from inside that method when it was called
[16:06:53] thesubr00t: How to define it as a class method then?
[16:07:01] allcentury: I think you just want : ```def self.attributes(*_args)
[16:07:02] allcentury: args.each_key do |attr|
[16:07:03] allcentury: next unless self.send(attr).is_a?(String)
[16:07:05] allcentury: self.class.send(:define_method, attr) do
[16:07:06] allcentury: object.send(attr).gsub('«', '&laquo;').gsub('»', '&raquo;').tr("'", "'")
[16:07:28] allcentury: _args.each_key*
[16:08:28] sevenseacat: oooh I think that means I need sleep that I didnt see that lol
[16:09:36] allcentury: sevenseacat: I’ve been reading ‘The Self-Driven Child’ and just finished the chapter on sleep. It’s amazing how poorly your mind behaves when sleep deprived. Even if you don’t have kids, I’d recommend the book - I’ve learned a lot
[16:09:53] sevenseacat: i'll check it out :)
[16:10:33] allcentury: https://www.scientificamerican.com/article/the-case-for-the-ldquo-self-driven-child-rdquo/
[16:14:09] andrewray: has joined #RubyOnRails
[16:14:16] one_zero: has joined #RubyOnRails
[16:14:18] thesubr00t: allcentury, undefined method `id' for QuestionSerializer:Class
[16:14:21] za1b1tsu: has joined #RubyOnRails
[16:14:43] thesubr00t: also object is not accessible here, I've changed it to self
[16:17:13] za1b1tsu: Hello, in web development, when using locales, for example i need a locale for "Code", in the english locale I should put "The code", or "Code", what are the best practices?
[16:18:54] mordof: allcentury: looked into the error page grouping. turns out we're doing that for all of our 5xx codes - just not 404. We've got a fancy page we use for errors - and you're right, it'd be nice to have it grouped under that. my one concern is that for any 5xx we have rails set up to email us when there's a problem.. here, we wouldn't get any notificat
[16:18:55] mordof: ion. Should i move the timeout into a rails middleware so I can dispatch emails properly?
[16:19:02] mordof: not sure if it's appropriate to move the timeout handling into rails
[16:19:36] mordof: ACTION looks into if unicorn can do that
[16:20:03] hnanon: has joined #RubyOnRails
[16:21:40] allcentury: mordof Ya, we used to notify ourselves on timeouts via a custom Timeout.timout(x) in app code but that got too noisey for us.
[16:22:18] uks: has joined #RubyOnRails
[16:22:37] mordof: allcentury: makes sense. i think it'd be nice to log it somewhere though.. to show the request details and then have it be a stat in our monitoring dashboard or something..
[16:23:20] mordof: allcentury: some of our larger clients end up getting timeouts in lots of different places because stuff just wasn't built with that in mind. right now the only way we know if it happens is when they tell us directly, lol... not a good approach
[16:24:51] allcentury: mordof ah ya, i think your middleware idea is a good one
[16:26:21] darkhanb: has joined #RubyOnRails
[16:28:52] hnanon: I need some help crafting an ActiveRecord query.
[16:29:01] hnanon: This is what I have so far: https://gist.github.com/anonymous/7b1ca164dd0dc284d634668e048fa748
[16:29:20] hnanon: That's the goal, I should say.
[16:29:52] orbyt_: has joined #RubyOnRails
[16:29:54] hnanon: Of course, I can get each piece individually. But, I don't know how to group them.
[16:38:27] mtkd: has joined #RubyOnRails
[16:40:19] LateralOctober: has joined #RubyOnRails
[16:43:15] hnanon: I should also say that the tables are not related.
[16:44:21] za1b1tsu: Anyway I can print all locales in rails c?
[16:51:55] havenwood: za1b1tsu: I18n.available_locales
[17:03:26] za1b1tsu: havenwood, cheers
[17:13:23] dionysus69: has joined #RubyOnRails
[17:28:06] krawchyk: has joined #RubyOnRails
[17:37:09] arBmind: has joined #RubyOnRails
[17:41:09] za1b1tsu: So I've read that locales are scoped directly with controller action, but I have my controller in a namespace and it does not work
[17:41:28] za1b1tsu: anything I can do about it?
[17:44:39] za1b1tsu: https://gist.github.com/bbtdev/e5474dfe54bde1bdc942d95ba5ba3fec this is the locale controller /v3/users_controller.rb
[17:48:53] Ryzokuken: has joined #RubyOnRails
[17:57:48] sarink: has joined #RubyOnRails
[17:58:45] sarink: i've called obj.update_attributes and then obj.save! but i keep a duplicate key error as if i'm trying to insert a record, why is this code not triggering an update?
[17:58:54] sarink: keep getting*
[18:00:17] dminuoso: sarink: "as if i'm trying to insert a record"
[18:00:19] dminuoso: sarink: What makes you say that?
[18:00:25] sarink: obj = Obj.where(:email => 'abc@def.com').first_or_initialize obj.update_attributes(:email => '123@456.com') obj.save!
[18:00:40] dminuoso: sarink: The error means, you are trying to violate database constraints
[18:01:40] sarink: dminuoso: is that code the correct way to update a record? in the logs i'm seeing INSERT INTO ... and then getting the error (which would be correct, except i'm trying to _update_, not insert)
[18:02:13] dminuoso: sarink: What do you think first_or_initialize does?
[18:03:11] sarink: either.... finds the first matching record, or else creates a new not-yet-saved object
[18:03:54] dminuoso: sarink: what do you expect .save! to do with a new not-yet-saved object?
[18:04:10] dminuoso: (Hint, Im gonna slap you if you say "save it")
[18:04:10] sarink: validate, then store
[18:04:18] dminuoso: what does "storing" mean database wise?
[18:05:20] sarink: "If the model is new a record gets created in the database, otherwise the existing record gets updated." /shrug
[18:05:39] sarink: please enlighten me
[18:05:54] dminuoso: sarink: "created in the database" means INSERT.
[18:06:30] sarink: the error is "duplicate email"
[18:06:38] sarink: there is one user in the database
[18:06:47] sarink: it should be finding it and then updating it
[18:07:12] SteenJobs: has joined #RubyOnRails
[18:07:19] dminuoso: sarink: What's the email address of that user?
[18:08:20] sarink: abc@def.com
[18:12:15] dminuoso: sarink: can you gist the output of Obj.all.to_a
[18:14:37] DrYockel: has joined #RubyOnRails
[18:19:26] shpoont: has joined #RubyOnRails
[18:26:32] kn-928: has joined #RubyOnRails
[18:52:55] erts: has joined #RubyOnRails
[18:56:55] cagomez: has joined #RubyOnRails
[19:01:39] NoGodDamnIdea: has joined #RubyOnRails
[19:05:43] srinidhi: has joined #RubyOnRails
[19:06:12] schneider: has joined #RubyOnRails
[19:13:01] cagomez: has joined #RubyOnRails
[19:22:45] weird_error: has joined #RubyOnRails
[19:39:38] cagomez: has joined #RubyOnRails
[19:44:28] hammer065: has joined #RubyOnRails
[19:45:10] Dimik: has joined #RubyOnRails
[19:45:29] tycoon177: i'm having some issues when using turbolinks and submitting a remote form via javascript on a new rails 5 project. It keeps complaining about csrf tokens being invalid, but 1) it's all localhost, no other domains and 2) I'm just calling $(form_selector).submit()
[19:45:33] tycoon177: any ideas on fixing this?
[19:46:02] mtkd: has joined #RubyOnRails
[19:46:06] tycoon177: my rails version is 5.1.5 and the actual error is "ActionController::InvalidAuthenticityToken in VoucherApprovalsController#update"
[19:46:18] dminuoso: tycoon177: How is the form constructed?
[19:46:27] tycoon177: dminuoso: i'm using simple_form
[19:46:44] tycoon177: it's not being constructed through js. just a normal .html.erb file
[19:47:27] dminuoso: tycoon177: Do you have csrf_meta_tags in your layout template?
[19:47:55] tycoon177: dminuoso: yeah, it's in the head
[19:57:18] cagomez: has joined #RubyOnRails
[19:57:25] tycoon177: dminuoso: also, i'm not sure if this is relevant or not, but the output from my rails server is indicating that it's processing it as an html request, even though i have indicated remote: true
[19:58:11] dminuoso: tycoon177: Can you gist your Gemfile?
[19:59:12] SteenJobs: has joined #RubyOnRails
[19:59:55] tycoon177: dminuoso: absolutely! https://gist.github.com/BenMcH/96a069e1d2f01223d4cee62806c423e9
[20:00:35] shpoont: has joined #RubyOnRails
[20:02:10] duderonomy: has joined #RubyOnRails
[20:03:50] tycoon177: dminuoso: I figured it out ._. i figured jquery_ujs was automatically included in the application.js but it looks like this is not the case
[20:04:01] shpoont: has joined #RubyOnRails
[20:06:40] sameerynho: has joined #RubyOnRails
[20:13:22] cagomez: has joined #RubyOnRails
[20:13:55] roshanavand: has joined #RubyOnRails
[20:27:40] kn-928: has joined #RubyOnRails
[20:36:51] AnotherOne: has joined #RubyOnRails
[20:42:47] mark721: has joined #RubyOnRails
[20:43:29] mark721: i was learning about generating .ics files using rails. From some googling i found the iCalendar ruby gem
[20:43:55] mark721: im just a bit confused on after making the object how to allowing a user to actually being able to download the file
[20:44:59] mark721: anyone have any experience using .oc
[20:47:11] Francute: has joined #RubyOnRails
[20:47:54] Francute: Which version of ruby should i use for rails 5.1.4?
[20:49:19] fryguy: Francute: any versions >= 2.2
[20:49:35] Francute: Ruby 2.2 isn't going to lose maintenance this month?
[20:49:51] Francute: But i shouldn't care about that?
[20:49:57] fryguy: maybe you do
[20:50:04] fryguy: if you do, then use something newer
[20:50:25] duderonomy: has joined #RubyOnRails
[20:51:03] Francute: Really thanks, fryguy
[20:55:14] FrostCandy: has joined #RubyOnRails
[20:55:54] FrostCandy: Anyone know how to add a parameter to the will_pagnate link? will_pagnate is a gem and I want to add a parameter like search
[20:57:05] za1b1tsu: has joined #RubyOnRails
[21:04:47] shpoont: has joined #RubyOnRails
[21:05:46] sameerynho: has joined #RubyOnRails
[21:11:19] workmad3: has joined #RubyOnRails
[21:13:30] krawchyk: has joined #RubyOnRails
[21:20:12] FrostCandy: nm it's automaticaly figured out heh
[21:22:37] quazimodo: has joined #RubyOnRails
[21:32:56] shpoont: has joined #RubyOnRails
[21:43:47] NoGodDamnIdea: has joined #RubyOnRails
[21:44:22] blackcross: has joined #RubyOnRails
[21:45:33] jottr: has joined #RubyOnRails
[21:46:22] trautwein: has joined #RubyOnRails
[21:47:10] Tempesta: has joined #RubyOnRails
[21:47:27] trautwein: has joined #RubyOnRails
[21:49:27] shpoont: has joined #RubyOnRails
[21:49:54] trautwein: has joined #RubyOnRails
[21:50:08] trautwein: has joined #RubyOnRails
[21:56:49] rikkipitt: has joined #RubyOnRails
[21:57:24] Cache_Money: has joined #RubyOnRails
[22:03:48] shpoont: has joined #RubyOnRails
[22:07:07] duderonomy: has joined #RubyOnRails
[22:10:39] sameerynho: has joined #RubyOnRails
[22:13:59] trautwein: has joined #RubyOnRails
[22:14:42] cagomez: has joined #RubyOnRails
[22:15:07] xall: has joined #RubyOnRails
[22:15:34] trautwein: has joined #RubyOnRails
[22:16:50] mooe: has joined #RubyOnRails
[22:35:32] duderonomy: has joined #RubyOnRails
[22:40:24] shpoont: has joined #RubyOnRails
[22:43:35] gravity_pope: has joined #RubyOnRails
[22:43:51] tcopeland: has joined #RubyOnRails
[22:56:14] mattwithoos: has joined #RubyOnRails
[23:05:32] roshanavand: has joined #RubyOnRails
[23:10:16] shpoont: has joined #RubyOnRails
[23:11:33] workmad3: has joined #RubyOnRails
[23:15:23] kn-928: has joined #RubyOnRails
[23:31:17] roca: has joined #RubyOnRails
[23:46:04] roshanavand: has joined #RubyOnRails
[23:49:22] mikecmpbll: has joined #RubyOnRails