« Back to channel list

#RubyOnRails - 07 March 2017

Forward 1 day »
[10:32:41] helpa: has joined #RubyOnRails
[10:37:15] helpa: has joined #RubyOnRails
[10:37:38] helpa: has joined #RubyOnRails
[10:40:08] pickle_: has joined #RubyOnRails
[10:40:14] tedwing: has joined #RubyOnRails
[10:40:40] pawnbox: has joined #RubyOnRails
[10:43:49] acosonic: Radar, thanks!
[10:44:04] rubyonrails554: has joined #RubyOnRails
[10:46:11] codelahoma: has joined #RubyOnRails
[10:51:25] alfiemax: has joined #RubyOnRails
[10:51:29] fox_mulder_cp: hi, folks. how i can use :classify and :constatize in plain ruby non-rails gem?
[10:52:02] alfiemax: @fox_mulder_cp hi
[10:52:02] fox_mulder_cp: i need do this req = "Net::HTTP::#{method.capitalize}".constantize.new(uri, @headers)
[10:52:14] alfiemax: you'll need to require ActiveSupport::Inflector module
[10:52:28] fox_mulder_cp: where method can be Patch, GET, POST ...
[10:52:45] sjakalen: has joined #RubyOnRails
[10:52:54] fox_mulder_cp: ooh. requiring AS for only this methods bad idea..
[10:53:15] alfiemax: then you'll have to write your own methods that does that
[10:54:01] sjakalen: If I would like to have some parameters for a table record to be chosen from a drop down menu on a web page: What will the first argument for the collection.select be?
[10:54:37] fox_mulder_cp: sjakalen: do u try to read api manual for this?
[10:55:28] sjakalen: It's really confusing, the collection select is confusing af :(
[10:55:46] Jameser: has joined #RubyOnRails
[10:56:38] fox_mulder_cp: haml is : = f.collection_select :id, @collection.all, :id, :hostname, prompt: true, class: 'form-control'
[10:56:39] alfiemax: @fox_mulder_cp just found this : https://github.com/calebjclark/activesupport-inflector
[10:56:58] banandana: has joined #RubyOnRails
[10:57:03] fox_mulder_cp: alfiemax: thanks. i rewrite it to get/post/patch/delete case :)
[10:58:00] fox_mulder_cp: sjakalen: so try to use <%= collection_select ... %>
[10:58:25] fox_mulder_cp: it's easy and pretty, than other selection list helpers, as for me
[10:59:08] fox_mulder_cp: Radar: If u intrested - i post here yesterday link for my api screenshots :)
[10:59:13] sjakalen: Well, I am using collection_select in the views of a table. Now I want the chosen value to be passed to the controller so that I can use this value in the controller
[10:59:55] sjakalen: The chosen value is a record within another table, and I distinctly need the ID of this record
[11:00:09] sjakalen: I'm sorry for being such a newbie
[11:00:14] alfiemax: i've got a question
[11:00:32] alfiemax: i'm looking at this accepted answer here : http://stackoverflow.com/questions/25841377/rescue-from-actioncontrollerroutingerror-in-rails-4
[11:01:18] alfiemax: there is this `rescue_from ActionController::RoutingError, with: -> { render_404 }` but it never get executed, because `ActionController::RoutingError` is never rescued here
[11:01:30] alfiemax: why is that so?
[11:01:32] fox_mulder_cp: sjakalen: still wait
[11:01:51] artto: has joined #RubyOnRails
[11:02:45] tbuehlmann: alfiemax: there's no controller ever reached when there's no such route
[11:03:06] tbuehlmann: so you have a catchall route after every other route that routes to a specific error controller
[11:03:15] fox_mulder_cp: sjakalen: in my pundit permitted params i check for [:collectionName_id] for field which i select in previous collection_select
[11:03:19] alfiemax: yes, that's what i figured, and that's why there is the catch all routes in routes.rb
[11:04:06] alfiemax: but then why is ActionController::RoutingError triggered before reaching the controller, and so then does that line not do anything?
[11:06:35] sjakalen: fox_mulder_cp: this is my collection_select: <%= f.collection_select :id, Course.all, :id, :code, {include_blank: true} %> where Course is another table. What specifies what is passed on to the controller?
[11:06:40] LiquidInsect: has joined #RubyOnRails
[11:07:02] mtkd: has joined #RubyOnRails
[11:08:50] tbuehlmann: alfiemax: no idea
[11:11:54] gloscombe: has joined #RubyOnRails
[11:13:31] pawnbox: has joined #RubyOnRails
[11:18:21] fourcolors: has joined #RubyOnRails
[11:19:53] srinidhi: has joined #RubyOnRails
[11:21:45] alfiemax: in rails 5 what does throw(:abort) actually check?
[11:21:59] NoGodDamnIdea: has joined #RubyOnRails
[11:23:24] tbuehlmann: alfiemax: it explicitly halts a callback chain
[11:23:33] alfiemax: by checking how?
[11:23:49] tbuehlmann: maybe this helps: http://blog.bigbinary.com/2016/02/13/rails-5-does-not-halt-callback-chain-when-false-is-returned.html
[11:24:12] alfiemax: i read that
[11:24:48] alfiemax: in that blog, it just calls throw(:abort)
[11:25:00] alfiemax: shouldn't it be `throw(:abort) if some_condition`
[11:25:24] tbuehlmann: that's an example
[11:25:30] tbuehlmann: if you need a condition, have a condition
[11:25:40] alfiemax: or, does throw(:abort) check the previous statement's return value?
[11:26:31] tbuehlmann: no, it just throws
[11:27:08] alfiemax: mmm, so the example in the blog always throws error and the callback fails right?
[11:27:24] dionysus69: has joined #RubyOnRails
[11:27:45] morfin: that's correct approach?
[11:27:49] tbuehlmann: it always throws and halts the callback chain
[11:31:37] ldnunes: has joined #RubyOnRails
[11:34:06] artto: has joined #RubyOnRails
[11:36:12] artto_: has joined #RubyOnRails
[11:40:13] Jameser: has joined #RubyOnRails
[11:42:04] pawnbox_: has joined #RubyOnRails
[11:48:04] bvcosta: has joined #RubyOnRails
[11:48:53] guardianJ: has joined #RubyOnRails
[11:49:44] Fuzai: has joined #RubyOnRails
[11:50:05] teddysmoker: has joined #RubyOnRails
[11:51:14] sid_fules: has joined #RubyOnRails
[11:52:10] xall_: has joined #RubyOnRails
[11:52:39] LiquidInsect: has joined #RubyOnRails
[11:53:46] bvcosta: do you guys recommend any resource to check clean architecture with rails5?
[11:55:49] DaniG2k: has joined #RubyOnRails
[11:58:27] hotpancakes: has joined #RubyOnRails
[12:02:55] jenrzzz: has joined #RubyOnRails
[12:08:31] bbrowning_: has joined #RubyOnRails
[12:19:14] shinnya: has joined #RubyOnRails
[12:20:48] GK___1wm____SU: has joined #RubyOnRails
[12:26:08] brent__: has joined #RubyOnRails
[12:26:27] rubyonrails549: has joined #RubyOnRails
[12:29:01] dps: has joined #RubyOnRails
[12:32:30] hotpancakes: has joined #RubyOnRails
[12:33:40] conta: has joined #RubyOnRails
[12:34:25] hotpanca_: has joined #RubyOnRails
[12:35:26] Pumukel: has joined #RubyOnRails
[12:36:31] Violentr: has joined #RubyOnRails
[12:39:37] SteenJobs: has joined #RubyOnRails
[12:41:09] dionysus69: has joined #RubyOnRails
[12:41:17] artto: has joined #RubyOnRails
[12:41:42] helpa: Nope. No one. Ever. In the history of the world.
[12:42:01] michael_mbp: I just created a new 5.0.2 app, and active record is acting as if attributes are missing
[12:42:07] michael_mbp: I did attr_accessor in the model
[12:42:17] michael_mbp: has Rail 5.0+ changed anything drastically?
[12:43:00] michael_mbp: https://gist.github.com/bsodmike/0c30c61ab3ffeb80a56aed61dc098520
[12:44:20] matthewd: > I did attr_accessor in the model
[12:44:24] matthewd: You probably don't want to do that
[12:46:04] mdhas: has joined #RubyOnRails
[12:47:38] michael_mbp: matthewd: oh?
[12:47:51] michael_mbp: what's wrong with attr_accessor?
[12:48:10] xall_: has joined #RubyOnRails
[12:48:50] matthewd: There's nothing wrong with it.. but your example implies you're using it for something it doesn't do
[12:49:56] michael_mbp: hang on I'll add my migration
[12:50:27] michael_mbp: https://gist.github.com/bsodmike/0c30c61ab3ffeb80a56aed61dc098520
[12:54:12] matthewd: Yeah.. why are you calling attr_accessor for a column?
[12:54:13] gloscombe: has joined #RubyOnRails
[12:59:57] akshat: has joined #RubyOnRails
[13:00:23] versigtig: has joined #RubyOnRails
[13:00:49] artto: has joined #RubyOnRails
[13:01:13] tomasm-: has joined #RubyOnRails
[13:02:48] sandstrom: has joined #RubyOnRails
[13:05:05] artto: has joined #RubyOnRails
[13:09:39] marahin: has joined #RubyOnRails
[13:10:00] marahin: Hello! I have a JSONB attribute on my model that has an array in it. How can I pluck records so to only receive that array of values?
[13:10:02] zacts: has joined #RubyOnRails
[13:10:25] marahin: I'm trying something like: Record.first(2).pluck("DISTINCT jsonb_attribute->>'somekey'->>'array'")
[13:10:30] marahin: but it's returning [nil, nil]
[13:10:40] marahin: (I'm completely new with JSONB handling)
[13:11:28] marahin: Record.first(2).map{ |n| n.jsonb_attribute['somekey']['array'] } is what I would like to achieve with pluck
[13:12:17] sjakalen: Can I in a view of a model handle parameters that are not declared anywhere else than in the controller/ def article_params ?
[13:13:06] cschneid_: has joined #RubyOnRails
[13:13:11] rwsq1: has joined #RubyOnRails
[13:13:34] acosonic: can I tap into existing rails s session and run rails console on existing objects?
[13:13:43] artto: has joined #RubyOnRails
[13:14:32] deur-: acosonic: I think https://github.com/charliesome/better_errors does what you want.
[13:14:54] Fuzai: has joined #RubyOnRails
[13:15:10] deur-: It's a debugging tool though, so only viable for a dev/staging environment.
[13:15:11] tbuehlmann: acosonic: depends on where the session is saved. if they are in the process memory, you can't really. if the session is in redis or an RDBMS, you can open up a rails console and get it by session id
[13:15:40] rwsq1: Hi all. I'm writing a gem and I want to get config from a Rails initializer, so in my class I'm reading from Rails.configuration.my_variable - however it seems Rails is nil when the gem loads. What's the better way of doing this?
[13:15:43] tbuehlmann: sjakalen: you can set instance variables in the controller and access them in the view
[13:16:13] matthewd: acosonic: I'd suggest adding `binding.pry` to the controller action where you want to intervene, if I understand your intent correctly
[13:16:38] Jameser: has joined #RubyOnRails
[13:16:43] matthewd: rwsq1: What config are you trying to read? Your own settings? Or a Rails built-in value?
[13:16:56] sjakalen: tbuehlmann: Because, what I am doing right now is to create a dropdown menu from another table. From this table I want the user to select a record. This record_id I need to use in the controller
[13:18:44] rwsq1: matthewd, I'm trying to ready my own settings from an initializer
[13:19:29] tbuehlmann: acosonic: is this in development or production?
[13:19:45] tbuehlmann: sjakalen: um, yeah, you have access to form fields in your controller
[13:20:28] rwsq1: s/ready/read :)
[13:20:53] conta: has joined #RubyOnRails
[13:22:22] tedwing: has joined #RubyOnRails
[13:23:56] matthewd: rwsq1: You'd generally supply your own configuration object, then
[13:24:50] matthewd: rwsq1: Then the user will do `YourGem.configure do |c|; c.good_stuff = true; end` in an initializer, or similar
[13:25:31] rwsq1: ah ok, I'll give that a go
[13:26:51] rwsq1: thanks matthewd
[13:27:42] Jameser: has joined #RubyOnRails
[13:30:58] mfoo: has joined #RubyOnRails
[13:31:49] alexandernst_: has joined #RubyOnRails
[13:32:11] alexandernst_: How can I force ruby to read an attribute I have in self. (AR object), instead of running a method that has the same name?
[13:32:22] alexandernst_: eg: self.foo <-- attr in a rails model instead of self.foo() <--- a method
[13:32:38] matthewd: alexandernst_: read_attribute(:foo)
[13:32:50] mfoo: Hello - I'm looking to implement structured logging for aggregation in the ELK stack. I've used LogRage with the Logstash formatter, but this doesn't change non-request logs (exceptions, asset serving etc seem to use the rack logger). I've tried the logstasher gem but this prints each line of a backtrace as a separate JSON message. Is there anybody with experience of this or a guide that's around?
[13:32:55] matthewd: alexandernst_: (or just `super`, if you're inside the `foo` method definition)
[13:33:33] mfoo: Ideally I'd like multiple appenders (human readable to a file, json to a file/socket)
[13:33:36] gusrub: has joined #RubyOnRails
[13:33:54] alexandernst_: matthewd: that worked like a charm :)
[13:34:05] bbrowning: has joined #RubyOnRails
[13:36:27] matthewd: mfoo: https://github.com/rails/rails/issues/26134 may be relevant to your interests -- possible that 5.0.2 has fixed the message-per-backtrace-line behaviour
[13:38:16] mfoo: matthewd: The breaking change was in 5.1.0, I'm on 3.2.22
[13:38:51] mfoo: matthewd: But the effect is the same - I believe the problem is the "logstasher" logger in this case
[13:39:22] itsautomatisch: has joined #RubyOnRails
[13:39:33] mfoo: Mostly I'm looking for a guide on "how to do logging the right way" or similar - logs for machine consumption.
[13:40:00] matthewd: Ah okay. That, I can't help with.
[13:40:13] mfoo: I can see many posts focussing on request logging, which is fine, but I would like to log stack traces in a structured way also
[13:42:11] bbrowning: has joined #RubyOnRails
[13:48:00] artto_: has joined #RubyOnRails
[13:48:33] jnoob22: has joined #RubyOnRails
[13:51:30] fourcolors: has joined #RubyOnRails
[13:51:56] alex88: has joined #RubyOnRails
[13:54:44] artto: has joined #RubyOnRails
[13:54:47] arBmind: has joined #RubyOnRails
[13:57:15] zpe: has joined #RubyOnRails
[14:01:36] hotpancakes: has joined #RubyOnRails
[14:01:58] harfangk: has joined #RubyOnRails
[14:03:46] tomasm-: has joined #RubyOnRails
[14:04:06] marr: has joined #RubyOnRails
[14:04:54] jenrzzz: has joined #RubyOnRails
[14:04:54] jenrzzz: has joined #RubyOnRails
[14:05:43] Jameser: has joined #RubyOnRails
[14:10:01] conta: has joined #RubyOnRails
[14:14:14] Nikamura: has joined #RubyOnRails
[14:14:39] ramortegui: has joined #RubyOnRails
[14:14:59] Nikamura: Hi guys, I want to test my ActiveJobs rescue_from in rspec, but it doesn't work, but when I add rescue => e to the perform method it works.
[14:15:29] mikecmpbll: nikamura : how're you testing?
[14:16:05] evansparkman: has joined #RubyOnRails
[14:17:07] Nikamura: https://gist.github.com/Nikamura/55b5eecdbd74c52f32fd3c8e2b921d6b
[14:17:15] evansparkman: has joined #RubyOnRails
[14:17:15] evansparkman: has joined #RubyOnRails
[14:17:52] Nikamura: @mikecmpbll https://gist.github.com/Nikamura/55b5eecdbd74c52f32fd3c8e2b921d6b
[14:17:53] pur3eval: has joined #RubyOnRails
[14:19:56] mauro1254: has joined #RubyOnRails
[14:21:15] DrYockel: has joined #RubyOnRails
[14:21:57] mikecmpbll: nikamura : try `perform_now`
[14:22:41] mikecmpbll: https://github.com/rails/rails/blob/master/activejob/lib/active_job/execution.rb#L40 looks like the exception handling occurs here, not in `perform`
[14:23:02] versigtig: has joined #RubyOnRails
[14:25:03] dionysus69: has joined #RubyOnRails
[14:29:58] Nikamura: @mikecmpbll thanks++
[14:32:08] SteenJobs: has joined #RubyOnRails
[14:34:03] DLSteve: has joined #RubyOnRails
[14:34:51] arBmind: has joined #RubyOnRails
[14:38:19] gremly: has joined #RubyOnRails
[14:41:52] artto: has joined #RubyOnRails
[14:42:31] SteenJobs: has joined #RubyOnRails
[14:42:32] conta: has joined #RubyOnRails
[14:44:14] Jameser: has joined #RubyOnRails
[14:47:08] brent__: has joined #RubyOnRails
[14:52:32] hotpancakes: has joined #RubyOnRails
[14:54:18] hotpanca_: has joined #RubyOnRails
[14:55:18] Jasaka: has joined #RubyOnRails
[15:01:12] Derperperd: has joined #RubyOnRails
[15:01:16] jscheel: has joined #RubyOnRails
[15:02:26] bbrowning: has joined #RubyOnRails
[15:05:57] jenrzzz: has joined #RubyOnRails
[15:05:57] jenrzzz: has joined #RubyOnRails
[15:06:06] mfoo: Can I ask why (in activesupport 3.2.22.3) ActiveSupport::Notifications::Instrumenter#instrument doesn't include the stack trace, only the class and the message?
[15:06:44] Derperperd: has joined #RubyOnRails
[15:06:48] chouhoulis: has joined #RubyOnRails
[15:07:29] matthewd: mfoo: No, not really
[15:07:55] workmad3: mfoo: why would it include the stack trace?
[15:08:25] LazyLama: has joined #RubyOnRails
[15:08:40] workmad3: mfoo: or are you meaning specifically if the instrumented block raises an exception?
[15:09:22] Derperperd: has joined #RubyOnRails
[15:09:25] matthewd: mfoo: "Why" questions about a 4-5 year old design choice, or in this case mere omission, seem... less than reasonable.
[15:09:30] epochwolf: workmad3: http://www.rubydoc.info/gems/activesupport/3.2.22.3/ActiveSupport/Notifications/Instrumenter See the source for #instrument
[15:10:00] mfoo: workmad3: I'm trying to implement some structured logs, in this case using a JSON log formatter. The payload passed to the formatter contains the exception class name and message as an array, but this gets put there by ActiveSupport::Notifications::Instrumenter#instrument (if an uncaught exception bubbles into action controller). This means my logger doesn't have access to the stacktrace.
[15:10:15] Derperperd: has joined #RubyOnRails
[15:10:27] workmad3: mfoo: you should still have $!
[15:10:58] mfoo: workmad3: ah, `$!.backtrace` exists, thanks
[15:11:29] workmad3: epochwolf: yeah, I was looking at that... it wasn't clear from the original question that it was asking just about instrumentation around an exception (I normally use instrumentation around non-exception paths in order to broadcast events happening :) )
[15:11:56] epochwolf: workmad3: no matter, question got answered. :)
[15:11:58] workmad3: mfoo: $! is the last exception raised, and is available during a `rescue` block
[15:12:04] bga57: has joined #RubyOnRails
[15:12:18] workmad3: epochwolf: yeah... which is why I asked if it was specifically for dealing with an exception ;)
[15:12:25] epochwolf: $! is also thread-local, iirc.
[15:12:28] matthewd: mfoo: To be clear: "I'm stuck and can't upgrade, do you have any ideas how I can work around this?" -- okay. "Why didn't someone anticipate my need for this, half a decade ago?" -- not okay.
[15:13:45] mfoo: matthewd: I ofcourse appreciate that people don't anticipate all possible use cases. I was mostly trying to ask "am I doing this wrong, or is this an oversight"
[15:14:30] epochwolf: mfoo: even if it was an oversight, that's not going to help your situtation as the only available option is to upgrade to a version that corrects that oversight.
[15:14:51] mfoo: I would also be happy with an answer such as "this was improved in version X"
[15:15:01] workmad3: mfoo: it was improved in 5.0.0 :)
[15:15:06] dblessing: has joined #RubyOnRails
[15:15:07] mfoo: To my detriment I hadn't checked the latest source
[15:15:09] workmad3: (where they added `payload[:exception_Object]`
[15:15:14] workmad3: *exception_object
[15:15:17] mfoo: workmad3: ah, thanks
[15:15:39] kristofferR: has joined #RubyOnRails
[15:15:55] epochwolf: Solution to your minor issue is to upgrade 2 major versions. ;)
[15:16:14] hotpancakes: has joined #RubyOnRails
[15:16:18] mfoo: And a ruby version
[15:16:20] workmad3: or use the ruby feature that could easily have been the reason why they didn't bother in the first place :)
[15:16:33] epochwolf: mfoo: ruby 1.9 to ruby 2.2 isn't that big of a jump.
[15:16:45] conta: has joined #RubyOnRails
[15:16:56] workmad3: even to 2.3 isn't too bad... 2.4 can be a bit harder
[15:17:11] matthewd: workmad3: Conveniently, the issue for said improvement answers the 'why' anyway :)
[15:17:29] matthewd: https://github.com/rails/rails/pull/16418
[15:17:37] epochwolf: workmad3: The unified integer class?
[15:18:44] workmad3: epochwolf: yeah... I've noticed it causing more warnings when I've bumped up to it... not had any complete failures yet, but I'm cautious about pushing all the way too quickly
[15:18:53] workmad3: matthewd: haha :) an entire thread of people that don't know about $!? :)
[15:19:23] epochwolf: workmad3: actually, they designed notifier to cross process boundaries.
[15:19:30] workmad3: epochwolf: ah, good point
[15:19:33] epochwolf: So $! wouldn't be available.
[15:19:45] workmad3: at least, not automatically available...
[15:20:07] matthewd: workmad3: Even without the process-crossing, $! could be mangled by the first registered instrumenter for the given event, before you get your hands on it
[15:21:39] dblessing: has joined #RubyOnRails
[15:23:33] patarr: has joined #RubyOnRails
[15:23:50] lamicka: has joined #RubyOnRails
[15:27:32] agent_white: has joined #RubyOnRails
[15:28:12] agent_white: Mornin' folks
[15:29:28] mdhas: has joined #RubyOnRails
[15:30:49] ych: has joined #RubyOnRails
[15:31:18] mikkel-: has joined #RubyOnRails
[15:31:26] artto: has joined #RubyOnRails
[15:33:40] pur3eval: has joined #RubyOnRails
[15:34:17] mdhas: has joined #RubyOnRails
[15:34:21] mikecmpbll: has joined #RubyOnRails
[15:36:58] epochwolf: Anyone got a modern tutorial for switching a rails app (5.0) from ruby to jruby? Just looking to try it out. :)
[15:37:05] jscheel: has joined #RubyOnRails
[15:38:14] tenderlove: has joined #RubyOnRails
[15:40:35] GodFather: has joined #RubyOnRails
[15:40:55] GK___1wm____SU: has joined #RubyOnRails
[15:44:45] mikecmpbll: has joined #RubyOnRails
[15:48:55] doodlehaus: has joined #RubyOnRails
[15:51:32] artto: has joined #RubyOnRails
[15:52:42] zpe: has joined #RubyOnRails
[15:54:23] Fernando-Basso: has joined #RubyOnRails
[15:55:45] zpe: has joined #RubyOnRails
[15:56:29] SteenJobs: has joined #RubyOnRails
[15:56:57] artto: has joined #RubyOnRails
[16:02:05] kristofferR: has joined #RubyOnRails
[16:06:58] jenrzzz: has joined #RubyOnRails
[16:07:06] sid_fules: has joined #RubyOnRails
[16:07:23] Derperperd: has joined #RubyOnRails
[16:08:49] djbkd: has joined #RubyOnRails
[16:08:52] cschneid_: has joined #RubyOnRails
[16:09:14] djbkd: has joined #RubyOnRails
[16:18:49] GK___1wm____SU: has joined #RubyOnRails
[16:20:21] pawnbox: has joined #RubyOnRails
[16:23:46] mwlang: has joined #RubyOnRails
[16:23:55] hahuang61: has joined #RubyOnRails
[16:27:32] Suslov: has joined #RubyOnRails
[16:29:46] xall_: has joined #RubyOnRails
[16:32:38] patarr1: has joined #RubyOnRails
[16:34:25] brent__: has joined #RubyOnRails
[16:35:47] GK___1wm____SU: has joined #RubyOnRails
[16:35:53] brent__: has joined #RubyOnRails
[16:36:15] Violentr: has joined #RubyOnRails
[16:36:21] szulak_: has joined #RubyOnRails
[16:37:58] mdhas: has joined #RubyOnRails
[16:38:23] hotpanca_: has joined #RubyOnRails
[16:39:08] mustmodify: has joined #RubyOnRails
[16:39:31] mustmodify: Anyone with Warden experience: How can I get hold of the Rails session from within a Warden manager.after_set_user callback?
[16:40:08] mustmodify: There is cookie stuff in env but it looks like serialized stuff, not objects...
[16:40:28] hahuang65: has joined #RubyOnRails
[16:42:48] matthewd: mustmodify: If you have env, env['rack.session'] should be what you want, no?
[16:42:52] adlerdias_: has joined #RubyOnRails
[16:43:01] hotpancakes: has joined #RubyOnRails
[16:43:22] Xentil: has joined #RubyOnRails
[16:44:29] mc_fail: i'm trying to migrate from rails 3 to rails 4, but i'm getting weird error about my schema.rb
[16:44:32] mc_fail: https://gist.github.com/anonymous/d3ab1a347eb2ba9c47b78102ff42b030
[16:44:39] mc_fail: that's the part of the schema
[16:45:18] mc_fail: whem i launch my unit tests i'm getting ArgumentError: you can't redefine the primary key column 'host_location_id'. To define a custom primary key, pass { id: false } to create_table.
[16:45:22] jscheel: has joined #RubyOnRails
[16:45:25] mc_fail: what should i change?
[16:47:43] mustmodify: matthewd: I thought so, but ... cookies are independent of session, right?
[16:47:53] mc_fail: according to the source, it seems like activerecord wants my private key to be integer
[16:48:07] mc_fail: i also have composite keys
[16:48:30] matthewd: mustmodify: You asked for the session, not the cookies
[16:48:41] mwlang: has joined #RubyOnRails
[16:48:54] username1: has joined #RubyOnRails
[16:49:02] mustmodify: RIGHT! Wow I got confused.
[16:49:11] mustmodify: I'm trying to implement a "remember me" feature in Warden.
[16:49:14] matthewd: mc_fail: You also also have two lines defining the same column name
[16:49:52] mc_fail: matthewd yeah, i just copipasted with a mistake
[16:49:55] mustmodify: matthewd: so I'll need access to cookies.
[16:50:05] mikecmpbll: has joined #RubyOnRails
[16:50:08] mc_fail: anyway, how do i fix this id issue?
[16:50:35] matthewd: mc_fail: Don't define the PK column separately
[16:51:14] mc_fail: yeah, than it will be an integer
[16:51:19] mc_fail: what if it's string?
[16:51:39] matthewd: :id option on create_table, IIRC
[16:52:17] matthewd: mustmodify: Rack::Request.new(env).cookies, or something, I think?
[16:53:03] pawnbox: has joined #RubyOnRails
[16:54:40] kristofferR: has joined #RubyOnRails
[16:55:10] hotpancakes: has joined #RubyOnRails
[16:55:16] mc_fail: is there any way to pass more than 1 column to :id ?
[16:55:18] fourcolors: has joined #RubyOnRails
[16:55:25] mc_fail: if i have composite key, for example?
[16:55:33] matthewd: No, we don't support composite keys at all
[16:56:37] sid_fules: has joined #RubyOnRails
[16:56:47] mc_fail: hmm, but how did :primary_keys => "host_id,ec2_instance_id", work on rails 3?
[16:56:59] mc_fail: i'm just trying to figure out how should i change it
[16:57:18] sid_fules: has joined #RubyOnRails
[16:57:29] matthewd: It didn't. Maybe you're using some other gem?
[16:58:17] mc_fail: doesn't look like
[16:59:02] mc_fail: it seems like it newer worked, hmm
[16:59:08] [Butch]: has joined #RubyOnRails
[17:02:26] zacts: has joined #RubyOnRails
[17:04:25] pur3eval: has joined #RubyOnRails
[17:05:06] GK___1wm____SU: has joined #RubyOnRails
[17:08:09] jenrzzz: has joined #RubyOnRails
[17:08:25] mdhas: has joined #RubyOnRails
[17:09:01] Lyubo1: has joined #RubyOnRails
[17:11:22] gusrub: has joined #RubyOnRails
[17:13:20] mdhas: has joined #RubyOnRails
[17:13:29] versigtig: has joined #RubyOnRails
[17:16:37] GK___1wm____SU: has joined #RubyOnRails
[17:21:02] conta: has joined #RubyOnRails
[17:21:29] AndrewIsHere: has joined #RubyOnRails
[17:22:48] hotpancakes: has joined #RubyOnRails
[17:23:17] szulak: has joined #RubyOnRails
[17:25:56] patarr: has joined #RubyOnRails
[17:27:31] fourcolors: has joined #RubyOnRails
[17:27:37] dionysus69: has joined #RubyOnRails
[17:31:40] GK___1wm____SU: has joined #RubyOnRails
[17:32:35] samdvr: has joined #RubyOnRails
[17:33:54] iliketurtles: has joined #RubyOnRails
[17:34:07] tildes: has joined #RubyOnRails
[17:35:25] mustmodify: matthewd: Thanks, that worked. I think. Turns out I can't reproduce the issue on my device... apparently iDevices lose their sessions within minutes of inactivity? Seems weird.
[17:36:52] sc0ty: has joined #RubyOnRails
[17:38:12] mochiyoda_: has joined #RubyOnRails
[17:39:28] bvcosta: has joined #RubyOnRails
[17:39:30] tildes: has joined #RubyOnRails
[17:40:18] sc0ty: Hi, just a quick question :) is rails supposed to escape <%= values %> on erb templates? or we have to escape them explicitly?
[17:40:54] mustmodify: sc0ty: google "rails html_safe"
[17:41:36] d0nn1e: has joined #RubyOnRails
[17:43:45] sc0ty: mustmodify: well, I did my googling, but some places tell me that the values will be escaped others say it wont. (my experience is that they dont)
[17:44:35] sc0ty: i wanted to know if there is a way to enable escaping by default
[17:44:49] zpe: has joined #RubyOnRails
[17:45:21] pawnbox_: has joined #RubyOnRails
[17:45:50] tbuehlmann: sc0ty: it's enabled by default. if you need values not to be escaped, there's the #raw helper method
[17:47:59] Cache_Money: has joined #RubyOnRails
[17:50:55] mustmodify: sc0ty: strings that come from parameters have a special attribute so Rails knows they are unsafe. Those will be escaped.
[17:51:41] sc0ty: ok, thanks :)
[17:51:57] mustmodify: sc0ty: http://stackoverflow.com/a/4252113/1521631
[17:52:25] mustmodify: pretty decent explanation, though he didn't start with what I said about params, which would have been a good idea.
[17:53:23] matthewd: > strings that come from parameters have a special attribute
[17:53:26] matthewd: .. no they don't
[17:58:13] Derperperd: has joined #RubyOnRails
[18:00:00] ProtoJazz: has joined #RubyOnRails
[18:00:19] _djbkd: has joined #RubyOnRails
[18:01:21] mdhas: has joined #RubyOnRails
[18:01:30] iwada: has joined #RubyOnRails
[18:05:34] mustmodify: Well, I don't remember how, but Rails knows they are unsafe.
[18:09:20] jenrzzz: has joined #RubyOnRails
[18:09:20] jenrzzz: has joined #RubyOnRails
[18:13:05] Violentr: has joined #RubyOnRails
[18:13:28] tedwing: has joined #RubyOnRails
[18:14:18] netzfisch: has joined #RubyOnRails
[18:14:43] mikecmpbll: has joined #RubyOnRails
[18:14:52] itsautomatisch: has joined #RubyOnRails
[18:15:31] matthewd: It's not params: it's all strings that aren't explicitly marked as containing HTML
[18:17:38] keerthana: has joined #RubyOnRails
[18:21:52] uksio: has joined #RubyOnRails
[18:24:45] zpe: has joined #RubyOnRails
[18:27:25] hahuang65: has joined #RubyOnRails
[18:28:03] Cohedrin: has joined #RubyOnRails
[18:29:26] gusrub_: has joined #RubyOnRails
[18:33:52] Omnilord: has joined #RubyOnRails
[18:34:57] DoctorMonocular: has joined #RubyOnRails
[18:36:51] szulak: has joined #RubyOnRails
[18:37:12] szulak: has joined #RubyOnRails
[18:47:32] mdhas: has joined #RubyOnRails
[18:48:05] safetypin: has joined #RubyOnRails
[18:50:11] pur3eval: has joined #RubyOnRails
[18:50:24] fox_mulder_cp: has joined #RubyOnRails
[18:51:49] doublemalt_: has joined #RubyOnRails
[18:52:09] sid_fules: has joined #RubyOnRails
[18:52:53] zacts: has joined #RubyOnRails
[18:54:17] hotpancakes: has joined #RubyOnRails
[18:59:31] Sylario: has joined #RubyOnRails
[19:02:10] Sylario: Are doorkeep and Oauth2 the right tools to make an API and it's client?
[19:02:19] Sylario: *Doorkeeper
[19:06:36] mustmodify: has left #RubyOnRails: ()
[19:10:09] zpe: has joined #RubyOnRails
[19:14:25] szulak: has joined #RubyOnRails
[19:17:32] hotpancakes: has joined #RubyOnRails
[19:19:43] pulkit4tech: has joined #RubyOnRails
[19:25:08] GK___1wm____SU: has joined #RubyOnRails
[19:28:58] hotpancakes: has joined #RubyOnRails
[19:31:02] doodlehaus: has joined #RubyOnRails
[19:32:58] Or1on: has joined #RubyOnRails
[19:34:53] cpruitt_: has joined #RubyOnRails
[19:34:56] Aherin: has joined #RubyOnRails
[19:41:50] zpe: has joined #RubyOnRails
[19:45:31] mwlang: has joined #RubyOnRails
[19:47:55] mc_fail: hi everyone, again
[19:49:34] benlieb: has joined #RubyOnRails
[19:50:54] pur3eval: has joined #RubyOnRails
[19:51:28] mc_fail: i'm still trying to migrate my app to rails 4 and i'm getting weird error
[19:51:30] mc_fail: You tried to define an association named changes on the model HostmanagerConfig, but this will conflict with a method changes already defined by Active Record. Please choose a different association name.
[19:51:42] mc_fail: for this model https://gist.github.com/anonymous/f74733a83b99ea571781b52a7c2f7998
[19:52:05] mc_fail: the issue is, i really don't have anything named changes in HostmanagerConfig
[19:52:27] mc_fail: i don't even have a rough idea what is wrong
[19:53:04] srinidhi: has joined #RubyOnRails
[19:53:20] NoGodDamnIdea: has joined #RubyOnRails
[19:53:20] NoGodDamnIdea: has joined #RubyOnRails
[19:54:16] matthewd: mc_fail: It's complaining about that definition
[19:54:39] matthewd: That code, in your gist, is trying to define an association named changes
[19:55:06] mc_fail: is changes - some reserved name for rails methods?
[19:55:20] matthewd: Yes, that's what the error is saying
[19:55:25] dionysus69: has joined #RubyOnRails
[19:55:56] mc_fail: oh, fixing this one is going to be painful
[19:56:00] matthewd: It was previously only semi-reserved, in the sense that you were probably-unknowingly stomping on an AR method, and as long as you weren't trying to call it, it would probably be okay
[19:56:42] matthewd: But now we enforce those methods, because such accidental conflicts were prone to tripping people up at very surprising times
[19:57:26] matthewd: If you want to keep stomping, you can probably *approximate* it by defining the association with a different name, then aliasing that method to `changes`
[19:57:38] Derperperd: has joined #RubyOnRails
[19:57:40] fox_mulder_cp: has joined #RubyOnRails
[19:57:56] matthewd: ... but that's an "if it breaks, you get to keep all the pieces" idea ;)
[20:03:08] byteflame: has joined #RubyOnRails
[20:04:05] hakash: has joined #RubyOnRails
[20:05:08] tildes: has joined #RubyOnRails
[20:05:34] benlieb: has joined #RubyOnRails
[20:05:59] meoblast001: has joined #RubyOnRails
[20:06:36] doublemalt_: has joined #RubyOnRails
[20:06:54] matthewd: mc_fail: Actually, I think you might even be able to `undef_method :changes` just before you call `has_many`, then be able to define it with the "bad" name directly
[20:07:35] matthewd: mc_fail: It really depends whether you're using any Rails methods that internally depend on `changes` meaning what we define it as
[20:07:41] sid_fules: has joined #RubyOnRails
[20:08:05] matthewd: And most notably, that's something that could change, without warning, between any two versions -- even patch releases, in the extreme
[20:10:26] jenrzzz: has joined #RubyOnRails
[20:10:28] jenrzzz: has joined #RubyOnRails
[20:13:47] yigitsadic: has joined #RubyOnRails
[20:19:42] hotpanca_: has joined #RubyOnRails
[20:21:50] benlieb: is there a way to have an “else” format in render contexts? I’m getting a ActionController::UnknownFormat error when certain non-existant files are reqeusted (xyz.php) https://gist.github.com/benlieb/a6516a6ba611068f1fb30094ef4f6056
[20:25:25] mtkd: has joined #RubyOnRails
[20:37:33] lxsameer: has joined #RubyOnRails
[20:40:32] mc_fail: now it complains about :conditions keyword
[20:41:51] fox_mulder_cp: benlieb: drop it by nginx :)
[20:41:56] jenrzzz: has joined #RubyOnRails
[20:41:56] jenrzzz: has joined #RubyOnRails
[20:42:52] teefax: has joined #RubyOnRails
[20:43:33] gusrub: has joined #RubyOnRails
[20:45:34] matthewd: benlieb: format.any / format.all
[20:46:15] tildes: has joined #RubyOnRails
[20:49:42] zacts: has joined #RubyOnRails
[20:51:14] netzfisch: has joined #RubyOnRails
[20:51:24] FLeiXiuS: has joined #RubyOnRails
[20:53:42] _djbkd: has joined #RubyOnRails
[21:00:38] sid_fules: has joined #RubyOnRails
[21:02:47] username1: has joined #RubyOnRails
[21:02:54] AndrewIsHere: has joined #RubyOnRails
[21:03:56] _djbkd: has joined #RubyOnRails
[21:04:30] jenrzzz: has joined #RubyOnRails
[21:07:40] mwlang: has joined #RubyOnRails
[21:10:00] tildes_: has joined #RubyOnRails
[21:23:46] pwnd_nsfw`: has joined #RubyOnRails
[21:24:04] tildes: has joined #RubyOnRails
[21:24:35] itsautomatisch: has joined #RubyOnRails
[21:26:04] jenrzzz: has joined #RubyOnRails
[21:26:05] jenrzzz: has joined #RubyOnRails
[21:29:38] fcser_: has joined #RubyOnRails
[21:31:24] versigtig: has joined #RubyOnRails
[21:31:27] tildes: has joined #RubyOnRails
[21:35:05] szulak: has joined #RubyOnRails
[21:35:19] mc_fail: ok, that's a weird one
[21:35:20] mc_fail: https://gist.github.com/anonymous/1221936728991cf5a6a12f2aa66d2d73
[21:35:22] jenrzzz: has joined #RubyOnRails
[21:35:22] jenrzzz: has joined #RubyOnRails
[21:35:31] mc_fail: it creates the table and i have it in schema.rb
[21:35:34] mc_fail: but test fails
[21:36:01] mc_fail: (i'm still upgrading from 3x to 4x)
[21:37:06] fox_mulder_cp: drop 4, use 5 ))
[21:37:18] duderonomy: has joined #RubyOnRails
[21:38:03] mc_fail: still why it might happen?
[21:38:51] mc_fail: the same tests worked fine in 3.2
[21:39:36] pur3eval: has joined #RubyOnRails
[21:42:26] tildes: has joined #RubyOnRails
[21:45:09] Brando753: has joined #RubyOnRails
[21:46:05] arBmind: has joined #RubyOnRails
[21:58:04] mc_fail: where does it create "in-memory" sqlite?
[21:58:14] mc_fail: is it in /dev/shm?
[21:58:54] chopin: has joined #RubyOnRails
[22:02:23] sid_fules: has joined #RubyOnRails
[22:04:29] arBmind: has joined #RubyOnRails
[22:08:26] benlieb: has joined #RubyOnRails
[22:10:48] dminuoso: http://edgeapi.rubyonrails.org/classes/ActionController/Responder.html
[22:10:49] dminuoso: y u no work
[22:10:54] dminuoso: ACTION pokes Radar 
[22:11:05] dminuoso: Where are the omniscient beings when you need them. :S
[22:11:25] dminuoso: It's been at least 10 seconds without a response from Radar. I want my money back.
[22:11:59] versigtig: has joined #RubyOnRails
[22:12:19] mc_fail: what exactly does rake test triggers?
[22:12:35] mc_fail: i cannot find where this database is populated
[22:12:48] mc_fail: even though i see it is being populated in logs
[22:15:05] jenrzzz: has joined #RubyOnRails
[22:18:03] shinnya: has joined #RubyOnRails
[22:18:08] dminuoso: mc_fail: It invokes a raketask that will run your Minitest suite.
[22:18:20] dminuoso: mc_fail: It does this in the testing environment.
[22:22:44] patarr: has joined #RubyOnRails
[22:24:40] pawnbox: has joined #RubyOnRails
[22:29:08] NoGodDamnIdea: has joined #RubyOnRails
[22:29:08] NoGodDamnIdea: has joined #RubyOnRails
[22:29:18] jenrzzz: has joined #RubyOnRails
[22:29:18] jenrzzz: has joined #RubyOnRails
[22:33:16] patarr: has joined #RubyOnRails
[22:33:48] theunraveler: has joined #RubyOnRails
[22:36:02] theunraveler: has joined #RubyOnRails
[22:38:23] kristofferR: has joined #RubyOnRails
[22:40:24] pur3eval: has joined #RubyOnRails
[22:41:45] Radar: dminuoso: busy today. at home and packing before a holiday
[22:50:08] universa1: has joined #RubyOnRails
[22:50:45] patarr: Is there a way to write an rspec expect.receive to check for it being called with "X" out of the many times it was called? I don't care about the other messages, just as long as _one_ of them was it being called with "X"
[22:58:00] efy: has joined #RubyOnRails
[23:07:05] universa1: has joined #RubyOnRails
[23:12:37] tvw: has joined #RubyOnRails
[23:14:22] arBmind: has joined #RubyOnRails
[23:16:18] Robtop__: has joined #RubyOnRails
[23:16:21] hotpancakes: has joined #RubyOnRails
[23:17:43] hahuang65: has joined #RubyOnRails
[23:18:01] sloggerkhan: has joined #RubyOnRails
[23:19:08] Axsuul: How do you guys determine when to use single/double quotes? I need a good rule.. mine is all over th eplace
[23:20:34] apeiros: axsuul: I just use double quotes all the time
[23:21:29] libastral: has joined #RubyOnRails
[23:23:00] havenwood: axsuul: I just use single quotes unless there's a reason to use double quotes. Or I use double quotes all the time on repos where that's the thing being done.
[23:23:12] havenwood: axsuul: When in Rome...
[23:23:13] Axsuul: cool thanks everyone
[23:23:44] quazimodo: has joined #RubyOnRails
[23:24:06] pawnbox: has joined #RubyOnRails
[23:24:16] jcm: has joined #RubyOnRails
[23:24:42] iszak: has joined #RubyOnRails
[23:26:19] versigtig: has joined #RubyOnRails
[23:27:30] universa1: has joined #RubyOnRails
[23:27:32] Depili: has joined #RubyOnRails
[23:27:33] Synthead: has joined #RubyOnRails
[23:29:34] benlieb: has joined #RubyOnRails
[23:35:20] xibalba: has joined #RubyOnRails
[23:40:38] artto: has joined #RubyOnRails
[23:40:56] carlosd: has joined #RubyOnRails
[23:41:07] pur3eval: has joined #RubyOnRails
[23:43:51] universa1: has joined #RubyOnRails
[23:45:31] evansparkman: has joined #RubyOnRails
[23:47:02] sid_fules: has joined #RubyOnRails
[23:48:22] jcm: has joined #RubyOnRails
[23:52:22] hotpanca_: has joined #RubyOnRails
[23:57:46] pwnd_nsfw: has joined #RubyOnRails