#RubyOnRails - 02 June 2017
« Back 1 day Forward 1 day »
[01:31:26] SilentNinja1: Hi is there a one line to convert Date to UTC, maybe DateTime.current.utc ?
[01:40:36] baweaver: SilentNinja1: did you ask that same question earlier in #ruby? Pretty sure you got answers there.
[09:13:34] Cork: when i run rails as a different user it keeps requiring that i run bundle install first
[09:34:50] dionysus69: ok, here I go starting up on my big project. first question, i have is that I want to use phone number instead of email, in devise. do I just rename db field from :email to :tel? what else do I might need? I also removed validatable devise module
[09:35:49] dionysus69: I will be keeping validatable module, but I won't be sending email but sending sms with a code
[09:41:56] dminuoso: dionysus69: I just found that in particular Russians seem to use the "))" smiley
[11:19:42] bhams: hi folks, how do i get this div_for line to embed the id of the objects i'm iterating through?
[11:20:39] bhams: right now q.answers.ids works but q.answers.id does not. is there a work around or will i have to write a loop that generates the div id tags manually?
[14:43:13] elouisyoung: my actioncable connection (in production mode), is not having any cookies from the originating session... any ideas?
[15:52:32] kaiks: hi, why can't i access a non-persisted model's association? i.e. model = Model.new(association_id: 123); model.association #=> nil
[15:57:01] apeiros: so I'd say either that's not really what you're doing, or something else is going on
[15:58:06] apeiros: AR will allow you to use associations on unpersisted models as long as it has any means of knowing they're associated. and the case as presented by you is such a case.
[15:59:23] kaiks: well, my problem lies elsewhere, I'm trying to get STI to work with associations and weird stuff keeps happening
[16:00:35] tfitts: I have kind of a weird one. I just changed ruby versions so I'm not sure if it's related to that but I'm in pry and I have a User model and a Timeclock model. when I do Timeclock.last I get #<Timeclock id: 29750, user_id: 3, in_at: "2017-06-02 15:31:50", out_at: nil, created_at: "2017-06-02 15:31:50", updated_at: "2017-06-02 15:31:50"> but if I do User.last I just get #<User:0x3fdadc7c83e0> It doesn't show any
[16:01:20] noob_on_rails: i have an Album model , with a multi select that selects artists, when i go to edit this and Update , and let's say i delete an artist
[18:04:50] cerulean: is it possible to analyze a file immediate after its uploaded with carrierwave?
[18:22:37] mustmodify: I have webpack running ReactOnRails. I see they are using rspec features to do tests... what's an easy way to add js unit tests to that mix?
[18:41:17] quazimodo: atm my server side renderer doesn't really gie me a nice stack trace back... my code is minified though
[18:53:30] mustmodify: Yes. There's a ReactOnRails plugin for Chrome and I think that's digging in to the JS and doing some magic.
[18:54:39] quazimodo: so do you get a nice stack trace showing you which file and line cause d the issue?
[18:55:37] mustmodify: if it compiles fine then I am able to load the browser. And it's broken and nothing show up. But in the console, there's a cryptic error.
[18:55:54] mustmodify: And I click on it and this ReactOnRails plugin somehow gives me a stack trace.
[18:56:28] mustmodify: https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
[19:03:00] mustmodify: Well, just for clarification, it doesn't look like it's ReactOnRails specific.
[20:52:04] benlieb: Are array lookups in ruby constant time? Just curious after reading this comment, probably meaning to refer to Java or C: Array is collection of similar types of data. So all the elements will take same amount of memory.Therefore if you know the base address of array and type of data it holds you can easily get element Array[i] in constant time. (cross-posted to #ruby)
[21:20:05] benlieb: See answer w 87 votes here: https://stackoverflow.com/questions/5551168/performance-of-arrays-and-hashes-in-ruby
[21:25:57] centrx: the source for the main part of Array# is here: https://github.com/ruby/ruby/blame/d0015e4ac6b812ea1681b1f5fa86fbab52a58960/array.c
[21:27:20] centrx: benlieb: Maybe certain entries could be slower, but that's still O(1) constant time (over n entries)
[21:28:47] centrx: benlieb: In general, even if you had a basic C array where you somehow got values of different memory sizes, you would just have to do the arithmetic properly, it's just arithmetic on memory addresses
[21:31:57] benlieb: centrx: I'm not too good with C, I guess there's some kind of storage of array keys to memory locations
[21:33:26] centrx: benlieb: yes my educated guess/assumption is that Ruby array is a list of pointers to memory locations
[21:34:48] benlieb: centrx: that makes sense. Maybe in Java it would store the actual data in the alotted memory for the array at declaration time?
[21:37:55] centrx: benlieb: Each entry has a specified (e.g. an integer), then the the array access is simply multiplying startpoint + index*datasize to get to the right memory location
[21:46:26] desnudopenguino: so i'm working on a select field (using collection for a form, trying to figure out how to get the key as the value
[22:48:17] gheegh: Having a heck of a time getting the Has many through working correctly with a polymorphic in the middle.. here's a gist..https://gist.github.com/wflanagan/96a4b4cf30340309b8b5e8bf6056444f
[23:28:38] brent__: I have a factorygirl that fails due to the associatio not being generated in time for an after_save callback
[23:29:39] brent__: i'm trying to generate a factorygirl(:user_profile) which includes 'association :user', the after_save callback does user_profile.user.method, however breaks as user_profile.user returns nil