« Back to channel list

#RubyOnRails - 13 April 2017

« Back 1 day Forward 1 day »
[00:07:05] war_pigs: has joined #RubyOnRails
[00:21:15] cagomez: has joined #RubyOnRails
[00:25:59] war_pigs: has joined #RubyOnRails
[00:27:23] bronson: has joined #RubyOnRails
[00:35:34] war_pigs: has joined #RubyOnRails
[00:43:03] hndk: has joined #RubyOnRails
[00:50:10] cagomez: has joined #RubyOnRails
[00:58:04] brendan-: has joined #RubyOnRails
[01:00:40] war_pigs: has joined #RubyOnRails
[01:19:36] Technodrome: has joined #RubyOnRails
[01:25:47] Jameser: has joined #RubyOnRails
[01:27:54] Ratler: has joined #RubyOnRails
[01:31:43] apeiros: has joined #RubyOnRails
[01:43:37] spicerack: has joined #RubyOnRails
[01:46:04] irishfromua: has joined #RubyOnRails
[01:47:49] Coldblackice: has joined #RubyOnRails
[01:50:43] icharlie: has joined #RubyOnRails
[01:51:48] safetypin: has joined #RubyOnRails
[01:54:22] s2013: has joined #RubyOnRails
[01:55:03] Technodrome: has joined #RubyOnRails
[01:58:52] aajjbb: has joined #RubyOnRails
[02:05:01] libastral: has joined #RubyOnRails
[02:08:42] workmad3: has joined #RubyOnRails
[02:14:06] chrickso: has joined #RubyOnRails
[02:15:32] apeiros: has joined #RubyOnRails
[02:17:57] nahtnam: has joined #RubyOnRails
[02:35:21] rakm: has joined #RubyOnRails
[02:38:44] cagomez: has joined #RubyOnRails
[02:41:29] brent__: has joined #RubyOnRails
[02:44:19] Rodya_: has joined #RubyOnRails
[02:45:43] cagomez: has joined #RubyOnRails
[02:46:31] duderonomy: has joined #RubyOnRails
[02:53:02] ericmathison: has joined #RubyOnRails
[03:06:10] harfangk: has joined #RubyOnRails
[03:18:04] Saukk: has joined #RubyOnRails
[03:18:23] DoctorMonocular: has joined #RubyOnRails
[03:19:05] DoctorMonocular: ok kids, naming question: I have a node and graph data structure. I have a method that returns all nodes within N steps of the given node. What should I name this method?
[03:21:37] byteflame: has joined #RubyOnRails
[03:26:41] Technodrome: has joined #RubyOnRails
[03:31:29] sevenseacat: has joined #RubyOnRails
[03:47:33] dmarr: has joined #RubyOnRails
[04:00:51] kt2: has joined #RubyOnRails
[04:10:04] hndk: has joined #RubyOnRails
[04:12:50] rakm: has joined #RubyOnRails
[04:17:57] FastJack: has joined #RubyOnRails
[04:29:42] jdm: has joined #RubyOnRails
[04:34:56] s2013: has joined #RubyOnRails
[04:46:16] Rodya_: has joined #RubyOnRails
[04:52:28] Pumukel: has joined #RubyOnRails
[04:54:30] nicknight: has joined #RubyOnRails
[04:54:59] nicknight: hi how can i build a analytics app in ror?
[04:55:58] sevenseacat: thats a bit of an overly broad question
[04:56:03] sevenseacat: feel like narrowing it down a bit?
[04:56:26] nicknight: sevenseacat: means?
[04:56:49] sevenseacat: which part specifically are you having problems with?
[04:58:12] nicknight: sevenseacat: I havent started
[04:58:24] nicknight: just want to know how I can start?
[04:58:44] sevenseacat: you can start with installing rails, and then generating a new app
[04:58:54] sevenseacat: and then start adding whatever functionality you need
[05:01:17] Technodrome: has joined #RubyOnRails
[05:02:53] nicknight: ok thanks a lot sevenseacat I will be back if needed
[05:11:48] jeyraof^mbpr: has joined #RubyOnRails
[05:21:45] byteflame: has joined #RubyOnRails
[05:21:53] spyder55: has joined #RubyOnRails
[05:22:29] juggler: has joined #RubyOnRails
[05:24:46] knight33: has joined #RubyOnRails
[05:30:20] uks: has joined #RubyOnRails
[05:38:46] bios__: Hey *.. I've got a validation on a model, but I'm not sure how I can access the error messages in my view to show the user. Any help would be great
[05:39:25] bios: my validation is as follows: validates_presence_of :event_end_date, :if => :is_multi_day?, :message => "Please enter an end date if the event is multi-day."
[05:43:52] bios: I thougth I should be able to access them through @event.errors
[05:43:55] bios: but it's empty
[05:44:54] brent__: has joined #RubyOnRails
[05:46:58] sevenseacat: then there isnt an error for that field
[05:47:30] bios: @event is the object
[05:48:05] bios: and it doesn't allow the object to be saved
[05:48:14] bios: but it's not giving me any notification
[05:48:47] sevenseacat: what do your logs say?
[05:50:42] bios: https://gist.github.com/mikesaltsman/f93d745310900cf00611e5ee8ff9255f
[05:50:54] bios: looks like it tries to save it and then rolls back
[05:51:11] sevenseacat: can you show the code for that controller action? and the model?
[05:53:17] bios: https://gist.github.com/mikesaltsman/8866c77d34138ee81cd79ef2ecfc2187
[05:53:59] bios: https://gist.github.com/mikesaltsman/ccc4c39fb0abf861cb1013df4d404be9
[05:54:06] bios: first is controller, second is model
[05:55:16] sevenseacat: well @event.errors definitely isn't nil
[05:55:34] sevenseacat: because your vip_url is empty
[05:56:33] bios: but @event.errors is {}
[05:56:44] bios: in the view
[05:56:58] sevenseacat: which view? after hitting which action?
[05:57:09] bios: in the edit view
[05:57:19] bios: after submitting the form, which would be update I guess?
[05:57:53] sevenseacat: ok, so where are you defining @event
[05:58:36] sevenseacat: you have to be, otherwise @event.update would gve you an error
[05:58:56] sevenseacat: I have a feeling you're looking at the wrong controller
[05:59:00] bios: oh.. in edit
[05:59:19] sevenseacat: thats not related to the update action
[06:00:00] bios: https://gist.github.com/mikesaltsman/ca7c66211c84355c993609ad3e07ae4b
[06:00:08] bios: there's my entire events controller
[06:00:23] sevenseacat: right, there's a before_action there
[06:00:40] bios: before action
[06:00:41] bios: set event
[06:01:26] sevenseacat: a bit confused about your logs saying it's a JS request, but your controller not supporting that
[06:03:16] bios: where are you seeing it say it's a JS request in the logs.. I'm missing that
[06:03:33] sevenseacat: https://gist.github.com/mikesaltsman/f93d745310900cf00611e5ee8ff9255f#file-gistfile1-txt-L2
[06:03:35] bios: Processing by Accounts::EventsController#update as JS
[06:04:18] bios: I'm not sure where that comes from either.
[06:07:39] bios: Ok.. well, I guess what I was looking for was that I am understanding where the errors should be showing up, correctly
[06:07:44] bios: and it seems I am..
[06:07:51] bios: just need to figure out what is really going on here
[06:08:08] bios: thanks so much for your help.. I appreciate your time!
[06:08:27] sevenseacat: https://gist.github.com/mikesaltsman/ccc4c39fb0abf861cb1013df4d404be9#file-gistfile1-txt-L7 whats this do?
[06:10:02] bios: I put it in the comment.. it's a method in the model that I pulled out before posting to gist
[06:10:24] sevenseacat: okay, but what does it do? whats the code?
[06:10:32] bios: it's in the gist comment
[06:10:37] bios: https://gist.github.com/mikesaltsman/ccc4c39fb0abf861cb1013df4d404be9#file-gistfile1-txt-L7
[06:10:58] sevenseacat: so if that returns false, the save won't go ahead - that can cause a rollback
[06:11:17] xpl0iter: has joined #RubyOnRails
[06:11:37] bios: ok.. that makes sense.. but why would that fail only when validations fail, I wonder
[06:11:47] sevenseacat: can you print out the value of self.timezone and see what it is
[06:11:50] bios: because if I don't break the validation rules, it saves correctly
[06:11:58] sevenseacat: well thats new
[06:12:01] Technodrome: has joined #RubyOnRails
[06:12:06] sevenseacat: and that makes sense
[06:12:10] bios: yeah.. I'll try that
[06:12:15] sevenseacat: if you break the validation rules, it doesnt save :P
[06:12:45] bios: right.. which is how validations work, right?
[06:13:04] bios: sorry.. I'm not 100% confident I understand.. so a lot of my statements are actually questions :]
[06:13:38] bios: so it doesn't save, but should give me errors in @event.errors
[06:14:45] dminuoso: bios: Validations are like poor mans constraints, except they don't constrain anything. But they seamlessly integrate into form builders. :-)
[06:15:27] sevenseacat: if there's a validation error, it will populate in the errors object
[06:15:37] sevenseacat: but thats not the only reason a save might not occur
[06:16:42] bios: I'm going to try to follow the timezone logic and see if I can see where it would fail
[06:16:56] bios: thank you very much for your help!
[06:20:53] bios: yeah.. it's not even hitting set_time_zone
[06:21:02] bios: it's failing in the controller update
[06:22:07] bios: but it's failing with an error now.
[06:23:57] bios: yeah, the error is showing correctly if I output the error from the update action, but it's not in my view
[06:24:44] kristofferR: has joined #RubyOnRails
[06:24:45] bios: I wonder if I'm making a new @event object and that's killing my errors before I render the view?
[06:25:45] bios: Ok.. I'm going to sleep on it.. thanks again *
[06:25:47] bios: goodnight!
[06:33:40] Qchmqs: has joined #RubyOnRails
[06:43:05] romankonz: has joined #RubyOnRails
[06:45:24] Jayson_Virissimo: has joined #RubyOnRails
[06:47:13] sagax: has joined #RubyOnRails
[06:49:30] Rodya_: has joined #RubyOnRails
[06:53:22] arBmind: has joined #RubyOnRails
[06:55:37] romankonz: has joined #RubyOnRails
[07:00:00] srinidhi: has joined #RubyOnRails
[07:21:59] byteflame: has joined #RubyOnRails
[07:25:44] jonno112: has joined #RubyOnRails
[07:31:45] patarr: has joined #RubyOnRails
[07:40:51] wethu: has joined #RubyOnRails
[07:47:14] tbuehlmann: dminuoso: now it's validations! what's next? callbacks? instance variable sharing in views? directory structure? oh wait, nevermind
[07:47:53] Gabriel403: has left #RubyOnRails: ()
[07:47:59] universa1: tbuehlmann: instance variable sharing in views was already ;)
[07:48:01] helpa: good morning IRCers, I hope that this day finds you hale and hearty
[07:50:13] Rodya_: has joined #RubyOnRails
[07:51:29] sevenseacat: afternoon universa1
[08:00:47] brent__: has joined #RubyOnRails
[08:02:53] workerbeetwo: has joined #RubyOnRails
[08:03:24] workerbeetwo: Hi. Is there a way to reduce the rails server output to databse interactions?
[08:03:44] AzaToth: has joined #RubyOnRails
[08:03:57] sevenseacat: I think you'd have better luck using instrumentation to log all of the queries to a different file
[08:04:36] sevenseacat: http://guides.rubyonrails.org/active_support_instrumentation.html
[08:26:10] dminuoso: tbuehlmann: What's wrong with callbacks?
[08:26:18] dminuoso: Can't get more functional than that! :D
[08:27:05] universa1: dminuoso: you can always have monads: https://codon.com/refactoring-ruby-with-monads *cough*
[08:27:15] dminuoso: workerbeetwo: Sort of yes.
[08:27:26] dminuoso: workerbeetwo: Just use a separate logger for ActiveRecord.
[08:28:03] dminuoso: universa1: I actually have Maybe monads floating around in a project of mine.. :-)
[08:28:21] dminuoso: fmap is so much more comfortable than &.
[08:28:43] jdm: has joined #RubyOnRails
[08:29:37] dionysus69: has joined #RubyOnRails
[08:35:25] mikecmpbll: has joined #RubyOnRails
[08:41:09] jdm: has joined #RubyOnRails
[08:44:29] pankaj_: has joined #RubyOnRails
[08:46:37] pankaj_: has left #RubyOnRails: ()
[08:46:39] pankaj_: has joined #RubyOnRails
[08:50:45] workerbeetwo: dminuoso: thank you.
[08:51:05] Rodya_: has joined #RubyOnRails
[08:51:13] marr: has joined #RubyOnRails
[08:52:05] dblessing: has joined #RubyOnRails
[08:52:33] cagomez: has joined #RubyOnRails
[08:55:23] arBmind: has joined #RubyOnRails
[09:00:38] arBmind: has joined #RubyOnRails
[09:01:25] lxsameer: has joined #RubyOnRails
[09:18:39] jonno112: has joined #RubyOnRails
[09:22:08] byteflame: has joined #RubyOnRails
[09:24:36] Wakatara: has joined #RubyOnRails
[09:30:50] arBmind: has joined #RubyOnRails
[09:32:37] patarr: has joined #RubyOnRails
[09:33:38] DrYockel: has joined #RubyOnRails
[09:34:23] centrx: has joined #RubyOnRails
[09:43:29] ferr1: has joined #RubyOnRails
[09:44:43] coffeejunk: has joined #RubyOnRails
[09:51:48] Rodya_: has joined #RubyOnRails
[10:22:05] byteflame: has joined #RubyOnRails
[10:27:26] rgr_: has joined #RubyOnRails
[10:37:36] irishfromua: has joined #RubyOnRails
[10:37:48] figuresofstick: has joined #RubyOnRails
[11:08:24] cagomez: has joined #RubyOnRails
[11:11:23] patarr: has joined #RubyOnRails
[11:13:33] justAllgood: has joined #RubyOnRails
[11:26:01] Saukk: has joined #RubyOnRails
[11:26:27] handicraftsman: has joined #RubyOnRails
[11:34:11] User458764: has joined #RubyOnRails
[11:35:47] srinidhi: has joined #RubyOnRails
[11:37:38] justAllgood1: has joined #RubyOnRails
[11:38:53] byteflame: has joined #RubyOnRails
[11:46:05] aajjbb: has joined #RubyOnRails
[11:46:36] pankaj_: has joined #RubyOnRails
[11:55:14] cagomez: has joined #RubyOnRails
[11:57:17] bbrowning: has joined #RubyOnRails
[11:59:37] King_Rex: has joined #RubyOnRails
[12:22:28] pupsicle: has joined #RubyOnRails
[12:26:01] cagomez: has joined #RubyOnRails
[12:33:37] byteflame: has joined #RubyOnRails
[12:34:09] jtperreault: has joined #RubyOnRails
[12:43:26] AntiSpamMeta: has joined #RubyOnRails
[12:43:52] bahamas: has joined #RubyOnRails
[12:45:08] adlerdias__: has joined #RubyOnRails
[12:45:50] pLaTo0n: has joined #RubyOnRails
[12:52:00] arBmind: has joined #RubyOnRails
[12:53:57] Rodya_: has joined #RubyOnRails
[12:57:06] cagomez: has joined #RubyOnRails
[12:57:56] xpl0iter: has joined #RubyOnRails
[13:08:56] bahamas: has joined #RubyOnRails
[13:11:05] Pumukel: has joined #RubyOnRails
[13:11:35] Pumukel: has joined #RubyOnRails
[13:11:47] justAllgood: has joined #RubyOnRails
[13:12:48] toomus: has joined #RubyOnRails
[13:14:32] toomus: Maybe someone will know why in RSpec tests with type request, controller doesn't see anything I set to session
[13:17:51] toomus: I mean, I save something to session in test, just before request, and in controller I expect to receive this value in session, but session doesn't contain it
[13:19:22] toomus: I tried: session[:v] = 'val', request.session[:v] = 'val', @request.session[:v] = 'val'
[13:19:37] toomus: Nothing works
[13:20:20] rgiscard: has joined #RubyOnRails
[13:21:56] tbuehlmann: toomus: can you paste your spec code?
[13:22:55] User458764: has joined #RubyOnRails
[13:24:23] Pumukel: has joined #RubyOnRails
[13:26:50] Jameser: has joined #RubyOnRails
[13:27:25] toomus: tbuehlmann: https://gist.github.com/anonymous/aece4febf2fb9b3581c05e1d20896684
[13:27:49] rgiscard: has joined #RubyOnRails
[13:28:10] cagomez: has joined #RubyOnRails
[13:28:52] universa1: toomus: your update_request let is somewhat counterintuitive and probably won't work with multiple it blocks
[13:29:10] universa1: the block contents of the let block are evaluated on the first call
[13:29:26] universa1: and then the result of that is saved, so on subsequent calls, it doesn't get reevaluated iirc.
[13:29:47] universa1: so you probably want to return a lambda or alike from that and do, update_request.call
[13:31:03] universa1: and request specs are "integration tests" if iirc also, so directly setting the session does not work.
[13:32:23] toomus: universa1: so how to setup session if I need signed in user, and I set this session value in sessions controller when user logs in?
[13:32:43] syndikate: Hello people, how do I updated an enum value from rails console? I tried some_instance.update! status: 2, it is not being reflected although the query runs fine
[13:32:52] toomus: and sign_in(user) function doesn't hit sessions controller
[13:33:05] universa1: toomus: for example: https://makandracards.com/makandra/37161-rspec-devise-how-to-sign-in-users-in-request-specs
[13:33:28] universa1: syndikate: some_instance.whatever_status!
[13:33:31] DLSteve: has joined #RubyOnRails
[13:34:33] universa1: toomus: something along those lines, haven't checked too deeply.
[13:34:45] toomus: universa1: ok, thx :)
[13:35:21] tbuehlmann: you could also just stub the current_user method, returning the user you need
[13:35:31] tbuehlmann: (or whatever scope you're using instead of "user")
[13:35:35] syndikate: universa1, thanks.
[13:37:36] workmad3: has joined #RubyOnRails
[13:39:38] tedwing: has joined #RubyOnRails
[13:40:26] Jameser: has joined #RubyOnRails
[13:43:11] Technodrome: has joined #RubyOnRails
[13:43:26] universa1: tbuehlmann: kinda hard in a request spec (integration test), since you have no actual instance of the controller, and stubbing any instance... ;)
[13:44:05] cagomez: has joined #RubyOnRails
[13:49:16] tbuehlmann: you have the exact instance of the controller, it's named `controller`
[13:49:36] tbuehlmann: oh, request spec, right? yeah
[13:51:09] tbuehlmann: I'm okay with allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)
[13:51:22] tbuehlmann: I'm also okay having a helper method that goes through the login process
[13:51:38] arBmind: has joined #RubyOnRails
[13:54:25] v|sh: has joined #RubyOnRails
[13:54:42] Rodya_: has joined #RubyOnRails
[13:57:13] Doldge: has joined #RubyOnRails
[14:00:35] byteflame: has joined #RubyOnRails
[14:07:23] SteenJobs: has joined #RubyOnRails
[14:12:11] chouhoulis: has joined #RubyOnRails
[14:12:15] war_pigs: has joined #RubyOnRails
[14:13:28] harfangk: has joined #RubyOnRails
[14:18:26] yawboakye: has joined #RubyOnRails
[14:24:49] Leepoff: has joined #RubyOnRails
[14:31:04] rashkov: has joined #RubyOnRails
[14:33:11] rashkov: is there a way to broadcast some data to a user immediately after the user subscribes to an action cable channel? I try to call ActionCable.server.broadcast from the channel's subscribed method but it doesn't reach the user, I think because they're not fully subscribed yet. I guess I could have the user hit a traditional controller endpoint after subscribing, but I'm wondering if there's an action
[14:33:17] rashkov: cable way of doing this
[14:36:10] workmad3: has joined #RubyOnRails
[14:42:51] rakm: has joined #RubyOnRails
[14:50:17] Technodrome: has joined #RubyOnRails
[14:51:59] podman: has joined #RubyOnRails
[14:55:39] Rodya_: has joined #RubyOnRails
[14:56:23] cam27: has joined #RubyOnRails
[15:03:37] rockymeza_: has joined #RubyOnRails
[15:03:54] dustinm`_: has joined #RubyOnRails
[15:03:57] halcyonicstorm1: has joined #RubyOnRails
[15:04:49] tycoon177_: has joined #RubyOnRails
[15:06:22] ejnahc_: has joined #RubyOnRails
[15:07:51] lupine_: has joined #RubyOnRails
[15:07:53] hosh_: has joined #RubyOnRails
[15:08:52] dukedave_: has joined #RubyOnRails
[15:09:49] machuga_: has joined #RubyOnRails
[15:09:51] segy_: has joined #RubyOnRails
[15:10:41] jokke1: has joined #RubyOnRails
[15:11:08] kies: has joined #RubyOnRails
[15:11:33] Fire-Dragon-DoL: has joined #RubyOnRails
[15:12:33] SteenJobs_: has joined #RubyOnRails
[15:13:19] G: has joined #RubyOnRails
[15:14:13] claudevandort: has joined #RubyOnRails
[15:14:15] leeky: has joined #RubyOnRails
[15:16:34] chouhoulis: has joined #RubyOnRails
[15:22:44] Jayson_Virissimo: has joined #RubyOnRails
[15:26:54] xco: has joined #RubyOnRails
[15:28:29] xco: hello, i want some advice. i want to use rails of course but what’d you recommend for me to use if i wanted to create an app that, given a screen in the browser with a polygon, a user clicks and a response from the backend tells whether or not the point clicked is in the polygon on the screen?
[15:31:03] codelahoma: has joined #RubyOnRails
[15:32:53] xco: has left #RubyOnRails: ()
[15:34:38] djbkd: has joined #RubyOnRails
[15:34:50] cam27: has joined #RubyOnRails
[15:35:00] _aeris_: has joined #RubyOnRails
[15:35:11] patarr: has joined #RubyOnRails
[15:35:56] akshat: has joined #RubyOnRails
[15:36:55] cagomez: has joined #RubyOnRails
[15:37:19] cagomez: has joined #RubyOnRails
[15:38:48] cagomez: has joined #RubyOnRails
[15:41:15] User458764: has joined #RubyOnRails
[15:43:01] fryguy: has joined #RubyOnRails
[15:46:32] brent__: has joined #RubyOnRails
[15:47:33] workmad3: has joined #RubyOnRails
[15:48:27] Rodya_: has joined #RubyOnRails
[15:51:04] sent-hil: has joined #RubyOnRails
[15:57:52] [Butch]: has joined #RubyOnRails
[16:05:43] nettoweb: has joined #RubyOnRails
[16:07:44] dionysus69: has joined #RubyOnRails
[16:09:32] rakm: has joined #RubyOnRails
[16:11:51] srinidhi: has joined #RubyOnRails
[16:15:34] User458764: has joined #RubyOnRails
[16:16:00] irishfromua: has joined #RubyOnRails
[16:17:17] Rodya_: has joined #RubyOnRails
[16:19:37] username1: has joined #RubyOnRails
[16:25:34] dionysus69: has joined #RubyOnRails
[16:28:51] pLaToOn: has joined #RubyOnRails
[16:30:15] K1NGREX: has joined #RubyOnRails
[16:30:58] adlerdias___: has joined #RubyOnRails
[16:31:55] egray: has joined #RubyOnRails
[16:31:56] gusrub: has joined #RubyOnRails
[16:32:09] armando1: has joined #RubyOnRails
[16:32:52] srinidhi: has joined #RubyOnRails
[16:33:19] Olipro: has joined #RubyOnRails
[16:33:40] SteenJobs_: has joined #RubyOnRails
[16:33:48] lord4163: has joined #RubyOnRails
[16:34:23] tycoon177: has joined #RubyOnRails
[16:37:17] spectra: has joined #RubyOnRails
[16:43:12] nettoweb: has joined #RubyOnRails
[16:48:33] cagomez: has joined #RubyOnRails
[16:49:19] safetypin: has joined #RubyOnRails
[16:50:20] Technodrome: has joined #RubyOnRails
[16:53:11] King_Rex: has joined #RubyOnRails
[16:56:34] byteflame: has joined #RubyOnRails
[16:58:57] gusrub: has joined #RubyOnRails
[17:00:50] jlpeters: has joined #RubyOnRails
[17:00:54] newton: has joined #RubyOnRails
[17:01:06] Iacobus: has joined #RubyOnRails
[17:01:49] nettoweb: has joined #RubyOnRails
[17:11:51] knight33: has joined #RubyOnRails
[17:15:10] gusrub: has joined #RubyOnRails
[17:15:13] Pumukel: has joined #RubyOnRails
[17:16:22] adlerdias___: has joined #RubyOnRails
[17:18:15] jaequery: has joined #RubyOnRails
[17:22:44] aguynamedben: has joined #RubyOnRails
[17:25:33] clouder`grr: has joined #RubyOnRails
[17:26:48] kies: has joined #RubyOnRails
[17:38:03] duderonomy: has joined #RubyOnRails
[17:39:58] safetypin: has joined #RubyOnRails
[17:43:25] bbrowning: has joined #RubyOnRails
[17:52:55] LastWhisper____: has joined #RubyOnRails
[17:55:18] Echidna: has joined #RubyOnRails
[18:16:34] pLaTo0n: has joined #RubyOnRails
[18:18:03] shinobi_: has joined #RubyOnRails
[18:19:04] shinobi_: Does rails drop tables and then recreate and migrate upon every test run, or how does it handle the data?
[18:19:31] User458764: has joined #RubyOnRails
[18:20:21] xpl0iter: has joined #RubyOnRails
[18:20:55] cpruitt: shinobi_: The tables are blank & rails runs everthing in transactions that are rolled back.
[18:22:37] netzfisch: has joined #RubyOnRails
[18:23:49] Darmani: has joined #RubyOnRails
[18:26:13] Darmani: Hey guys, so I have this form that dynamically loads a partial onto my page. But I need to add an event listener to an element on that partial.
[18:26:14] Darmani: https://gist.github.com/mfifth/72e7bd82607c6ecb3b64dd44ca2029a3
[18:27:11] Darmani: oh this is ruby on rails
[18:27:17] Darmani: I thought I was in jquery lmao
[18:29:48] byteflame: has joined #RubyOnRails
[18:33:25] steelbird: has joined #RubyOnRails
[18:39:46] mikecmpbll: has joined #RubyOnRails
[18:40:36] justAllgood: has joined #RubyOnRails
[18:41:05] buckrockwell: has joined #RubyOnRails
[18:42:02] rakm: has joined #RubyOnRails
[18:43:45] SteenJobs_: has joined #RubyOnRails
[19:08:40] jaequery: has joined #RubyOnRails
[19:10:37] marr: has joined #RubyOnRails
[19:14:04] netzfisch: has joined #RubyOnRails
[19:16:26] lxsameer: has joined #RubyOnRails
[19:17:56] tubbo: has joined #RubyOnRails
[19:31:41] pupsicle: has joined #RubyOnRails
[19:48:19] crankharder: has joined #RubyOnRails
[19:50:51] jstrong: has joined #RubyOnRails
[19:51:10] jstrong: Hey all. Having some issues setting up a one to one polymorphic association. See the following gist for information in terms of how I’ve set it up: https://gist.github.com/laspluviosillas/95c66a2976cd3fa52688c9e5a2f69e7b
[19:51:42] jstrong: Any suggestions as to what I’m missing? The ‘has_one’ assocaition seems to be insisting that the foreign key be in the table that defines the has_one relationship
[19:52:28] jstrong: ‘has_many :notification_preferences’ works (since it expects FK to be defined in the other table), but I don’t want to make it possible to have multiple notification preferences per task, jsut one
[19:52:44] moogumbo: has joined #RubyOnRails
[19:53:23] gusrub: has joined #RubyOnRails
[19:54:16] Technodrome: has joined #RubyOnRails
[19:57:15] daxroc: has joined #RubyOnRails
[20:00:20] cagomez: has joined #RubyOnRails
[20:05:20] tubbo: jstrong: belongs_to will try to turn the first argument into a class name, and since there's no `Notifee` class, it will most likely not know how to rehydrate the object from an ID
[20:05:24] srinidhi: has joined #RubyOnRails
[20:05:31] jstrong: yeah, that didn’t work
[20:05:35] tubbo: oh derp, sorry
[20:05:40] jstrong: so has_one actually works, kind of.
[20:05:41] tubbo: it's a polymorphic belongs_to n/m :D
[20:05:55] justAllgood1: has joined #RubyOnRails
[20:05:57] jstrong: What happens is that I can do, for example, task.notification_preference = blah no problem
[20:06:11] jstrong: But if I try to do Task.find_or_initialize_by(notification_preference: blah) then it tries to look for notifee_id
[20:06:32] jstrong: Gives me the impression that the find_or_initialize_by in the particular version of Rails I’m working with isn’t properly coded to work with has_one polymorphic associations. Could be jsut a bug.
[20:12:31] tubbo: jstrong: what version of rails?
[20:15:16] Rodya_: has joined #RubyOnRails
[20:15:32] jstrong: tubbo: ^ (keep forgetting to tag you)
[20:15:34] tubbo: jstrong: if you're generally creating notification_preferences that way (by way of a Task), the _id should really "live" on Task
[20:15:37] tubbo: no worries
[20:15:42] tubbo: i stepped away real quick anyway
[20:16:34] tubbo: jstrong: if you don't have a Task saved yet, then the NotificationPreference can't be saved, because it needs a notifee_id and your Task doesn't have one yet.
[20:17:21] jstrong: tubbo: That’s not the issue really. The issue is find_or_initialize_by expects all has_ones to define the foreign key in the table that contains the has_one (so it looks for notifee_id on Task)
[20:17:28] nicolasb: has joined #RubyOnRails
[20:17:53] tubbo: jstrong: right, hence why you can't write the association this way. you're starting with a Task
[20:18:29] tubbo: if you did NotificationPreference.find_or_initialize_by(task: task) that would work
[20:18:38] tubbo: but i'm sure that doesn't make sense for your use case here
[20:19:02] jstrong: Yeah, that’s what I ended up doing and that works
[20:19:10] jstrong: but just wondering why we can’t go from task -> notification preference
[20:19:27] jstrong: (I’m “lucky” in this instance because I don’t actually need notification_preference as part of my find or initialize by. It’s not one of the restricting conditions)
[20:19:33] jstrong: (but if I did I would be in trouble)
[20:20:21] tubbo: jstrong: like i said before, you can't go from task -> notification_preference because you haven't saved the task yet and notification_preference needs an ID of its notifee in order to proceed.
[20:20:53] jstrong: tubbo: duh, this makes sense. Can’t have my cake and eat it too.
[20:20:54] tubbo: the way people typically solve an issue like this is by leveraging mass-assignment and accepts_nested_attributes_for
[20:21:38] jstrong: tubbo: Here’s the end code I’m going with https://gist.github.com/laspluviosillas/7046c099920242c7917ef727d4bb1bad
[20:21:40] jstrong: Works well enough, thanks.
[20:22:27] jstrong: Although the only issue here is the find_or_initialize_by when passed in the initialized task is going to try to look for NotificationPreferences with notifee_id nil! Which is an unnecessary query. Perhaps just better to go “old school” and fix the issue with if/else logic.
[20:22:45] jstrong: Not only unnecessary query but could potentially cause some major bug if somehow a NotificationPreference with notifee_id: nil ended up creeping its way into the database.
[20:22:54] tubbo: jstrong: cool. you can also do this i think: https://gist.github.com/tubbo/009e77ac61f872ff363978a9301cbba0
[20:23:18] matthewd: I'm not sure I see why the original thing "shouldn't" work.. but maybe I'm just tired
[20:23:23] jstrong: Ah, interesting. Yeah, makes sense.
[20:23:51] tubbo: matthewd: wouldn't it freak out if Task hasn't been saved yet? Task#id is nil, so NotificationPreference can't set notifee_id, and belongs_to validation fails
[20:23:57] jstrong: tubbo: and I assume that that find or initialize by is not going to try to use the nested attributes in the query that does the find? it’s smart enough to figure out that the nested attributes represent an object that cannot exist.
[20:24:48] tubbo: jstrong: yes, it will always try to create a new object
[20:24:53] tubbo: pretty sure
[20:24:59] matthewd: tubbo: But it's not setting notifee_id, it's setting notifee. It's certainly permitted to build multiple not-yet-saved objects together before saving them.
[20:25:06] tubbo: there are hacks to get it to destroy objects like passing _delete: true IIRC (the way you'd do with a nested form)
[20:25:31] jstrong: matthewd: right, that’s what i thought. but I legit think find_or_initialize_by is just not smart enough to figure all that machinery out.
[20:25:52] jstrong: matthewd: it wants it’s notifee_id and it aint happy otherwise :P
[20:25:55] tubbo: matthewd: i'm not saying it's NOT a bug haha...but i don't remember find_or_initialize_by ever working the way you're describing right now
[20:25:55] jstrong: it wants its*
[20:26:13] matthewd: jstrong: https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb
[20:26:28] matthewd: Oh, right, because of the find bit.. hmm.
[20:26:41] matthewd: (which will also break your _attributes alternative, btw)
[20:27:16] jstrong: Well what tubbo was saying is that find_or_initialize_by IS smart enought o realize that parameters that are nested attributes cannot possibly be what we want to “find” so it just ignores those when constructing the find query?
[20:27:18] jstrong: About to find out
[20:27:35] matthewd: Yeah.. it's not.
[20:27:50] tubbo: wait so find_or_initialize_by won't work like create in that case?
[20:28:27] tubbo: matthewd: [OT] what's going on with AS::Reloader? i noticed that it got refactored out into implementing AS::Executor, but i can't find any of the docs related to the Reloader API anymore.
[20:28:33] matthewd: tubbo: Nope; it'll try to do the "find" part, and fail before it ever gets around to the initialize
[20:28:46] tubbo: i've been salivating over that ever since you made the PR.
[20:29:00] tubbo: it would really help my company because we rely heavily on rails autoloading, and decorating (changing code at runtime) objects
[20:29:15] matthewd: It's... under-documented
[20:29:39] matthewd: There's some narrow API documentation on AS::ExecutionWrapper, the superclass
[20:30:16] matthewd: You [hopefully] mostly want the much-overdue-for-a-revisit-and-merge https://github.com/rails/rails/pull/27494
[20:30:56] jstrong: Thanks for the help guys. I’ll write a bug report if this fails in latest rails
[20:32:58] jstrong: Other question. Let’s say you have four parameters you’re trying to mass assign. Three of them are what you what to “find or initialize by” and the fourth is one you just want to set (in other words you don’t want it to be part of the find query). What’s the convention for doing this?
[20:33:33] matthewd: jstrong: create_with
[20:34:02] jstrong: so find_or_initialize_by(first three args).create_with(last arg)?
[20:34:14] matthewd: Err... create_with if you only want to set it on new objects... assign_attributes if you always want to set it
[20:34:29] jstrong: yeah, ok, that’s what I thought
[20:48:15] mlt-: How would I create 2 sibling tags in custom input for simple_form? I know I can wrap both siblings into yet another tag, but can't quite understand on doing it simple
[20:49:48] byteflame: has joined #RubyOnRails
[20:51:11] tubbo: mlt-: maybe @builder.concat ?
[20:51:26] tubbo: i feel like you can `concat` from within a simple_form input class
[20:52:38] mlt-: tubbo: I tried template.concat :-) but it gives odd outcomes
[20:54:53] cmmagid: has joined #RubyOnRails
[20:54:57] mlt-: tubbo: actually I see now in wiki they use SafeBuffer and write stuff in there https://github.com/plataformatec/simple_form/wiki/Adding-custom-input-components
[20:55:36] tubbo: mlt-: yes, that's sorta what concat() does as well IIRC
[20:55:42] tubbo: think it does other stuff too
[20:55:56] tubbo: but ActiveSupport::SafeBuffer is the key to the solution
[20:56:03] mlt-: So how would I write it without SafeBuffer?
[20:56:11] mlt-: oh...it has to be there.. ic
[20:56:38] tubbo: mlt-: yeah, it tells rails that the html in the string is safe
[20:56:38] mlt-: I was confused as many examples use do .. end block and use template.concat in there
[20:57:00] tubbo: just learned about https://github.com/andreapavoni/simple_form_fancy_uploads from the page you linked
[20:57:03] tubbo: pretty cool stuff mlt- ^
[20:58:09] mlt-: those guys just use string and #html_safe
[20:58:34] mlt-: I guess whatever works :-)
[20:58:47] tubbo: mlt-: SafeBuffer is the object user under the hood when you call `.html_safe` or `raw()`
[20:59:16] tubbo: raw means "take the string i pass in as an arg and wrap it with a SafeBuffer", and html_safe means "take the string this method was called on and return a new SafeBuffer with the contents of that string"
[20:59:31] mlt-: tubbo: my only "problem" I feel like it could be 2 lines functions instead of 3 :-)
[20:59:57] tubbo: concat is "take all arguments given to the function, concatenate them together, and wrap the whole thing in a SafeBuffer"
[21:00:30] mlt-: hm... so is concat global? or on what do I call it?
[21:00:42] tubbo: mlt-: !try
[21:00:42] helpa: mlt-: Why don't you try it and find out for yourself?
[21:01:02] tubbo: (i'm actually not sure if SimpleForm::Inputs::Base) includes the ActionView helpers
[21:01:18] tubbo: if not, you can include them yourself
[21:01:44] mlt-: so you aren't talking about Array#concat?
[21:02:22] mlt-: ACTION found your concat
[21:02:25] tubbo: mlt-: oh sorry, no i am not... http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-concat
[21:02:32] tubbo: TIL there is Array#concat
[21:02:34] tubbo: thanks obama
[21:04:54] mlt-: tubbo: yeah... you concat is not in Inputs::Base
[21:05:08] tubbo: mlt-: right, it's in a helper module that you *should* be able to include
[21:05:17] tubbo: if not, dunno what to tell ya
[21:05:18] mlt-: it is gonna be +1 line )
[21:05:39] mlt-: let me ponder a bit )
[21:07:41] mlt-: what is also not trivial to me is whether I can use child tag instead of a sibling. But in this case if I use template.content_tag with block, block takes over actual content :(
[21:12:37] mlt-: heh... + did it :-) 2 lines
[21:17:09] Jayson_Virissimo: has joined #RubyOnRails
[21:19:51] patarr1: has joined #RubyOnRails
[21:26:47] Rodya_: has joined #RubyOnRails
[21:32:23] sonOfRa: has joined #RubyOnRails
[21:32:47] jdm: has joined #RubyOnRails
[21:38:14] cagomez: has joined #RubyOnRails
[21:45:36] byteflame: has joined #RubyOnRails
[21:48:50] jdm: has joined #RubyOnRails
[21:49:12] K1NGREX: has joined #RubyOnRails
[21:58:20] cagomez: has joined #RubyOnRails
[22:02:38] gusrub: has joined #RubyOnRails
[22:07:25] jstrong: has joined #RubyOnRails
[22:27:32] Rodya_: has joined #RubyOnRails
[22:27:35] jhack: has joined #RubyOnRails
[22:44:37] netzfisch: has joined #RubyOnRails
[22:59:09] jane_booty_doe: has joined #RubyOnRails
[23:07:55] CGibsonmm: has joined #RubyOnRails
[23:07:59] CGibsonmm: undefined local variable or method `post' for #<RSpec::ExampleGroups::CanViewIndividulPosts:0x007ffb137468a8
[23:08:14] CGibsonmm: I have a question about a feature test. line in question= "expect(page.current_path).to eq(post_path(post))" rspec is returning undefined local variable or method `post' for #<RSpec::ExampleGroups::CanViewIndividulPosts:0x007ffb137468a8
[23:08:22] bronson: has joined #RubyOnRails
[23:08:24] patarr: has joined #RubyOnRails
[23:12:55] ovaltine: you should have post defined in that spec block, something like
[23:13:05] ovaltine: post = Post.create(...)
[23:13:19] ovaltine: click_on post.title
[23:13:29] ovaltine: expect(page.current_path).to eq(post_path(post))
[23:13:39] baweaver: cgibsonmm: please don't crosspost
[23:13:43] baweaver: it makes it harder to help.
[23:19:18] byteflame: has joined #RubyOnRails
[23:29:37] Rodya_: has joined #RubyOnRails
[23:38:16] patrick99e99: has joined #RubyOnRails
[23:39:29] patrick99e99: Hey everyone, I am just updating my app to rails 4.2, and am finding that my application.scss.erb is not getting preprocessed? I tried putting a debugger statement in the file, and nothing happens.. If I switch back to rails 4.1, then I hit the debugger... Any ideas why this file would not be getting executed as erbb ?
[23:45:24] DLSteve: has joined #RubyOnRails
[23:46:05] patrick99e99: weird.. it's like the file only gets compiled occasionally...... ahh must be something going in tmp/cache for capybara..
[23:56:28] Fridtjof: has joined #RubyOnRails
[23:56:57] uksio: has joined #RubyOnRails