« Back to channel list

#RubyOnRails - 22 May 2016

« Back 1 day Forward 1 day »
[00:02:10] Radar: Darmani: In the simple_form_for call.
[00:02:47] benlieb: has joined #RubyOnRails
[00:03:15] Darmani: Radar: No... It's not.
[00:04:23] Darmani: Radar: And now the error's gone..
[00:04:50] Darmani: Radar: I feel dumb.
[00:05:01] Radar: Just check your assumptions :)
[00:05:21] Darmani: Thank you. ^^
[00:11:34] barhum2013: has joined #RubyOnRails
[00:13:15] duncannz: has joined #RubyOnRails
[00:14:51] stannard: has joined #RubyOnRails
[00:14:54] macsteps: has joined #RubyOnRails
[00:19:42] GrizzlyZolam: has joined #RubyOnRails
[00:20:07] kdough: Hi everyone - I'm curious if anyone knows why `self.response_body = nil` before a controller's `render` no longer prevents a `AbstractController::DoubleRenderError` in Rails/Action Pack 5 (incl. latest master). I'm wondering if this is a bug or if there is a new preferred method for prevention. Gist: https://gist.github.com/kdough/c797c25088331ffc275bb2aa6159bde9
[00:20:17] kdough: Works in Rails 4.2.6 but fails in 5+
[00:20:59] Radar: kdough: Because render is checking if response_body has been set, I guess?
[00:21:45] kdough: `performed?` still appears to hold onto the old response_body even after setting it to nil before the second render
[00:22:05] kdough: My issue stems from rendering being done via after_action callbacks following the controller action itself rendering something. I simply want to drop the previously-rendered response body and render the new content.
[00:23:18] jancel: has joined #RubyOnRails
[00:23:23] Radar: kdough: I would suggest filing an issue about it.
[00:23:41] kdough: Sounds good. Thanks, Radar!
[00:28:19] crystal77: has joined #RubyOnRails
[00:37:24] crdpink: has joined #RubyOnRails
[00:37:54] gambl0re: has joined #RubyOnRails
[00:42:58] wldcordeiro: has joined #RubyOnRails
[00:47:54] running_rails: has joined #RubyOnRails
[00:48:35] shortCircuit__: has joined #RubyOnRails
[00:49:18] shortCircuit__: hi anyone there!!
[00:55:08] jenrzzz: has joined #RubyOnRails
[00:59:46] quazimodo: has joined #RubyOnRails
[01:01:24] pawnbox: has joined #RubyOnRails
[01:11:56] roamingdog: has joined #RubyOnRails
[01:13:04] kristofferR: has joined #RubyOnRails
[01:19:37] roamingdog: has joined #RubyOnRails
[01:22:13] macsteps: has joined #RubyOnRails
[01:27:46] agent_white: has joined #RubyOnRails
[01:28:44] roamingdog: has joined #RubyOnRails
[01:33:01] SteenJobs: has joined #RubyOnRails
[01:33:22] alexhartley: has joined #RubyOnRails
[01:37:53] one_zero: has joined #RubyOnRails
[01:39:40] AmiMoench: has joined #RubyOnRails
[01:43:54] Radar: Multitenancy with Rails 2nd edition is now content complete. Here's a coupon code to get 50% off: https://leanpub.com/multi-tenancy-rails-2/c/fin
[01:46:54] agent_white: Radar: Congrats!
[01:46:58] jancel: has joined #RubyOnRails
[01:49:32] maxx88: has joined #RubyOnRails
[01:50:49] Puffball: has joined #RubyOnRails
[01:51:09] Radar: Thank you!
[01:51:53] pwnd_nsfw: Radar, do you actually make 8.50 for a $10 purchase?
[01:51:58] Radar: pwnd_nsfw: yup
[01:52:03] Radar: pwnd_nsfw: With Manning that would be about $2.50
[01:52:13] pwnd_nsfw: Yeah, that's what I figured
[01:52:16] Radar: Oh no that's wrong... I think it's more like $1.50
[01:52:37] Radar: I make $8.50 and then the tax office takes away 30 something percent of that :P
[01:53:03] pwnd_nsfw: Still better than manning, I presume
[01:54:20] Radar: Yes: http://ryanbigg.com/2015/08/my-self-publishing-success-story/#royalties
[01:55:21] Radar: TL;DR: On Leanpub I get about 88% of the price (before tax) and the authors on Manning get about 31%... which is currently split 70/30 me/sevenseacat
[01:55:43] Radar: I should really update those graphs but I've lost the source of them.
[01:55:43] pwnd_nsfw: How do the sales compare?
[01:55:54] pwnd_nsfw: I feel leanpub is probably more of a self-promoting thing? I really don't know though.
[01:56:12] Radar: MTWR (both editions) have sold about 2.5k copies.
[01:56:22] Radar: I'll have to dig in my inbox for the R*IA royalty reports
[01:56:30] xlegoman: has joined #RubyOnRails
[01:56:38] Radar: Rails 3 in Action sold 4,323 copies.
[01:56:56] Radar: Rails 4 in action sold 2,766 copies.
[01:57:32] Radar: So yeah, Rails 4 in Action has sold about the same as MTWR.
[01:57:51] roamingdog: has joined #RubyOnRails
[01:58:33] idefine: has joined #RubyOnRails
[01:58:45] Radar: Latest sales data I have for R4IA is at the end of march. I'd expect those numbers to be a couple of hundred higher by now
[02:00:41] pwnd_nsfw: Too bad R4IA wasn't on leanpub
[02:00:54] pwnd_nsfw: leanpub is pretty sweet too because
[02:01:01] pwnd_nsfw: you can specify how much you'd like to pay
[02:01:05] pwnd_nsfw: To support the writer(s)
[02:02:24] pipework: Radar: I'm working on a self-publishing system for https://sugarglide.rs/ right now.
[02:02:39] pipework: It's built on top of gitbook.
[02:02:41] pwnd_nsfw: wow that site is gr8 pipework
[02:02:59] pipework: pwnd_nsfw: there's not a lot because I'm playing with stuff at another website.
[02:04:36] prgmmr: has joined #RubyOnRails
[02:10:06] unreal: has joined #RubyOnRails
[02:11:13] Puffball: has joined #RubyOnRails
[02:13:59] yfeldblum: has joined #RubyOnRails
[02:15:20] sdwrage: has joined #RubyOnRails
[02:18:22] sdwrage: has joined #RubyOnRails
[02:18:34] asheinfeld: has joined #RubyOnRails
[02:20:45] Guest47468: has joined #RubyOnRails
[02:40:27] Puffball: has joined #RubyOnRails
[02:43:51] benlieb: has joined #RubyOnRails
[02:44:03] agent_white: Radar: Purchased :) Can't wait to dive into yer book.
[02:44:07] Radar: agent_white: thank you :)
[02:48:35] Alazoral: has joined #RubyOnRails
[02:48:42] running_rails: has joined #RubyOnRails
[02:48:44] konsolebox: has joined #RubyOnRails
[02:51:29] bklane: has joined #RubyOnRails
[02:51:40] Puffball: has joined #RubyOnRails
[02:53:15] bklane: Can I access an instance attributes when defining a relation? code sample: https://gist.github.com/barnett/dd48abc599e3f8d4259fa6ff8470400e
[02:54:37] sypheren: has joined #RubyOnRails
[02:56:26] blackmesa: has joined #RubyOnRails
[02:57:47] Megamos: has joined #RubyOnRails
[03:04:52] Puffball: has joined #RubyOnRails
[03:09:19] strat0cat: has joined #RubyOnRails
[03:09:25] bronson: has joined #RubyOnRails
[03:18:36] Puffball: has joined #RubyOnRails
[03:21:40] braincrash: has joined #RubyOnRails
[03:24:30] FooBarWidget: has joined #RubyOnRails
[03:27:59] Puffball: has joined #RubyOnRails
[03:28:27] pawnbox: has joined #RubyOnRails
[03:29:50] DZj091231kld: has joined #RubyOnRails
[03:31:50] diegoaguilar: has joined #RubyOnRails
[03:33:43] ereslibre: has joined #RubyOnRails
[03:34:46] alexhartley: has joined #RubyOnRails
[03:34:58] jancel: has joined #RubyOnRails
[03:38:54] beauby: has joined #RubyOnRails
[03:49:21] pawnbox: has joined #RubyOnRails
[03:57:24] stannard: has joined #RubyOnRails
[03:58:30] blackmesa: has joined #RubyOnRails
[04:00:27] k3rn31: has joined #RubyOnRails
[04:11:17] bronson: has joined #RubyOnRails
[04:11:49] benlieb: has joined #RubyOnRails
[04:12:33] jancel: has joined #RubyOnRails
[04:12:53] wldcordeiro: has joined #RubyOnRails
[04:15:19] cabinB: has joined #RubyOnRails
[04:15:27] quazimodo: has joined #RubyOnRails
[04:17:14] mikeric: has joined #RubyOnRails
[04:23:52] queequeg1: has joined #RubyOnRails
[04:25:53] barhum2013: has joined #RubyOnRails
[04:32:19] barhum2013: has joined #RubyOnRails
[04:32:42] _3dwardsharp: has joined #RubyOnRails
[04:33:42] sevenseacat: has joined #RubyOnRails
[04:35:31] _3dwardsharp: so, i've got a gem that has activemerchant ~> 1.47.0, but i need to use 1.59.0. i tried to add the dependency to my Gemfile but get this error from bundler "The bundle currently has activemerchant locked at 1.47.0."
[04:37:29] sumobob: has joined #RubyOnRails
[04:38:14] der-landgraf: has joined #RubyOnRails
[04:38:14] der-landgraf: has joined #RubyOnRails
[04:39:38] chopin: has joined #RubyOnRails
[04:42:21] barhum2013: has joined #RubyOnRails
[04:42:43] jancel: has joined #RubyOnRails
[04:49:31] running_rails: has joined #RubyOnRails
[04:49:42] jancel: has joined #RubyOnRails
[04:53:06] barhum2013: has joined #RubyOnRails
[04:56:12] kristofferR: has joined #RubyOnRails
[04:59:30] blackmesa: has joined #RubyOnRails
[05:03:02] Puffball: has joined #RubyOnRails
[05:16:37] rickmasta: has joined #RubyOnRails
[05:17:08] indianowl: has joined #RubyOnRails
[05:24:17] barhum2013: has joined #RubyOnRails
[05:24:49] bronson: has joined #RubyOnRails
[05:27:31] sevenseacat: if you can't update that gem to use the version of AM you need, then you can't use it
[05:30:31] alfie_max15: sevenseacat, isn't the `The bundle currently has activemerchant locked` message caused because it's locked in the Gemfile.lock ?
[05:30:55] alfie_max15: shouldn't a bundle update or deleting the Gemfile.lock fix that?
[05:31:09] sevenseacat: don't delete the Gemfile.lock, ever, for starters
[05:31:32] sevenseacat: it won't fix it because they have a gem requiring ~> 1.47.0
[05:31:36] sevenseacat: that does not match 1.59.0
[05:35:23] matt_d: hi indianowl
[05:35:28] indianowl: need help in regard to nested form
[05:35:37] alexhartley: has joined #RubyOnRails
[05:35:47] indianowl: http://pastie.org/10847367
[05:35:59] indianowl: I am newbie in ror
[05:36:58] indianowl: My problem controller is unable to save the question entry
[05:37:17] indianowl: though I am getting the field in params parameter
[05:37:18] alfie_max15: indianowl, is the form in the pastie complete?
[05:37:29] barhum2013: has joined #RubyOnRails
[05:37:48] alfie_max15: i see `p.text_area` but where is the form object `p` defined?
[05:38:12] indianowl: let me copy the complete form in pastie
[05:39:13] GarethAdams: indianowl: you have `Problem :has_one :question` and `Question has_one :problem`. One of those is probably wrong
[05:39:41] GarethAdams: One of those should almost certainly be a belongs_to
[05:41:07] matt_d: indianowl: did you not paste all the contents of your code? a lot appears to be missing. could you please use gist when you paste the complete code?
[05:41:35] indianowl: http://pastie.org/10847371
[05:42:26] indianowl: they are in different file ...
[05:42:36] indianowl: let me copy it all
[05:42:53] pawnbox: has joined #RubyOnRails
[05:43:07] matt_d: indianowl: thats why gist is a lot easier
[05:43:23] matt_d: indianowl: https://gist.github.com
[05:46:02] indianowl: https://gist.github.com/abuzarhamza/17dc93503402871dc14ea42b3dfcd9bc
[05:47:22] matt_d: gist allows you to post multiple files, so you don't have to paste a mess like that hehe
[05:47:34] matt_d: for one, you have no class definition for your controller
[05:47:38] matt_d: or did you leave that out?
[05:47:49] indianowl: i did leave out
[05:48:57] indianowl: i was following the tutorial http://www.amooma.de/screencasts/2015-01-22-nested_forms-rails-4.2/
[05:50:43] sypheren: has joined #RubyOnRails
[05:53:28] moeabdol: has joined #RubyOnRails
[05:53:36] indianowl: @GarethAdams thann you
[05:56:38] blackhuey: has joined #RubyOnRails
[05:58:54] stannard: has joined #RubyOnRails
[05:59:18] indianowl: any other suggestion ?
[05:59:18] agent_white: has joined #RubyOnRails
[06:00:17] blackmesa: has joined #RubyOnRails
[06:00:20] alfie_max15: indianowl, shouldn't it be `p.fields_for` ?
[06:00:48] sevenseacat: alfie_max15 wins the prize
[06:02:19] diegoaguilar: has joined #RubyOnRails
[06:04:03] indianowl: @alfie_max15 thank you
[06:08:04] apotry: has joined #RubyOnRails
[06:14:46] indianowl: one more question Do I need to make change in create in problem controller
[06:15:11] indianowl: "def create"*
[06:15:40] alfie_max15: why? isn't it working?
[06:16:30] sevenseacat: 'it doesnt work' isnt something I would offer any kind of help about, with no other information
[06:17:37] alfie_max15: yeah, indianowl could you be more specific about the issue/error you are facing?
[06:17:51] indianowl: I can see the param the values in controller in binding pry
[06:18:05] indianowl: but its not getting saved
[06:18:06] alfie_max15: could you show a sample maybe?
[06:18:17] indianowl: let me share the log
[06:18:27] indianowl: in another gist
[06:18:55] ensyde: has joined #RubyOnRails
[06:19:48] wldcordeiro: has joined #RubyOnRails
[06:25:08] indianowl: https://gist.github.com/abuzarhamza/0356d0eb966f2a93df12fc89e8c93f70
[06:25:49] indianowl: no data is getting saved into question table when controller "create" is being called
[06:26:15] sevenseacat: https://gist.github.com/abuzarhamza/0356d0eb966f2a93df12fc89e8c93f70#file-gistfile1-txt-L5
[06:28:12] indianowl: thanks @sevenseacat
[06:31:30] indianowl: I have added in "Problem" model accepts_nested_attributes_for :question
[06:31:48] sevenseacat: that doesnt address the problem of unpermitted attributes
[06:32:08] sevenseacat: http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters
[06:35:34] indianowl: i suppose I have given the permission in " def problem_param" in problem controller
[06:37:41] sevenseacat: you need to do that, yes. you have not.
[06:48:04] zyzioziom: has joined #RubyOnRails
[06:50:07] Oog: has joined #RubyOnRails
[06:50:09] indianowl: @thank sevenseacat :)
[06:50:26] running_rails: has joined #RubyOnRails
[06:51:36] zpe: has joined #RubyOnRails
[06:53:37] zyzioziom: has joined #RubyOnRails
[06:54:04] neanderslob: has joined #RubyOnRails
[06:58:22] janebootydoe: has joined #RubyOnRails
[06:59:09] Hyuk: has joined #RubyOnRails
[07:01:19] blackmesa: has joined #RubyOnRails
[07:04:24] Dimik: has joined #RubyOnRails
[07:05:33] Cohedrin_: has joined #RubyOnRails
[07:05:51] zyzioziom1: has joined #RubyOnRails
[07:06:00] andywww: has joined #RubyOnRails
[07:08:03] tildes: has joined #RubyOnRails
[07:09:01] Oog: https://gist.github.com/anonymous/fe9ee54bb44afe2c678126b7b9b05d30
[07:09:56] Oog: ERROR: subquery uses ungrouped column "price_lines.created_at" from outer query
[07:10:52] Cohedrin: has joined #RubyOnRails
[07:15:18] Puffball: has joined #RubyOnRails
[07:15:21] mikeric: has joined #RubyOnRails
[07:15:23] artemaminov: has joined #RubyOnRails
[07:17:21] artemaminov: has left #RubyOnRails: ()
[07:25:12] bronson: has joined #RubyOnRails
[07:25:38] Puffball: has joined #RubyOnRails
[07:25:57] rickmasta: has joined #RubyOnRails
[07:26:42] workmad3: has joined #RubyOnRails
[07:29:14] FCser: has joined #RubyOnRails
[07:30:04] pawnbox: has joined #RubyOnRails
[07:30:54] barhum2013: has joined #RubyOnRails
[07:31:07] ql6wlld: has joined #RubyOnRails
[07:36:05] barhum2013: has joined #RubyOnRails
[07:36:13] njero: has joined #RubyOnRails
[07:38:47] arBmind: has joined #RubyOnRails
[07:39:13] p1k: so if you have a GemSpec with a 'TODO' in one of the out generated fields
[07:39:27] p1k: rails refuses to run commands e.g. rails g model article will fail
[07:39:33] p1k: isn't that rather extreme?
[07:40:19] p1k: (it goes through .gem/ruby/2.2.4/gems/bundler-1.12.4/lib/bundler/rubygems_integration.rb #validate)
[07:42:15] sevenseacat: i dont think so
[07:44:51] stardiviner: has joined #RubyOnRails
[07:45:09] p1k: sevenseacat: you think I shouldn't be able to rails g model 'my_model' because my gemspec.description has 'TODO' in it?
[07:45:46] sevenseacat: I think its a very big indicator that the gem is unfinished and should not be used
[07:45:57] p1k: sevenseacat: are you even reading what I'm saying?
[07:46:05] sevenseacat: so you are prevented from using it
[07:46:12] p1k: if you're writing a a *new gem* I can't generate a model *inside it*
[07:46:23] p1k: because the description has TODO in it
[07:46:37] p1k: which you know, you would normally add after you've written the gem..
[07:47:57] Puffball: has joined #RubyOnRails
[07:49:56] sevenseacat: thats not what you said before
[07:50:54] p1k: sevenseacat: I said if you have a gemspec with a 'TODO' rails g model <model> will faill - maybe I should have been explicit about this being inside of the project which includes the gemspec
[07:51:00] p1k: rather than a project requiring it
[07:51:27] jenrzzz: has joined #RubyOnRails
[07:51:27] jenrzzz: has joined #RubyOnRails
[07:53:41] Puffball_: has joined #RubyOnRails
[08:00:46] giom: has joined #RubyOnRails
[08:01:32] stannard: has joined #RubyOnRails
[08:02:32] blackmesa: has joined #RubyOnRails
[08:11:15] pawnbox: has joined #RubyOnRails
[08:14:55] darutoko: has joined #RubyOnRails
[08:17:45] Devalo: has joined #RubyOnRails
[08:26:42] antgel: has joined #RubyOnRails
[08:29:52] mikecmpbll: has joined #RubyOnRails
[08:32:04] pawnbox: has joined #RubyOnRails
[08:35:16] antgel: has joined #RubyOnRails
[08:42:23] ql6wlld_: has joined #RubyOnRails
[08:46:14] mdw: has joined #RubyOnRails
[08:47:23] blackmesa: has joined #RubyOnRails
[08:51:05] running_rails: has joined #RubyOnRails
[08:53:13] alfie_max15: has joined #RubyOnRails
[08:59:39] p1k: so rails new plugin --mountable generates a Rakefile which depends on a lot of files which are not generated
[09:04:20] ur5us: has joined #RubyOnRails
[09:05:26] nofxx: has joined #RubyOnRails
[09:06:30] workmad3: has joined #RubyOnRails
[09:10:24] roamingdog: has joined #RubyOnRails
[09:10:35] Weavel: has joined #RubyOnRails
[09:12:51] pawnbox: has joined #RubyOnRails
[09:12:57] moeabdol: has joined #RubyOnRails
[09:14:26] gareth_: has joined #RubyOnRails
[09:15:12] GarethAdams: has joined #RubyOnRails
[09:17:47] AzaToth: has joined #RubyOnRails
[09:18:13] roamingdog: has joined #RubyOnRails
[09:18:28] Haydos: has joined #RubyOnRails
[09:20:18] pawnbox: has joined #RubyOnRails
[09:20:58] DaniG2k: has joined #RubyOnRails
[09:21:39] Haydos: has joined #RubyOnRails
[09:22:44] user: has joined #RubyOnRails
[09:23:13] DaniG2k: hello all. I have a state model with some code that I was told can incur in a potential race condition. I thought I'd fixed it by using an ActiveRecord lock but was told that this would introduce new bugs
[09:23:21] DaniG2k: can someone have a quick look please?
[09:23:23] DaniG2k: https://gist.github.com/DaniG2k/a10e5447af67aeae623c362ca84107e8
[09:23:26] DaniG2k: state_old.rb
[09:23:37] DaniG2k: is the original one with the race condition in the make_default! method
[09:23:40] nofxx: has joined #RubyOnRails
[09:23:42] DaniG2k: whereas state.rb
[09:23:49] DaniG2k: is the one with ActiveRecord locks
[09:23:54] nofxx: has joined #RubyOnRails
[09:24:21] DaniG2k: I'm not sure what bugs I'd be introducing
[09:24:41] DaniG2k: the only thing I can think of is that others = State.where.not(id: id).lock(true).first will essentially lock all the records temporarily
[09:25:06] DoubleMalt: has joined #RubyOnRails
[09:26:16] Haydos: has joined #RubyOnRails
[09:26:31] srinidhi: has joined #RubyOnRails
[09:26:59] bronson: has joined #RubyOnRails
[09:28:11] shinnya: has joined #RubyOnRails
[09:30:49] BUTTERFLYFX: has joined #RubyOnRails
[09:36:59] Depili: depends on the DB used, mysql will almost always lock up everything and thus deadlock queries...
[09:37:03] alexhartley: has joined #RubyOnRails
[09:38:02] workmad3: has joined #RubyOnRails
[09:39:00] DaniG2k: Depili: postgres
[09:39:56] Depili: pg at least is quite intelligent with the locks
[09:41:46] roamingdog: DaniG2k: does "others = State.where.not(id: id).lock(true).first" return just one state though?
[09:44:37] DaniG2k: roamingdog: they should all be set to false
[09:44:41] DaniG2k: except for one
[09:44:44] DaniG2k: which is set to true
[09:44:52] DaniG2k: I posted my full question here http://stackoverflow.com/questions/37372721/how-to-fix-and-test-a-race-condition-in-my-rails-4-model
[09:45:21] DaniG2k: all false except for `self` which should be true
[09:45:57] DaniG2k: and also, how the heck do I test this in RSpec since....I can't really multithread and let the two requests happen contemporaneously
[09:46:19] roamingdog: DaniG2k: ja, just what i was thinking - how to test
[09:46:59] roamingdog: sorry if misunderstanding, but i meant shouldn't it be "others = State.where.not(id: id).lock(true)" (no first)
[09:48:20] DaniG2k: roamingdog: the first is necessary because `.where` returns an array I believe
[09:48:39] DaniG2k: so it's just like popping that using [0] or `.shift`
[09:48:40] roamingdog: DaniG2k: thought you wanted an array (others is plural)
[09:48:55] DaniG2k: nah I want the ActiveRecord objects :P
[09:49:00] tbuehlmann: rails 5, what are you doing? :'(
[09:49:06] tbuehlmann: HashWithIndifferentAccess.new(ActionController::Parameters.new(foo: 'bar'))[:foo] # => #<ActionController::Parameters>
[09:50:01] jhass: tbuehlmann: probably adhering to Hash's interface and so it becomes the default value?
[09:50:22] jhass: seems to make sense
[09:50:55] matthewd: tbuehlmann: What do you expect that to do?
[09:50:59] tbuehlmann: AC::Parameters doesn't inherit from Hash anymore, right?
[09:51:13] tbuehlmann: I expected it to return 'bar', as it was in rails 4.2
[09:52:51] jhass: just call .to_h ?
[09:54:06] workmad3: has joined #RubyOnRails
[09:54:36] alfie_max15: has joined #RubyOnRails
[09:55:18] tbuehlmann: ActionController::Parameters.new(foo: 'bar').to_h[:foo] # => nil
[09:55:44] matthewd: tbuehlmann: I'm a little perplexed that one would ever have written the HWIA.new(..) form in 4.2 to begin with
[09:56:00] matthewd: You want to_unsafe_h
[09:56:23] matthewd: (or `.permit(:foo).to_h`)
[09:56:29] tbuehlmann: seems so, right. well, in 4.2 I haven't had the problem
[09:58:19] neanderslob: has joined #RubyOnRails
[10:00:00] matthewd: tbuehlmann: Can you expand on how you ended up doing HashWithIndifferentAccess.new(ActionController::Parameters.new(foo: 'bar'))[:foo] instead of, say, ActionController::Parameters.new(foo: 'bar')[:foo] ?
[10:01:15] matthewd: I'm trying to understand whether this is an API quirk people just need to be wary of, or a bug to be fixed
[10:02:00] tbuehlmann: yeah, checking the code right now
[10:03:07] stannard: has joined #RubyOnRails
[10:04:19] chipotle: has joined #RubyOnRails
[10:11:04] tbuehlmann: I'm writing a relation filtering library and getting an AC::P object as input. as I'm not relying on AC::P's permission API, I coerce the input into an HWIA (because unpermitted AC::P objects aren't allowed in AR::B.new/.create/.where). in rails 5, I'm getting a deprecation warning for AC:P#with_indifferent_access, so I gave HWIA.new(params) a go. which doesn't work, as described above.
[10:11:04] tbuehlmann: using #to_unsafe_hash will do, however. and I just saw that I already used that somewhere else in that project
[10:12:04] neanderslob: has joined #RubyOnRails
[10:15:40] matthewd: I would've thought it'd be up to your caller to pre-permit the AC::P... the "unsafe" in to_unsafe_hash isn't just for decoration, after all :)
[10:16:40] zyzioziom: has joined #RubyOnRails
[10:18:16] alfie_max15: has joined #RubyOnRails
[10:20:49] tbuehlmann: I'm trying to accept any hash-like object as the library doesn't have to be used in a controller setting, on the other side I don't want to burden the user with permitting params
[10:21:35] tbuehlmann: but I'm confident about handling the input sensible, so to_unsafe_hash might just work
[10:21:40] tbuehlmann: (last words (tm))
[10:26:20] quazimodo: has joined #RubyOnRails
[10:26:30] Palsson: has joined #RubyOnRails
[10:28:34] shinnya: has joined #RubyOnRails
[10:34:18] kgrz: has joined #RubyOnRails
[10:37:41] zyzioziom1: has joined #RubyOnRails
[10:40:25] jgt: has joined #RubyOnRails
[10:42:50] nclbr: has joined #RubyOnRails
[10:43:20] adgtl: has joined #RubyOnRails
[10:48:44] petor: has joined #RubyOnRails
[10:51:52] running_rails: has joined #RubyOnRails
[10:55:03] y2mq37: has joined #RubyOnRails
[11:04:49] Pazician: has joined #RubyOnRails
[11:04:49] Pazician: has joined #RubyOnRails
[11:06:01] zpe: has joined #RubyOnRails
[11:06:40] dionysus69: has joined #RubyOnRails
[11:14:37] DaniG2k: has joined #RubyOnRails
[11:16:19] DaniG2k: Someone rightly pointed out that I had a method called make_default! which could cause a potential race condition. I modified the code but then but someone pointed out that this could cause other potential bugs. I'm wondering what the best way to implement database locks would be, as well as how I'd go about testing the model spec
[11:16:26] workmad3: has joined #RubyOnRails
[11:16:31] DaniG2k: here's my question in full on StackOverflow: http://stackoverflow.com/questions/37372721/how-to-fix-and-test-a-race-condition-in-my-rails-4-model/37372966#37372966
[11:18:37] DaniG2k: im not sure I understand how to implement the suggestions workaround to be honest
[11:18:43] DaniG2k: or if it's a good solution to this problem
[11:20:31] moeabdol: has joined #RubyOnRails
[11:22:03] tbuehlmann: DaniG2k: I'm having a hard time understanding and using database locking correctly, so I sometimes just use https://github.com/heroku/pg_lock in order to get an advisory lock and that's it
[11:28:17] zyzioziom: has joined #RubyOnRails
[11:29:31] DaniG2k: tbuehlmann: isn't that what ActiveRecord's lock method is for?
[11:29:32] DaniG2k: http://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html
[11:30:10] tbuehlmann: no, these are different things, although similar
[11:37:35] DaniG2k: tbuehlmann: oh? what's the difference?
[11:38:03] alexhartley: has joined #RubyOnRails
[11:38:11] tbuehlmann: do you know what a mutex is?
[11:39:36] tbuehlmann: pg_lock or the advisory lock is similar to a mutex, it allows just one process to aquire the lock and execute some code. other processes have to wait for the lock to be available again
[11:40:06] tbuehlmann: when your application works with several processes or threads you can save them from running the same code at the same time
[11:40:14] srinidhi: has joined #RubyOnRails
[11:40:34] tbuehlmann: this will not save you from race conditions when other processes or application work with the database
[11:40:50] tbuehlmann: but it works when you just have this one application
[11:41:34] dsf: has joined #RubyOnRails
[11:41:36] DaniG2k: but ActiveRecord's should create a lock at the database level
[11:42:11] DaniG2k: it locks a row in the db
[11:42:48] tbuehlmann: just to be clear: pg_lock also creates a lock at the database level, that's what makes it work across processes
[11:43:05] stardiviner: has joined #RubyOnRails
[11:43:14] mercerist: has joined #RubyOnRails
[11:44:01] DaniG2k: tbuehlmann: how do you test using PgLock though
[11:44:17] tbuehlmann: what do you mean?
[11:44:18] DaniG2k: is it possible to write such a test in RSpec?
[11:44:26] DaniG2k: like, say I use PgLock
[11:44:45] DaniG2k: is there a way I can create a model spec test that ensures these get locked?
[11:46:05] tbuehlmann: not sure I understand. do you want to test that pg_lock actually works?
[11:46:22] DaniG2k: essentially, yes
[11:46:28] DaniG2k: or that my code would work if I use PgLock
[11:50:09] tbuehlmann: I wouldn't test pg_lock itself, that's not your task. testing the code that uses it, well, maybe. having two threads working against each other using sleeps to exactly time the critical code parts would be one option. having n threads working against each other without sleeps could also work. but I think I wouldn't test it at all
[11:50:48] c355E3B: has joined #RubyOnRails
[11:51:13] taxen: has joined #RubyOnRails
[11:52:34] taxen: Hello everyone. I have a model that are referencing another model in two attributes (new_product_id, old_product_id). How can I validate and make sure you can't select the same product id?
[11:53:49] tbuehlmann: taxen: you would write a custom validation
[11:54:09] tbuehlmann: see http://guides.rubyonrails.org/active_record_validations.html#performing-custom-validations
[11:54:23] taxen: tbuehlmann: I was fearing that (never done it before). Isn't there a way to use validates_uniqueness_of though?
[11:54:58] tbuehlmann: I might have misunderstood you. do you want to validate that new_product_id is not the same as old_product_id?
[11:57:14] beauby: has joined #RubyOnRails
[11:58:28] kgrz: has joined #RubyOnRails
[12:00:31] taxen: tbuehlmann: yeah, so this "Group" model has two attributes; old_product_id and new_old_id - just need those two to be different from each other
[12:01:05] dsf: has joined #RubyOnRails
[12:03:01] workmad3: has joined #RubyOnRails
[12:03:47] tbuehlmann: then write a custom validation. you can also validate against double Group records (with identical id combinations) using the uniqueness validator if needed
[12:04:33] stannard: has joined #RubyOnRails
[12:08:42] rubyonrails645: has joined #RubyOnRails
[12:08:57] rubyonrails645: Hey guys, whats going on with y'all.
[12:09:12] rubyonrails645: Greetings from Venice Italy.
[12:11:11] dsf: has joined #RubyOnRails
[12:11:34] taxen: tbuehlmann: thanks man, will do
[12:12:45] alfie_max15: has joined #RubyOnRails
[12:15:15] GodFather: has joined #RubyOnRails
[12:16:13] tbuehlmann: taxen: something around this: https://gist.github.com/tbuehlmann/794f66e6144906e5def0b1b92c236f75
[12:17:58] taxen: tbuehlmann: beautiful solution, thank you!
[12:23:50] |2701: has joined #RubyOnRails
[12:26:11] Tester_: has joined #RubyOnRails
[12:30:25] der-landgraf: has joined #RubyOnRails
[12:30:28] bronson: has joined #RubyOnRails
[12:38:11] Megamos: has joined #RubyOnRails
[12:39:00] nofxx: has joined #RubyOnRails
[12:39:44] stannard: has joined #RubyOnRails
[12:41:59] GodFather: has joined #RubyOnRails
[12:45:23] dsf: has joined #RubyOnRails
[12:50:12] someish: has joined #RubyOnRails
[12:50:16] tildes: has joined #RubyOnRails
[12:52:39] running_rails: has joined #RubyOnRails
[12:56:25] tknz: has joined #RubyOnRails
[13:00:51] GodFather: has joined #RubyOnRails
[13:04:21] JakFrist: has joined #RubyOnRails
[13:07:53] zyzioziom: has joined #RubyOnRails
[13:12:55] Mia: has joined #RubyOnRails
[13:12:55] Mia: has joined #RubyOnRails
[13:14:22] allcentury: has joined #RubyOnRails
[13:16:03] petor: has joined #RubyOnRails
[13:17:33] TheMoonMaster: has joined #RubyOnRails
[13:19:04] insanedreamer: has joined #RubyOnRails
[13:20:27] zyzioziom: has joined #RubyOnRails
[13:25:14] cabinB: has joined #RubyOnRails
[13:25:36] doodlehaus: has joined #RubyOnRails
[13:31:31] ql6wlld: has joined #RubyOnRails
[13:31:33] alfie_max15: has joined #RubyOnRails
[13:31:43] zyzioziom: has joined #RubyOnRails
[13:32:02] kgrz: has joined #RubyOnRails
[13:33:04] maxx88: has joined #RubyOnRails
[13:37:57] srinidhi: has joined #RubyOnRails
[13:37:59] GodFather: has joined #RubyOnRails
[13:43:43] dbkbali: has joined #RubyOnRails
[13:46:55] DaniG2k: has joined #RubyOnRails
[13:48:16] DaniG2k: hello all, I'm wondering why within an Rspec test, if I use let!(:myvar) the variable is cached to what I initialize it to despite modifying it. I can only get the modified version if I call MyModel.last or whatever
[13:48:59] DaniG2k: as such: https://gist.github.com/DaniG2k/b99ae40e3dfb50c4863e36bf9adfc895
[13:49:07] DaniG2k: this works
[13:49:20] DaniG2k: but if I change the expect to state1, state2 and state3, they remain cached
[13:50:25] sevenseacat: and what does make_default! do?
[13:50:58] DaniG2k: sevenseacat: https://gist.github.com/DaniG2k/b99ae40e3dfb50c4863e36bf9adfc895#file-state-rb
[13:51:30] sevenseacat: right, so you're not actually changing the object you call make_default! on
[13:51:43] sevenseacat: you're loading a fresh copy from the db and updating *that* one
[13:51:57] GodFather: has joined #RubyOnRails
[13:52:22] jancel: has joined #RubyOnRails
[13:52:37] sevenseacat: https://gist.github.com/DaniG2k/b99ae40e3dfb50c4863e36bf9adfc895#file-state-rb-L10 loads fresh copy of the same record and updates it
[13:53:08] tlarevo: has joined #RubyOnRails
[13:53:19] DaniG2k: is there a way to modify the actual object?
[13:54:19] tlarevo: has left #RubyOnRails: ()
[13:54:21] DaniG2k: sevenseacat: I am using State.where(id: id).lock(true).first.update!(default: true) because I wanted to prevent race-conditions by creating a lock before updating the record
[13:54:50] macsteps: has joined #RubyOnRails
[13:55:32] sevenseacat: yes, you call update! on the actual object itself
[13:55:56] sevenseacat: you're inside a transaction so I have no idea what you need a lock for
[13:56:12] stannard: has joined #RubyOnRails
[13:56:44] DaniG2k: sevenseacat: say two people update a state at the same time
[13:56:58] DaniG2k: and all I have is: State.update_all(default: false); update!(default: true)
[13:57:05] DaniG2k: which will update self to be default: true
[13:57:22] DaniG2k: won't that cause a race condition?
[13:57:26] sevenseacat: I don't see how
[13:57:39] sevenseacat: one transaction will commit, then the other
[13:57:43] sevenseacat: the second one will win
[13:57:46] tbuehlmann: transactions ensure all or no instructions are properly executed. locking plays a different role
[13:57:56] DaniG2k: what does locking do?
[13:58:08] sevenseacat: I may misunderstand locking, I haven't used it a lot
[13:58:25] tbuehlmann: inside a transaction you can lock records, and only this one is allowed to update then
[13:59:35] parzo: has joined #RubyOnRails
[14:00:38] DaniG2k: I guess what I'm saying is, there won't be a race-condition on the same State entry but there could be multiple states set to default: true
[14:00:57] DaniG2k: because two people run the code State.update_all(default: false) at the same time, that's fine
[14:01:11] DaniG2k: then if two people run this at the same time: self.update!(default: true)
[14:01:18] DaniG2k: those would both commit
[14:02:02] DaniG2k: whereas ideally there should only be one state set to true at any given time
[14:02:12] DaniG2k: set to default: true*
[14:02:37] sevenseacat: I don't think thats how transactions work, to the best of my knowledge
[14:03:54] tbuehlmann: multiple transaction can and will run at the same time. they are there to make sure all instructions in it are run - or none
[14:04:59] tbuehlmann: DaniG2k: I want to suggest pg_lock again: https://gist.github.com/tbuehlmann/aba327e07b7a73b84300f3e4b55b8883
[14:05:22] DaniG2k: tbuehlmann: I tried it but actually I made a mistake, I am using sqlire -_- my apologies
[14:05:23] tbuehlmann: if that's an option for you (using postgres, no other applications accessing the database)
[14:06:09] tbuehlmann: are there real transactions in sqlite? :)
[14:06:40] DaniG2k: this app doesn't really have to be production ready
[14:06:40] parzo: I am hoping someone can help me with something that I assume is super basic but I am too stupid to figure out myself after Googling it. I am trying to resolve a Rails 5 depreciation warning like so: https://gist.github.com/mhoad/3e0956e357575136638cc13c074f52ef
[14:06:54] DaniG2k: I'm just hoping to learn how to do it the right way I suppose
[14:08:55] stannard: has joined #RubyOnRails
[14:09:13] tbuehlmann: parzo: make data an ActionController::Parameters object, that should do it
[14:10:01] parzo: tbuehlmann: I am almost positive I am missing something super obvious here but thats what I did in the second attempt no?
[14:10:19] tbuehlmann: oh, I didn't see that one
[14:10:25] parzo: All good :)
[14:11:48] tbuehlmann: can you add the controller action code to the gist? is the test failing correctly?
[14:13:06] parzo: updated will controller and corresponding model code
[14:15:26] tbuehlmann: looks okay to me. can you check the params in the receive action when running the test?
[14:17:44] parzo: Just did byebug in the controller and grabbed the params variable (not sure if that is what you meant) but it came back with <ActionController::Parameters {"data"=><ActionController::Parameters {"object"=>{"customer"=>"cus_0000000000", "id"=>"sub_00000000000000", "object"=>"subscription"}} permitted: false>, "type"=>"customer.subscription.created", "controller"=>"stripe_webhooks", "action"=>"receive"} permitted: fal
[14:18:04] parzo: which looks right I think?
[14:20:32] parzo: ah wait, yeah ok, its an ActionController::Parameters object within an ActionController::Parameters object. Not entirely sure of why that is though
[14:20:42] lukec: has joined #RubyOnRails
[14:22:35] tbuehlmann: yeah, that's it. I bet you have to provide an AC::P object here: `post :receive, params: { type: type, data: data }` as params
[14:26:02] parzo: I am a touch confused what that would even look like, I think I am just a bit fried in the brain at the moment after looking at this for way too long :)
[14:26:31] axilaris: has joined #RubyOnRails
[14:26:35] parzo: Like what does that AC::P look like now then?
[14:27:25] tbuehlmann: this maybe: https://gist.github.com/tbuehlmann/56f1517e78b238318a0edda28763c84f
[14:27:49] jsrn: has joined #RubyOnRails
[14:29:25] parzo: Ah close!
[14:29:39] parzo: Haha much more threatening depreciation warning now though :) Method symbolize_keys is deprecated and will be removed in Rails 5.1, as `ActionController::Parameters` no longer inherits from hash. Using this deprecated behavior exposes potential security problems. If you continue to use this method you may be creating a security vulnerability in your app that can be exploited. Instead, consider using one of these doc
[14:29:39] parzo: umented methods which are not deprecated
[14:31:47] tbuehlmann: where does that come from?
[14:32:52] parzo: RSpec output. It does pass at least though which is a start
[14:32:57] bronson: has joined #RubyOnRails
[14:33:42] parzo: sorry specifically this line post :receive, params: ActionController::Parameters.new(type: type, data: data)
[14:35:45] tbuehlmann: somewhere down the rabbit hole symbolize_keys is called
[14:36:52] kgrz: has joined #RubyOnRails
[14:36:58] parzo: changing that line back to post :receive, params: { type: type, data: data } seems to resolve things though, no more depreciations anywhere, no scary security warnings
[14:37:51] blackmesa: has joined #RubyOnRails
[14:38:28] tbuehlmann: oh, right, not needed there
[14:39:13] yfeldblum: has joined #RubyOnRails
[14:39:20] parzo: Thanks for your help, I really appreciate it, that was bugging me for far too long
[14:45:59] akshat_: has joined #RubyOnRails
[14:48:20] gudataa: has joined #RubyOnRails
[14:53:27] running_rails: has joined #RubyOnRails
[14:59:01] Pupeno: has joined #RubyOnRails
[15:01:22] someish: has joined #RubyOnRails
[15:05:08] diegoaguilar: has joined #RubyOnRails
[15:05:50] daguilaraguilar: has joined #RubyOnRails
[15:07:21] yfeldblum: has joined #RubyOnRails
[15:11:08] yfeldblum: has joined #RubyOnRails
[15:13:52] iwmrby: has joined #RubyOnRails
[15:15:20] adgtl: has joined #RubyOnRails
[15:15:32] iwmrby: So, I am creating a model for something and I want to have a Unix timestamp in the X field. I should use x:time, right?
[15:16:10] DoubleMalt: has joined #RubyOnRails
[15:18:59] mdw: has joined #RubyOnRails
[15:19:18] nertzy: has joined #RubyOnRails
[15:24:05] yfeldblum: has joined #RubyOnRails
[15:25:42] yfeldblum: has joined #RubyOnRails
[15:27:04] DaniG2k: has joined #RubyOnRails
[15:27:04] barhum2013: has joined #RubyOnRails
[15:27:18] dionysus69: has joined #RubyOnRails
[15:27:40] PhantomSpank: has joined #RubyOnRails
[15:28:01] jhass: I'd keep using datetime and convert where necessary
[15:28:54] sumobob: has joined #RubyOnRails
[15:29:37] iwmrby: jhass: Thanks!
[15:29:44] Devalo: has joined #RubyOnRails
[15:32:43] JoshGlzBrk: has joined #RubyOnRails
[15:33:20] srinidhi: has joined #RubyOnRails
[15:33:54] nertzy: has joined #RubyOnRails
[15:33:59] blackmesa: has joined #RubyOnRails
[15:34:11] jgt: has joined #RubyOnRails
[15:35:10] dsf: has joined #RubyOnRails
[15:39:33] alexhartley: has joined #RubyOnRails
[15:41:45] syndikate: has joined #RubyOnRails
[15:42:56] moeabdol: has joined #RubyOnRails
[15:46:50] adgtl: has joined #RubyOnRails
[15:47:12] stardiviner: has joined #RubyOnRails
[15:49:06] rodfersou: has joined #RubyOnRails
[15:50:52] barhum2013: has joined #RubyOnRails
[15:59:54] nose: has joined #RubyOnRails
[16:00:46] tlarevo: has joined #RubyOnRails
[16:05:23] mikeric: has joined #RubyOnRails
[16:06:50] adgtl: has joined #RubyOnRails
[16:07:09] k3rn31: has joined #RubyOnRails
[16:08:07] moeabdol: has joined #RubyOnRails
[16:16:15] lxsameer: has joined #RubyOnRails
[16:16:23] mdw: has joined #RubyOnRails
[16:24:13] akshat: has joined #RubyOnRails
[16:24:40] ql6wlld: has joined #RubyOnRails
[16:28:18] barhum2013: has joined #RubyOnRails
[16:29:14] nose: I have data stored in an in-memory repository. It is initialized with fake data using an initializer.
[16:29:27] nose: When my code reloads, the stored data is reset as the class is re-initialized
[16:29:40] nose: Is there any good way to get around this?
[16:33:34] akshat_: has joined #RubyOnRails
[16:34:50] adgtl: has joined #RubyOnRails
[16:34:53] bronson: has joined #RubyOnRails
[16:38:03] blackmesa: has joined #RubyOnRails
[16:46:54] marr: has joined #RubyOnRails
[16:47:00] sharkman: has joined #RubyOnRails
[16:47:24] netzfisch: has joined #RubyOnRails
[16:47:27] sharkman: hi can i ask a question please sirs
[16:48:00] sharkman: x = Table.get_stuff; y = Table.get_overlapping_stuff; z = (x + y).unique
[16:48:14] sharkman: how do i do that last step? getting only unique entries? to remove the duplicates
[16:49:23] jhass: remove ue
[16:49:35] doodlehaus: has joined #RubyOnRails
[16:49:50] adgtl: has joined #RubyOnRails
[16:49:51] Devalo: has joined #RubyOnRails
[16:54:14] running_rails: has joined #RubyOnRails
[16:55:23] pawnbox: has joined #RubyOnRails
[16:58:22] diegoviola: has joined #RubyOnRails
[16:58:38] sharkman: jhass what?
[17:02:42] jhass: http://ruby-doc.org/core-2.3.1/
[17:03:16] jgt: has joined #RubyOnRails
[17:03:59] dbkbali: has joined #RubyOnRails
[17:06:45] mwlang: has joined #RubyOnRails
[17:07:03] Devalo: Is 5.0.0rc1 production ready? Is it safe to start a new project using it, or should I stick with the latest stable release until 5.0.0 is released?
[17:08:20] adgtl: has joined #RubyOnRails
[17:11:28] rogue_koder: has joined #RubyOnRails
[17:12:52] tbuehlmann: Devalo: if you don't have a problem with looking for compatible gems you want to use, you can use the rc
[17:16:19] dbkbali: Devalo: I have it using a production app for some gems (i.e. Kaminari) had to use git branch as Rails 5 compatible gem has not been released yet -- No problems though using it in production!
[17:16:36] smoitra: has joined #RubyOnRails
[17:17:12] sharkman: i could use some help on how to make this go at a reasonable speed. i timed this at 5 seconds right now
[17:17:13] sharkman: https://gist.github.com/anonymous/4f90714108f5485e250605a5fcac8a8d
[17:17:50] sharkman: i loop through options[:scraped] and for each entry try to find some matches i have identified in db_lines query, and then will delete all the matches
[17:19:36] shinnya: has joined #RubyOnRails
[17:20:21] adgtl: has joined #RubyOnRails
[17:21:30] SteenJobs: has joined #RubyOnRails
[17:22:49] mwlang: has joined #RubyOnRails
[17:22:53] qejk: has joined #RubyOnRails
[17:23:05] universa1: sharkman: to make it faster, you most likely have to reduce the number of db queries you make.
[17:25:10] benlieb: has joined #RubyOnRails
[17:28:48] universa1: and also since we don't know the numbers/arguments/etc... at all... ...it is hard to give any advice beyond that...
[17:29:17] nibbo: has joined #RubyOnRails
[17:34:40] nibbo: has joined #RubyOnRails
[17:37:07] hackeron: has joined #RubyOnRails
[17:37:52] Talltree: do i understand it correctly that the right way to post multible records to a model is a collection route
[17:38:06] Talltree: and not a for model in model_params?
[17:39:10] nettoweb: has joined #RubyOnRails
[17:39:46] Megamos: has joined #RubyOnRails
[17:40:08] jbermudes: has joined #RubyOnRails
[17:40:51] adgtl: has joined #RubyOnRails
[17:47:08] nibbo: has joined #RubyOnRails
[17:48:58] triangles: has joined #RubyOnRails
[17:49:44] allcentury: has joined #RubyOnRails
[17:50:59] doodlehaus: has joined #RubyOnRails
[17:51:15] arBmind: has joined #RubyOnRails
[17:55:50] adgtl: has joined #RubyOnRails
[17:56:32] indianowl: has joined #RubyOnRails
[17:56:46] Dimik: has joined #RubyOnRails
[17:58:08] stannard: has joined #RubyOnRails
[18:00:58] mdw: has joined #RubyOnRails
[18:03:51] Cohedrin: has joined #RubyOnRails
[18:05:11] stannard: has joined #RubyOnRails
[18:05:15] rafaelfranca: has joined #RubyOnRails
[18:09:20] adgtl: has joined #RubyOnRails
[18:12:44] workmad3: has joined #RubyOnRails
[18:15:19] macsteps: has joined #RubyOnRails
[18:16:06] alfie_max15: has joined #RubyOnRails
[18:18:50] adgtl: has joined #RubyOnRails
[18:19:17] benlieb: has joined #RubyOnRails
[18:20:32] smoitra_: has joined #RubyOnRails
[18:30:31] beingjohnm: I have a setup where User has many Organizationa which has many Employees. I'm struggling to get a User's Employees.
[18:32:25] beingjohnm: without creating an array and looping through Organizations to add each organization's employees to the array. Wondering if there is an active record way I'm missing. I feel like I have done this before but drawing a blank.
[18:35:56] jhass: Employee.joins(:organization).where(organization: {user: current_user}) iirc
[18:36:02] alfie_max15: beingjohnm, add this association to User model, has_many :employees, through: organizations
[18:36:11] alfie_max15: and just call, @user.employees
[18:36:56] bronson: has joined #RubyOnRails
[18:37:32] beingjohnm: alfie_max15: total blank on that! Thanks!
[18:39:50] adgtl: has joined #RubyOnRails
[18:40:17] zapp3r: has joined #RubyOnRails
[18:41:41] jancel: has joined #RubyOnRails
[18:45:59] srinidhi: has joined #RubyOnRails
[18:48:44] zyzioziom: has joined #RubyOnRails
[18:55:00] running_rails: has joined #RubyOnRails
[18:55:13] roamingdog: has joined #RubyOnRails
[18:56:51] roamingdog: has joined #RubyOnRails
[19:02:08] kdough: has joined #RubyOnRails
[19:10:50] adgtl: has joined #RubyOnRails
[19:11:21] snowy: has joined #RubyOnRails
[19:11:48] zpe: has joined #RubyOnRails
[19:13:08] snowy: has joined #RubyOnRails
[19:14:58] maxz: has joined #RubyOnRails
[19:18:25] AnoHito: has joined #RubyOnRails
[19:20:23] benlieb: Is there a way to run code just when binding.pry is called? I want to do ActiveRecord::Base.logger = Logger.new(STDOUT) to see sql queries
[19:23:23] baweaver: short of hotwiring binding.pry to introduce a global variable, I don't think so.
[19:32:47] ur5us: has joined #RubyOnRails
[19:39:23] gingray: has joined #RubyOnRails
[19:40:36] AmiMoenc1: has joined #RubyOnRails
[19:40:48] alexhartley: has joined #RubyOnRails
[19:42:26] maxz: has joined #RubyOnRails
[19:45:50] adgtl: has joined #RubyOnRails
[19:46:12] Talltree: i'm asking again, because idk, is https://stackoverflow.com/questions/23481786/i-want-to-post-multiple-entries-at-a-time-to-my-rails-api-backend-via-json-how the best method to post multible entries to a rails model?
[19:48:47] macsteps: has joined #RubyOnRails
[19:49:44] djbkd: has joined #RubyOnRails
[19:50:13] wldcordeiro: has joined #RubyOnRails
[19:51:49] doodlehaus: has joined #RubyOnRails
[19:54:58] Cohedrin: has joined #RubyOnRails
[19:56:35] chops_: has joined #RubyOnRails
[19:58:36] Technodrome: has joined #RubyOnRails
[20:00:47] maxz: has joined #RubyOnRails
[20:01:24] Synthead: has joined #RubyOnRails
[20:06:42] ur5us: has joined #RubyOnRails
[20:09:48] rafaelfranca: has joined #RubyOnRails
[20:10:12] blackmesa: has joined #RubyOnRails
[20:13:18] Inside: has joined #RubyOnRails
[20:13:18] Inside: has joined #RubyOnRails
[20:14:29] sneakersec: has joined #RubyOnRails
[20:16:07] tubbo: Talltree: at work, we have a separate `bulk` action that does an "upsert" of bulk data, which creates records that don't exist and updates existing records with the data you give it
[20:16:15] roamingdog: has joined #RubyOnRails
[20:17:18] gopz: has joined #RubyOnRails
[20:17:20] Talltree: tubbu but the same princible of the stackoverflow link right?
[20:17:23] tubbo: but that's only because clients want to create thousands of records at a time
[20:17:26] Talltree: not solved via routing?
[20:17:27] tubbo: sort-of, yeah
[20:17:34] Talltree: okay, thank you.
[20:17:40] tubbo: give it a shot, i've never seen that done before honestly Talltree
[20:17:59] Talltree: i also understand routing currently, but i am sure thats just me being a total noob
[20:18:23] Talltree: its really intresting, this site i'm working on is going to have at least 16000 entrys
[20:18:36] ksmutthu: has joined #RubyOnRails
[20:19:54] DoubleMalt: has joined #RubyOnRails
[20:21:33] barhum2013: has joined #RubyOnRails
[20:22:04] ksmutthu_: has joined #RubyOnRails
[20:25:07] Talltree: tubbu maybe this would be helpful to know, what do i use if i do rake routes and the route helper doesnt show up
[20:25:26] Talltree: i dont get what i should use, or how i would know the path without it..
[20:25:51] universa1: is there one in the line above?
[20:25:54] universa1: show the output ;)
[20:25:57] universa1: and your routes.rb
[20:26:10] Talltree: i'm experimenting so this could completly wrong
[20:26:32] Talltree: https://i.imgur.com/U3qtvb2.png
[20:26:55] Talltree: http://pastie.org/10847940
[20:27:57] universa1: Talltree: !routing
[20:27:57] helpa: Talltree: http://guides.rubyonrails.org/routing.html - Rails Routing From the Outside In - Rails Guide - by Mike Gunderloy
[20:28:18] Talltree: i have that open all the time, doesnt seem to make me smarter tho :D
[20:28:28] universa1: Talltree: any reason you are not using the resource(s) helper?
[20:28:45] Talltree: i want it from the route path
[20:29:08] universa1: Talltree: you haven't assigned a name for the route, and it can't guess from :id ;)
[20:29:19] GodFather: has joined #RubyOnRails
[20:29:33] gopz: is there any difference between Dir['lib/ *.rb] and Dir['lib/*rb'
[20:29:45] universa1: Talltree: http://guides.rubyonrails.org/routing.html#naming-routes
[20:29:52] gopz: I have seen it both ways
[20:30:25] universa1: gopz: well, the firs tnoe has a lot of spaces, which is somewhat weird
[20:30:32] universa1: and the second matches different things.
[20:30:42] gopz: It is is in the example for making a ruby gem
[20:30:47] gopz: for the files field
[20:30:53] Talltree: universa1: so get '/:id/edit' => 'character#edit', as: :character is correct?
[20:30:55] universa1: then the first, first matches anything ending with .rb
[20:30:56] gopz: I was curious if it was just a style choice
[20:31:23] universa1: gopz: second matches anything ending with rb, so also foobarb
[20:31:31] universa1: which the first wouldn't match
[20:31:45] gopz: oops sorry
[20:31:49] gopz: there should be . there
[20:31:52] universa1: gopz: you should verify that in the console ;)
[20:32:00] gopz: the only difference is those spaces
[20:32:11] gopz: http://guides.rubygems.org/specification-reference/#files
[20:32:13] universa1: gopz: try it in console...
[20:32:20] benlieb: has joined #RubyOnRails
[20:32:21] gopz: it seems the same
[20:32:30] diego1: has joined #RubyOnRails
[20:33:24] futilegames: has joined #RubyOnRails
[20:33:43] universa1: Talltree: if you want character_path(some_id) to map to the edit action.
[20:35:06] jgt: has joined #RubyOnRails
[20:35:07] asheinfeld: has joined #RubyOnRails
[20:37:50] Talltree: oh wow, can't believe how weirdly easy it is once you understand that
[20:37:55] Talltree: thank you very much universa1
[20:39:01] bronson: has joined #RubyOnRails
[20:39:07] marr: has joined #RubyOnRails
[20:41:41] meoblast001: has joined #RubyOnRails
[20:48:25] mikeric: has joined #RubyOnRails
[20:48:31] lxsameer: has joined #RubyOnRails
[20:52:19] maxx88_: has joined #RubyOnRails
[20:53:05] Talltree: universa1, another question... patch/put are nearly the same right now, so how do make them the same 'as: name' ?
[20:55:48] running_rails: has joined #RubyOnRails
[20:56:35] zyzioziom: has joined #RubyOnRails
[20:57:01] zyzioziom: has joined #RubyOnRails
[20:58:09] nettoweb: has joined #RubyOnRails
[20:58:30] allcentury: has joined #RubyOnRails
[20:58:45] netzfisch: has joined #RubyOnRails
[20:58:49] kgrz: has joined #RubyOnRails
[21:00:23] nettoweb: has joined #RubyOnRails
[21:01:20] Kagome_: has joined #RubyOnRails
[21:01:44] Kagome_: mmmmmmm todo esta bien por aca
[21:02:08] adre: has joined #RubyOnRails
[21:02:11] Kagome_: todos los que estan por aca
[21:02:27] aclearman037: has joined #RubyOnRails
[21:02:52] Kagome_: quien está de lider hoy?
[21:03:29] roamingdog: Kagome_: que?
[21:03:51] Kagome_: quien está de lider aqui hoy
[21:04:26] roamingdog: Kagome_: who is the leader? what?
[21:04:40] Kagome_: hablame en español
[21:04:50] Talltree: No hablo español
[21:05:01] roamingdog: Kagome_: you'll have much better luck with english i'm afraid
[21:05:42] roamingdog: Kagome_: what's your actual question, if you have one?
[21:06:13] Kagome_: no entiendo de lo que dice roamingdog
[21:06:43] moei: has joined #RubyOnRails
[21:06:43] roamingdog: Kagome_: https://translate.google.com/
[21:07:47] Talltree: how do you find this irc even if you dont speak english?
[21:09:13] xalupeao: has joined #RubyOnRails
[21:11:26] xalupeao: i need a gem to upload and crop image as "Facebook"
[21:11:29] xalupeao: is possible=
[21:11:37] xalupeao: exists a gem?
[21:12:29] Devalo: has joined #RubyOnRails
[21:13:31] rafaelfranca: has joined #RubyOnRails
[21:14:08] roamingdog: xalupeao: there are several gems to assist in uploading photos, cropping is best done with javascript probably. i don't know how facebook does it
[21:16:14] dgynn: has joined #RubyOnRails
[21:17:20] gopz: has joined #RubyOnRails
[21:18:58] doodlehaus: has joined #RubyOnRails
[21:19:22] snowy: has joined #RubyOnRails
[21:22:15] Puffball: has joined #RubyOnRails
[21:30:54] edwinvdgraaf: has joined #RubyOnRails
[21:31:14] Radar: GOOD MORNING
[21:32:47] ur5us: has joined #RubyOnRails
[21:32:57] barhum2013: has joined #RubyOnRails
[21:33:36] nettoweb: has joined #RubyOnRails
[21:37:39] elementaru: has joined #RubyOnRails
[21:39:17] elementaru: has anyone done railstutorial.org by michael hartl? it says to install rails on cloud9, but either it's outdated a bit, or I messed something
[21:39:33] elementaru: anyway, I have this line in Gemfile
[21:40:06] elementaru: I can't start rails server because it returns me error
[21:40:13] elementaru: group :development, :test do
[21:40:35] elementaru: I think the problem is there's 4 gems listed in this group
[21:40:53] elementaru: and there's space only for two right?
[21:40:57] elementaru: if I understand correctly
[21:41:07] jhass: you don't
[21:41:16] jhass: how about you show the error?
[21:41:39] smathy: has joined #RubyOnRails
[21:41:58] elementaru: http://pastebin.ca/3607483
[21:42:39] alfie_max15: elementaru, can you also show your Gemfile
[21:42:42] elementaru: these lines on Gemfile looks like these
[21:42:43] elementaru: http://pastebin.ca/3607484
[21:43:05] jhass: elementaru: you have an extra '
[21:43:16] jhass: on the sqlite lin
[21:44:32] macsteps: has joined #RubyOnRails
[21:44:58] Talltree: this error is really weird https://i.imgur.com/llOExU6.png
[21:45:12] Talltree: why whould there be an id on my new route :-/(
[21:45:33] gopz: has joined #RubyOnRails
[21:47:21] alfie_max15: Talltree, can you show your routes.rb ?
[21:48:19] Talltree: alfie_max15, http://pastie.org/10847993
[21:49:11] Talltree: from what i've seen thats no different than the resource helper would do
[21:50:14] fox_mulder_cp: i need add a some custom options such as 'mymodel/?some=there?opt=true' to resources for 'mymodel'. what i need to read?
[21:50:33] Puffball: has joined #RubyOnRails
[21:50:41] chops_: has joined #RubyOnRails
[21:50:41] gopz: has joined #RubyOnRails
[21:50:49] alfie_max15: fox_mulder_cp, do you mean you need to pass in parameters?
[21:53:40] fox_mulder_cp: alfie_max15: yes/
[21:54:05] fox_mulder_cp: for scope/filtering etc
[21:54:53] zpe: has joined #RubyOnRails
[21:54:56] Talltree: alfie_max15, changed @character to :character and it works
[21:55:00] maxz: has joined #RubyOnRails
[21:55:03] Talltree: whaaaat? Oo
[21:55:48] chopin: has joined #RubyOnRails
[21:56:00] alfie_max15: that doesn't make sense
[21:56:26] alfie_max15: you have @character = Character.new in your `new` action right?
[21:57:06] Talltree: only the form renders, does nothing ;)
[21:57:16] Talltree: so no fix in sight
[21:57:19] Talltree: really weird Oo
[21:57:41] Talltree: and its not like i instantly come here if i find something, this takes ages..
[21:58:14] alfie_max15: any reason why you are not using resources :character to define routes?
[21:58:42] Puffball: has joined #RubyOnRails
[21:58:55] gopz: has joined #RubyOnRails
[21:59:56] Talltree: alfie_max15, understanding it, and customizing it
[22:02:16] doodlehaus: has joined #RubyOnRails
[22:02:37] adre: has joined #RubyOnRails
[22:04:16] andywww: has joined #RubyOnRails
[22:04:36] alfie_max15: Talltree, take a look : http://pastie.org/10848003
[22:06:15] Talltree: i dont even want all routes to be present
[22:06:33] alfie_max15: you can use except or only for that
[22:06:34] fox_mulder_cp: Radar: may be u help me?
[22:06:58] andywww: wondered if someone could answer me a question.. as it stands i have the passenger enabled nginx serving up my app with varnish sat in front of it. I’m wondering if varnish is an unnecessary step and wether nginx would honour the cache headers i set in the controllers. Would this happen ‘out of the box’ or would it require any extra configuation in nginx?
[22:07:00] fox_mulder_cp: i ask my question ~10mins ago
[22:07:01] Talltree: some routes should be somewhere else entirely, hidden...
[22:07:13] Talltree: but that doesnt explain why it isnt working
[22:08:11] allcentury: has joined #RubyOnRails
[22:09:28] xlegoman: has joined #RubyOnRails
[22:10:04] diego2: has joined #RubyOnRails
[22:11:16] benlieb: has joined #RubyOnRails
[22:11:22] maxz: has joined #RubyOnRails
[22:12:00] elementaru: has joined #RubyOnRails
[22:12:16] alfie_max15: Talltree, can you share your new form?
[22:12:50] Talltree: http://pastie.org/10848012
[22:14:47] cogsbox: has joined #RubyOnRails
[22:15:31] gopz: has joined #RubyOnRails
[22:16:22] alfie_max15: thanks, reproduced the error at my end. this has definitely something to do with the routes
[22:16:52] cogsbox: I set seed for a admin user. Which is working on local host, but does not work on heroku. I think that I could be because I added the seed file to gitignore so when I "git push heroku" maybe it can't find my seed. Can this happen?
[22:16:53] Talltree: really no idea why, i used your example with path: '' now
[22:17:31] Talltree: or i am using it now, lets see if i can have that customized to my liking tomorow
[22:17:47] jancel: has joined #RubyOnRails
[22:17:55] alfie_max15: cogsbox, yes, if you don't have the seed file when you push to heroku then how would it find the file?
[22:20:36] cogsbox: Thanks, so I guess my questions is, how do I hide my login info for my admin and still have heroku see it? All of my code has been pushed to github, but I don't want my login info to be visible to the wild web.
[22:21:27] Talltree: thanks for you help btw alfie_max15
[22:21:43] alfie_max15: then don't seed it, instead create the admin user manually using the rails console
[22:21:59] alfie_max15: Talltree, yw, let me see if i can figure this out :)
[22:22:37] Talltree: glad to see i am not the only one having a hard time with that :D
[22:22:49] Talltree: ACTION is really gone now
[22:23:04] alfie_max15: it's easy to fix it, but i'm trying to understand what exactly is the issue
[22:24:10] gopz: has joined #RubyOnRails
[22:26:26] cogsbox: Thanks. I did not realize that the work I did in rails console would get seen by heroku. I appreciate the help alfie_max15. Will I have to run "heroku run rake db:migrate" after changes in the rails console.
[22:27:04] alfie_max15: no, db:migrate is for running the migrations
[22:27:27] Radar: fox_mulder_cp: posts_path(some_param: true)
[22:27:39] sumobob: has joined #RubyOnRails
[22:28:11] cogsbox: oh... where is the information stored that I put into the rails console?
[22:28:28] barhum2013: has joined #RubyOnRails
[22:28:58] alfie_max15: no where, it just get's executed
[22:29:01] ROMORC: has joined #RubyOnRails
[22:30:08] rafaelfranca: has joined #RubyOnRails
[22:30:09] rafaelfranca: has joined #RubyOnRails
[22:30:09] centrx: has joined #RubyOnRails
[22:30:24] cogsbox: Cool. thanks alfie_max15. You have saved me a lot of headache.
[22:31:28] diegoaguilar: has joined #RubyOnRails
[22:35:47] workmad3: has joined #RubyOnRails
[22:37:27] centrx: Any good comparison of ActiveScaffold vs ActiveAdmin?
[22:38:11] doodlehaus: has joined #RubyOnRails
[22:40:54] bronson: has joined #RubyOnRails
[22:41:22] GodFather: has joined #RubyOnRails
[22:44:54] asheinfeld: has joined #RubyOnRails
[22:45:52] macsteps: has joined #RubyOnRails
[22:50:08] AntiSpamMeta: has joined #RubyOnRails
[22:52:33] asheinfeld: has joined #RubyOnRails
[22:55:54] Inside: has joined #RubyOnRails
[22:55:54] Inside: has joined #RubyOnRails
[22:56:35] running_rails: has joined #RubyOnRails
[23:00:32] tildes: has joined #RubyOnRails
[23:01:27] helpa: talk to epochwolf about ActiveAdmin
[23:02:51] barhum2013: has joined #RubyOnRails
[23:03:45] dalbuschat: has joined #RubyOnRails
[23:05:04] JoshGlzBrk: has joined #RubyOnRails
[23:05:56] roamingdog: has joined #RubyOnRails
[23:08:12] JakFrist: has joined #RubyOnRails
[23:08:14] weaksauce: centrx i'd advise against active admin
[23:08:28] centrx: why’s that?
[23:09:03] running_rails: has joined #RubyOnRails
[23:09:32] weaksauce: it's just a dsl for dsl sake and if your app does something out of the ordinary it's a pain to extend
[23:10:11] doodlehaus: has joined #RubyOnRails
[23:10:19] centrx: weaksauce But it sets up all the grids for me with filters, etc. right? What’s a better option for that?
[23:10:42] smathy: Take a look at Administrate, it's a much better approach.
[23:10:58] smathy: https://github.com/thoughtbot/administrate
[23:11:48] centrx: Interesting
[23:11:51] centrx: Thank you smathy !
[23:12:40] idefine: has joined #RubyOnRails
[23:13:21] yfeldblum: has joined #RubyOnRails
[23:14:32] Radar: centrx: !admin
[23:14:32] helpa: centrx: Please do not use active_admin, rails_admin or any other gems to build your admin interfaces. Instead, build it yourself. This will lead you to a safe path of understanding of the code, rather than to the Hell that is those gems.
[23:14:47] sdwrage: has joined #RubyOnRails
[23:14:50] centrx: Thanks :)
[23:14:57] smathy: Despite that, I still think administrate is cool.
[23:15:25] sypheren: has joined #RubyOnRails
[23:16:21] Radar: It's the least worst.
[23:19:55] Alazoral: has joined #RubyOnRails
[23:20:11] xalupeao: has joined #RubyOnRails
[23:21:03] centrx: has joined #RubyOnRails
[23:21:43] beingjohnm: I just started building my admin interface myself yesterday after looking at active_admin. I just decided I didn't want to learn another gem...and my needs are fairly simple at the moment.
[23:21:47] chipotle: has joined #RubyOnRails
[23:25:16] Regulati_: has joined #RubyOnRails
[23:27:51] AmiMoench: has joined #RubyOnRails
[23:30:08] stannard: has joined #RubyOnRails
[23:33:15] jancel: has joined #RubyOnRails
[23:34:17] gopz: has joined #RubyOnRails
[23:37:01] JesseH: has joined #RubyOnRails
[23:38:40] asheinfeld: has joined #RubyOnRails
[23:38:45] chops_: has joined #RubyOnRails
[23:39:39] yfeldblum: has joined #RubyOnRails
[23:41:44] eljimbo: has joined #RubyOnRails
[23:42:28] alexhartley: has joined #RubyOnRails
[23:43:31] someish: has joined #RubyOnRails
[23:46:29] axilaris: has joined #RubyOnRails
[23:46:43] pwnd_nsfw: beingjohnm, aa is dongs anyways
[23:46:57] pawnbox: has joined #RubyOnRails
[23:48:53] stannard: has joined #RubyOnRails
[23:50:51] macsteps: has joined #RubyOnRails
[23:50:53] gopz: has joined #RubyOnRails
[23:55:23] maxz: has joined #RubyOnRails
[23:56:04] stannard: has joined #RubyOnRails
[23:56:05] zpe: has joined #RubyOnRails
[23:57:34] stannard: has joined #RubyOnRails