« Back to channel list

#RubyOnRails - 17 October 2017

« Back 1 day Forward 1 day »
[00:00:38] jrabe: has joined #RubyOnRails
[00:13:21] workmad3: has joined #RubyOnRails
[00:25:24] FooMunki: has joined #RubyOnRails
[00:31:33] irishfromua: has joined #RubyOnRails
[00:46:44] weaksauce: has joined #RubyOnRails
[00:52:18] jarray52: has joined #RubyOnRails
[01:05:05] sevensidedmarble: has joined #RubyOnRails
[01:06:59] cagomez: has joined #RubyOnRails
[01:07:48] cagomez: has joined #RubyOnRails
[01:08:24] cagomez: has joined #RubyOnRails
[01:22:21] ResidentBiscuit: has joined #RubyOnRails
[01:55:49] s2013: has joined #RubyOnRails
[02:00:25] dnewkerk: has joined #RubyOnRails
[02:14:06] workmad3: has joined #RubyOnRails
[02:17:43] kapil___: has joined #RubyOnRails
[02:31:08] Radar: GOOD AFTERNOON
[02:43:38] Technodrome: has joined #RubyOnRails
[02:46:42] workmad3: has joined #RubyOnRails
[03:10:46] harrycs: has joined #RubyOnRails
[03:17:08] cagmz_: has joined #RubyOnRails
[03:26:34] truenito: has joined #RubyOnRails
[03:42:49] s2013: has joined #RubyOnRails
[03:46:11] jphase: has joined #RubyOnRails
[03:55:40] dblessing: has joined #RubyOnRails
[03:57:54] elcontrastador: has joined #RubyOnRails
[03:58:05] orbyt_: has joined #RubyOnRails
[04:06:26] srinidhi: has joined #RubyOnRails
[04:14:56] jarray52: has left #RubyOnRails: ()
[04:23:00] uksio: has joined #RubyOnRails
[04:27:43] conta: has joined #RubyOnRails
[04:46:42] Chernobuk: has joined #RubyOnRails
[04:47:30] workmad3: has joined #RubyOnRails
[05:02:40] elcontrastador: has joined #RubyOnRails
[05:26:08] hive-mind: has joined #RubyOnRails
[05:33:42] bga57: has joined #RubyOnRails
[05:36:49] ur5us: has joined #RubyOnRails
[05:43:43] timdotrb: has joined #RubyOnRails
[05:45:23] timdotrb: has joined #RubyOnRails
[06:12:47] jphase: has joined #RubyOnRails
[06:20:06] bob14: has joined #RubyOnRails
[06:21:47] dionysus69: has joined #RubyOnRails
[06:23:05] conta1: has joined #RubyOnRails
[06:48:10] workmad3: has joined #RubyOnRails
[06:59:21] srinidhi: has joined #RubyOnRails
[07:06:06] solars: has joined #RubyOnRails
[07:06:28] truenito: has joined #RubyOnRails
[07:06:35] 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?
[07:10:33] kies: has joined #RubyOnRails
[07:16:38] DrYockel: has joined #RubyOnRails
[07:23:09] rgr: has joined #RubyOnRails
[07:24:13] DoubleMalt: has joined #RubyOnRails
[07:34:48] fmcgeough: has joined #RubyOnRails
[07:48:31] dminuoso: solars: Please refrain from using .execute, use .exec_query instead.
[07:48:49] dminuoso: This is unrelated to your problem though.
[07:49:37] solars: dminuoso: what is the difference between the two?
[07:49:56] dminuoso: solars: .execute is a low level primitive that may leak memory from result objects, exec_query is automatically memory managed.
[07:50:54] solars: ah, good to know, thank you!
[07:51:27] solars: still have to find a way to map to the correct types
[07:51:44] solars: the mysql driver seems to have done this automatically
[07:58:59] arBmind: has joined #RubyOnRails
[08:02:05] roshanavand: has joined #RubyOnRails
[08:06:42] dminuoso: solars: From what I can tell, it appears like select_all is actually what you are looking for.
[08:07:09] gusrub: has joined #RubyOnRails
[08:07:48] dminuoso: solars: The reason it works, is because select_all returns ActiveRecord::Result, rather than database specific output.
[08:10:18] dminuoso: (And that will automatically determine how to convert values into Ruby specific types)
[08:10:22] fumk: has joined #RubyOnRails
[08:11:12] solars: has joined #RubyOnRails
[08:12:05] hammer065: has joined #RubyOnRails
[08:21:32] xhoy: hi, yesterday we looked at ActiveSupport::Notifications and the implementation doesn't realy feel 'railsisch' unpolished almost
[08:21:55] tbuehlmann: xhoy: what does that mean?
[08:22:01] xhoy: well for example
[08:22:29] xhoy: you need to preload all models to load all lisners
[08:22:32] xhoy: liseners
[08:22:39] xhoy: in development
[08:22:49] xhoy: and unsubscribe when reloading
[08:23:12] xhoy: i remembered in rails 3 (or 4?) we had observers that kinda seem to do the same thing
[08:23:54] xhoy: is notifications the way to go for implementing this kind of behavior
[08:24:14] xhoy: (and i know there are good reasons that it works the way it works so that is not the issue)
[08:24:25] xhoy: but the current callback implementation is *REALY* good :)
[08:25:51] tbuehlmann: I don't get it
[08:25:54] tbuehlmann: what is it you want to do?
[08:26:09] xhoy: just some pub-sub stuff
[08:26:17] xhoy: trigger some event when something happens
[08:27:03] tbuehlmann: are these on-time definitions or do you change subscribers a lot?
[08:27:27] xhoy: except in development offcourse :)
[08:28:14] xhoy: the problem is mostly in development and testing
[08:28:39] xhoy: (where the elegance of the solution is lost and lost of stuff needs to be 'fixed' )
[08:29:53] tbuehlmann: do you have an example?
[08:29:56] xhoy: s/lost and lost of/lost and lot off
[08:30:08] xhoy: well for example you need to eagerload all your classes
[08:30:36] xhoy: or on reload you need to unsubscribe from old objects so you dont have 2 or 3 subscribtions on the samen thing
[08:31:10] xhoy: it looks like it notifications could just be a different kind of callback but the implementation is different
[08:32:03] xhoy: let me rephrase my question, IF objectA.save is triggerd it would be nice if ObjectB did something
[08:32:38] xhoy: and there are getting more and more of these situations . that we currently solve with callback's and delayed jobs
[08:32:50] xhoy: Notifications could do some of this aswell
[08:33:02] xhoy: and sometimes better and sometimes not
[08:33:40] xhoy: but if you look at the implementation its easyer to trigger something after_save with a delayed job
[08:33:52] tbuehlmann: I wouldn't use callbacks, I'd use a service/form object, depending on what's needed
[08:34:35] tbuehlmann: or by extending an object so it get's some kind of callback functionality
[08:35:13] xhoy: so notifications is not the (most) obvious way to go and we should look in other directions first?
[08:36:26] tbuehlmann: I wouldn't use them for this, right
[08:36:39] xhoy: i had that feeling :)
[08:36:49] tbuehlmann: if you really want pubsub, I'd have a look at https://github.com/krisleech/wisper
[08:36:59] xhoy: yeah we looked at that
[08:37:12] tbuehlmann: but as said, I'd rather use a service or extend objects
[08:37:18] xhoy: i mean technical an "after_commit" works :)
[08:37:21] tbuehlmann: I've been in callback hell before and I don't like it
[08:37:42] xhoy: its get messy really fast!
[08:37:53] marr: has joined #RubyOnRails
[08:38:48] jan4: has joined #RubyOnRails
[08:45:22] ur5us: has joined #RubyOnRails
[08:48:54] workmad3: has joined #RubyOnRails
[08:54:46] lxsameer: has joined #RubyOnRails
[08:59:00] timdotrb: I’m having an issue with updating a param before saving a model. I have a nested form that uses jquery auto complete on a field. I need an ID for that field, instead of the value that it displays to the user. I’m trying to parse the params before the object is assigned, but the params will not update
[08:59:52] timdotrb: I’ve tried modifying both params and model_params to no avail
[09:31:05] jan41: has joined #RubyOnRails
[09:32:20] jan41: has joined #RubyOnRails
[09:33:26] jan41: has joined #RubyOnRails
[09:45:46] FernandoBasso: has joined #RubyOnRails
[09:52:51] Diabolik: has joined #RubyOnRails
[09:54:13] paranoicsan: has joined #RubyOnRails
[09:56:28] arBmind: has joined #RubyOnRails
[10:06:24] chewed-on: has joined #RubyOnRails
[10:06:39] chewed-on: Hi all, is this the Ruby on Rails channel?
[10:07:07] chewed-on: I am using RVM and each time I run the command "clear && rails test", I get these error messages:
[10:08:18] chewed-on: FIRST ERROR -> /Users/chewedon/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:18: warning: already initialized constant Rails::Command::HELP_MAPPINGS
[10:08:18] chewed-on: SECOND ERROR -> /Users/chewedon/.rvm/gems/ruby-2.3.1@global/gems/railties-5.1.4/lib/rails/command.rb:18: warning: previous definition of HELP_MAPPINGS was here
[10:15:56] Technodrome: has joined #RubyOnRails
[10:16:23] Chernobuk: has joined #RubyOnRails
[10:51:40] Technodrome: has joined #RubyOnRails
[11:02:07] jphase: has joined #RubyOnRails
[11:08:33] ynonp: has joined #RubyOnRails
[11:18:08] arup_r: has joined #RubyOnRails
[11:19:10] apparition: has joined #RubyOnRails
[11:20:58] justrying: has joined #RubyOnRails
[11:41:20] p8m: has joined #RubyOnRails
[11:44:49] alibby: has joined #RubyOnRails
[11:45:01] alibby: has left #RubyOnRails: ()
[11:49:47] tcopeland: has joined #RubyOnRails
[12:00:15] alfiemax: has joined #RubyOnRails
[12:23:05] ShalokShalom_: has joined #RubyOnRails
[12:34:52] keegnotrub: has joined #RubyOnRails
[12:36:31] Technodrome: has joined #RubyOnRails
[12:37:14] Macaveli: has joined #RubyOnRails
[12:57:44] francuz: has joined #RubyOnRails
[12:58:28] jphase: has joined #RubyOnRails
[13:00:11] francuz: hello everyone, I'm trying to install rails on windows for a coworker, and i'm having a problem with stuff like <%= asset_path 'logo_w.png' %> and stylesheet/javascript_include_tags. logically it looks like a path problem but i have no idea how/where to configure it so it works
[13:00:39] Macaveli: has joined #RubyOnRails
[13:00:45] francuz: (it gives me "SyntaxError: Unexpected token: name (context)" when i try to include any stylesheet or asset)
[13:01:24] Macaveli: has joined #RubyOnRails
[13:02:44] francuz: (<%= asset_path('logo_w.png') %> dosen't work either of course)
[13:06:20] mcr1: has joined #RubyOnRails
[13:12:01] francuz: gives me same error when i rails assets:precompile tho,
[13:23:05] NL3limin4t0r: has joined #RubyOnRails
[13:27:57] dminuoso: francuz: Your JavaScript assets get compiled by sprockets using a JavaScript engine - and the error appears to come from that.
[13:29:47] NL3limin4t0r: has joined #RubyOnRails
[13:32:53] rfoust: has joined #RubyOnRails
[13:34:35] francuz: yep, comming from node,
[13:34:42] francuz: updating it to see
[13:41:04] sunrunner20: has joined #RubyOnRails
[13:46:46] fmcgeough: has joined #RubyOnRails
[13:47:42] Sylario: has joined #RubyOnRails
[13:49:50] francuz: updated node made it work... thanks for the help
[13:50:12] dminuoso: francuz: It's likely your uglify plugin choking on invalid JS.
[13:50:27] mcr1: has joined #RubyOnRails
[13:50:38] dminuoso: Are you perhaps trying to use ES6 features?
[13:51:03] francuz: no, but updating node made it work for some reason,
[13:51:05] zehbax: has joined #RubyOnRails
[13:54:03] jtperreault: What's the standard place for setting my sidekiq log level for production? I assume I should add Sidekiq::Logging.logger.level = Logger::WARN to the bottom of my environments/production.rb file as opposed to opening a conditional env check in the sidekiq initializer... thoughts?
[14:00:57] dminuoso: jtperreault: Either way is fine.
[14:03:31] jtperreault: dminuoso: thanks
[14:21:20] ResidentBiscuit: has joined #RubyOnRails
[14:21:45] ResidentBiscuit: has joined #RubyOnRails
[14:24:00] workmad3: has joined #RubyOnRails
[14:27:48] Technodrome: has joined #RubyOnRails
[14:32:22] Skull0in1: has joined #RubyOnRails
[14:45:46] mtkd: has joined #RubyOnRails
[14:57:07] fumk: has joined #RubyOnRails
[15:00:22] gusrub: has joined #RubyOnRails
[15:03:58] Macaveli: has joined #RubyOnRails
[15:04:27] guacamole: has joined #RubyOnRails
[15:09:31] bruno-: has joined #RubyOnRails
[15:12:06] timdotrb: has joined #RubyOnRails
[15:20:06] elcontrastador: has joined #RubyOnRails
[15:23:59] Skull0in1: has left #RubyOnRails: ()
[15:25:58] orbyt_: has joined #RubyOnRails
[15:27:28] cagomez: has joined #RubyOnRails
[15:28:54] harrycs: has joined #RubyOnRails
[15:34:03] jobewan: has joined #RubyOnRails
[15:37:42] xco: has joined #RubyOnRails
[15:38:00] xco: hi. anyone has a good book recommendation on building APIs with Rails?
[15:46:21] xco: has joined #RubyOnRails
[15:48:02] anwarito: has joined #RubyOnRails
[15:49:48] anwarito: Hey y'all. I'm looking to hire an RoR dev for a project. Looking for someone with +3 years experience writing ROR; preferrably in a web application context. Bonus if you're a gamer / have an interest in eSports
[15:50:01] anwarito: hope it's OK to simply ask out loud here and that it doesn't break any rules.
[15:52:09] dionysus69: has joined #RubyOnRails
[15:54:51] xco: has joined #RubyOnRails
[16:01:48] xco: has joined #RubyOnRails
[16:08:02] tbuehlmann: anwarito: out of curiosity, what's your idea about?
[16:11:44] xco: has joined #RubyOnRails
[16:12:51] guacamole: has joined #RubyOnRails
[16:17:50] s2013: has joined #RubyOnRails
[16:22:43] xco: has joined #RubyOnRails
[16:24:38] workmad3: has joined #RubyOnRails
[16:25:36] lacour: has joined #RubyOnRails
[16:32:34] xco: has joined #RubyOnRails
[16:34:50] guacamole: has joined #RubyOnRails
[16:47:52] [Butch]: has joined #RubyOnRails
[16:58:43] nikivi: has joined #RubyOnRails
[17:03:52] one_zero: has joined #RubyOnRails
[17:11:02] guacamole: has joined #RubyOnRails
[17:19:16] blackcross: has joined #RubyOnRails
[17:20:19] hahuang65: has joined #RubyOnRails
[17:22:10] timdotrb: has joined #RubyOnRails
[17:23:17] fschuindt1: has joined #RubyOnRails
[17:32:17] timdotrb_: has joined #RubyOnRails
[17:34:47] jphase: has joined #RubyOnRails
[17:34:47] ivanskie: has joined #RubyOnRails
[17:41:36] kies: has joined #RubyOnRails
[17:42:59] harrycs: has joined #RubyOnRails
[17:44:35] Macaveli: has joined #RubyOnRails
[17:45:52] guacamole: has joined #RubyOnRails
[17:45:58] cagomez: has joined #RubyOnRails
[17:49:18] weaksauce: has joined #RubyOnRails
[18:03:11] ForeignBiscuit: has joined #RubyOnRails
[18:05:15] mostlybadfly: has joined #RubyOnRails
[18:05:30] Technodrome: has joined #RubyOnRails
[18:06:35] JR042444__: has joined #RubyOnRails
[18:11:34] ForeignBiscuit: has joined #RubyOnRails
[18:13:21] ResidentBiscuit: has joined #RubyOnRails
[18:14:35] srinidhi: has joined #RubyOnRails
[18:23:22] Technodrome: has joined #RubyOnRails
[18:25:23] workmad3: has joined #RubyOnRails
[18:37:51] mcr1: has joined #RubyOnRails
[18:41:20] guacamole: has joined #RubyOnRails
[18:44:18] Guest97372: has joined #RubyOnRails
[18:55:48] Technodrome: has joined #RubyOnRails
[18:58:55] arBmind: has joined #RubyOnRails
[19:03:26] justrying: has joined #RubyOnRails
[19:04:15] cagomez: has joined #RubyOnRails
[19:05:25] ResidentBiscuit: has joined #RubyOnRails
[19:09:32] conta: has joined #RubyOnRails
[19:21:59] havenwood: fox_mulder_cp: hi o/
[19:22:03] guacamole: has joined #RubyOnRails
[19:22:44] blackmesa: has joined #RubyOnRails
[19:44:47] jordanm: has joined #RubyOnRails
[19:47:20] hahuang65: has joined #RubyOnRails
[19:50:41] jordanm: I am trying to create a query with activerecord that includes a subselect. I am doing this in an attempt to get rid of an n+1 issue with the previously used `.merge()`. https://gist.github.com/jmetzmeier/9f9883e8e4b1c07329acd88d32e4563e
[19:51:49] jordanm: the link above shows the query I am trying to replicate, as well as my current attempt at solving. Another question is that if I am able to get the proper query to execute, will I still get a proper object for my model?
[19:57:08] UxerUospr: has joined #RubyOnRails
[20:01:23] timdotrb: has joined #RubyOnRails
[20:02:13] gusrub: has joined #RubyOnRails
[20:11:15] matthewd: jordanm: I doubt that's exactly the query you want
[20:11:37] ahrs: has joined #RubyOnRails
[20:12:18] matthewd: The condition looks a bit too tautological
[20:13:33] matthewd: If you just want to add something to the select clause, though, you want to do that with #select (and probably a raw SQL string for the subquery)
[20:14:31] matthewd: jordanm: Depending on what the query is supposed to look like, it sounds like you could be able to use a window function, btw
[20:15:49] jordanm: matthewd: have not heard of those, will take a look
[20:16:42] jordanm: matthewd: the additional query I am trying to eliminate currently looks like this: SELECT MAX("contents"."pubdate") FROM "contents" WHERE "contents"."root_parent_id" = $1
[20:16:47] s2013: has joined #RubyOnRails
[20:17:03] jordanm: I thought folding it into a subselect would be the way to go, but perhaps not
[20:17:55] matthewd: The subselect plan will certainly work... just make sure it's referencing the columns you intend it to
[20:23:23] jordanm: matthewd: using your suggestion of #select and a raw SQL string produced the intended query, but how to access that field in the returned object?
[20:24:27] matthewd: Give it a name with AS, then it should be accessible like any other column
[20:24:53] jordanm: matthewd: ok, thanks for the help
[20:25:41] rtd2: has joined #RubyOnRails
[20:25:51] NL3limin4t0r: Here's the result:
[20:25:53] NL3limin4t0r: sub_query = Content.where(id: 776913).where(latest_activity: Content.where(root_parent_id: 776913).maximum(:pubdate)).to_sql
[20:26:00] NL3limin4t0r: Content.select(Content.attribute_names).select("(#{sub_query}) AS 'max_pubdate").limit(10)
[20:26:09] workmad3: has joined #RubyOnRails
[20:26:41] NL3limin4t0r: I forgot one quote in the select AS, be sure to put it there.
[20:28:41] acosonic: has joined #RubyOnRails
[20:29:40] cagomez: has joined #RubyOnRails
[20:30:05] harrycs: has joined #RubyOnRails
[20:30:29] jordanm: sweet, only 3 more queries to go and they will all have the same solution once I figure one out
[20:42:09] harrycs: I am having a bit of a strange issue while deploying on Heroku with a JS library.
[20:43:19] harrycs: My JS totally works fine on development, but it isn't working in production. I confirmed it is being compiled through the pipeline via the Network tab on the JS console in Chrome, but it just.. doesn't do anything
[20:43:29] harrycs: Anyone have any ideas what could be happening? I'm totally lost on this
[20:47:19] jordanm: harrycs: are there no errors in the console tab?
[20:47:47] jordanm: I don't think my last 3 query problems are actually solvable :/
[20:48:12] harrycs: jordanm: nope, what's really strange is how the console for dev vs prod differs
[20:49:27] harrycs: I can console.log($().fileupload)
[20:49:31] harrycs: oops, typo.
[20:49:54] harrycs: calling console.log($().fileupload) in dev outputs normally, while the same call in prod outputs undefined
[20:49:58] hahuang65: has joined #RubyOnRails
[20:50:19] harrycs: What's strange is that I know it's being loaded on the page due to it coming up in the script on the Network tab
[20:51:04] harrycs: I'm assuming I've messed up compiling the asset pipeline somehow, but i'm not really sure where to start with that since it shows up in Network..
[21:02:23] timdotrb: has joined #RubyOnRails
[21:03:51] Technodrome: has joined #RubyOnRails
[21:09:05] mustmodify: has joined #RubyOnRails
[21:09:12] mustmodify: has left #RubyOnRails: ()
[21:14:48] dviola: has joined #RubyOnRails
[21:15:08] kapil___: has joined #RubyOnRails
[21:15:22] mtkd: has joined #RubyOnRails
[21:16:46] guacamole: has joined #RubyOnRails
[21:27:08] FrostCandy: has joined #RubyOnRails
[21:28:04] harrycs: regarding above, I was being an idiot and didn't properly include Tether! Not sure why Tether is needed for Bootstrap, but.. *shrug*
[21:30:19] FrostCandy: If I go to mysite/emails/1 and my routes show GET /emails/:id(.:format) emails#show, but I have a before_action :mymethod, only [:show], shouldn't it eventually get to the def show method after finishing with the before_action method?
[21:36:10] kus_ubuntui686: has joined #RubyOnRails
[21:39:12] Radar: GOOD MORNING
[21:39:52] jscheel: has joined #RubyOnRails
[21:40:09] justrying: has joined #RubyOnRails
[21:41:07] FrostCandy: nm , it was a cancan authroize issue.
[21:44:46] fugee: has joined #RubyOnRails
[21:46:07] mices: in peerjs how's the recipient supposed to be notified of an incoming call
[21:46:50] Radar: mices: that's not related to rails?
[21:47:12] mices: some of us may use it
[21:47:42] mices: peerjs google group is quiet
[21:54:38] Radar: Seems pretty random to ask in here tbh.
[21:55:03] Radar: intersection of people who use rails and people who use peerjs probably very small
[21:55:26] Radar: In fact, before you mentioned it here today there has been no other mention of "peerjs" EVER in this channel.
[21:55:36] Radar: https://gist.github.com/radar/dba36a5ee6b2fbf0bff971eb4ac61c81
[21:56:18] Radar: That's in 2.8mil messages ever posted to this channel. So... yeah. You're probably not going to get help here with that.
[21:57:21] hive-mind: has joined #RubyOnRails
[22:05:09] orbyt_: has joined #RubyOnRails
[22:12:41] jphase: has joined #RubyOnRails
[22:22:12] hahuang65: has joined #RubyOnRails
[22:26:45] workmad3: has joined #RubyOnRails
[22:38:58] harrycs: has joined #RubyOnRails
[22:47:25] tcopeland: has joined #RubyOnRails
[22:54:00] guacamole: has joined #RubyOnRails
[22:55:27] cagomez: has joined #RubyOnRails
[22:58:50] hahuang65: has joined #RubyOnRails
[23:02:20] jphase: has joined #RubyOnRails
[23:09:38] Technodrome: has joined #RubyOnRails
[23:28:52] hammer065: has joined #RubyOnRails
[23:49:48] ghormoon: has joined #RubyOnRails