« Back to channel list

#RubyOnRails - 25 April 2017

« Back 1 day Forward 1 day »
[00:07:22] carlosd: Just discovered that $(document).on 'ready' has been removed from jQuery 3 :P
[00:07:40] carlosd: This explains a lot :)
[00:12:07] nahtnam: has joined #RubyOnRails
[00:24:02] Rodya_: has joined #RubyOnRails
[00:39:39] brent__: has joined #RubyOnRails
[00:41:21] FCser: has joined #RubyOnRails
[00:43:00] arathald: has joined #RubyOnRails
[00:45:44] duderonomy: has joined #RubyOnRails
[00:46:27] HoierM_: has joined #RubyOnRails
[00:48:38] aguynamedben: has joined #RubyOnRails
[00:49:14] rfoust: has joined #RubyOnRails
[00:55:28] xco: has joined #RubyOnRails
[00:58:10] quuxman: has joined #RubyOnRails
[00:58:13] quuxman: Has anybody used Rails Admin? I'm trying to add a link to a foo_id field to the corresponding object in the views, and can't even figure out how to modify a view at all
[01:05:20] cam27: has joined #RubyOnRails
[01:08:52] Rodya_: has joined #RubyOnRails
[01:18:03] xco: a little doubt here. on this line https://gist.github.com/siaw23/7318f46ae3f81bf9555c379af11b34bd#file-job-rb-L12
[01:18:19] xco: i want to pass the id to the ImageResponse.find(id)
[01:19:05] xco: can i just do ImageResponse.find(params[:’#{id}’]) here?
[01:24:16] bronson: has joined #RubyOnRails
[01:26:50] quuxman: Well I figured out how to completely replace a view for a model, but I want to just add links to certain fields
[01:28:58] baweaver: Why are you doing that though?
[01:29:18] baweaver: you can just do params[:id] in a controller
[01:29:21] romeoh: has joined #RubyOnRails
[01:29:26] baweaver: but what you have is something else entirely from a controller
[01:29:33] xco: it’s a job
[01:29:35] xco: in a job
[01:29:42] baweaver: making this a very odd question considering you're passing an id in as a method argument
[01:29:47] romeoh_: has joined #RubyOnRails
[01:29:52] xco: so the process method takes an id, and finds that item with that id
[01:30:04] chouhoulis: has joined #RubyOnRails
[01:30:15] baweaver: Line 11 is providing the id for 12
[01:30:25] baweaver: which is why I asked if you've tried it yet
[01:30:33] xco: yes i did
[01:30:35] xco: and i get
[01:30:37] baweaver: because params won't be accessible from there unless this is partial code
[01:30:42] xco: “undefined method `match' for 0:Fixnum “
[01:31:03] baweaver: Is ImageResponse an ActiveRecord object?
[01:31:08] xco: yes it is
[01:31:24] baweaver: Can you gist the full stack trace?
[01:31:26] baweaver: There's something missing here.
[01:32:12] baweaver: quuxman: Can't say I've dealt with ActiveAdmin before. Just so you know I'm not ignoring you to be mean or anything.
[01:32:42] xco: baweaver: the full trace looks like this https://gist.github.com/siaw23/7318f46ae3f81bf9555c379af11b34bd#file-full-txt
[01:32:56] quuxman: baweaver: RailsAdmin is different than ActiveAdmin
[01:33:04] baweaver: Well that too then :P
[01:34:07] baweaver: Have you done anything to the find method there?
[01:34:33] xco: baweaver: is that to me?
[01:34:38] baweaver: Line 22 and 23 are super confusing given line 12. Are you sure it's erroring there?
[01:35:08] cam27: has joined #RubyOnRails
[01:35:25] baweaver: It looks like line 12 is working, and the error is somewhere else.
[01:35:29] xco: it’s also pointing to this line https://gist.github.com/siaw23/7318f46ae3f81bf9555c379af11b34bd#file-job-rb-L19
[01:37:24] baweaver: Line 38 of fulltext is where it tries to save, and then you hit 25 which is calling a slew of callbacks, the ones on 22 and 23 likely being where some issue is
[01:37:46] baweaver: maybe related to redis_model as well on lines 20/21
[01:38:09] baweaver: then line 14 is the last part of your app that's doing something potentially odd
[01:38:11] brent__: has joined #RubyOnRails
[01:38:31] baweaver: check around the image_response and similar_object models, something is off on them
[01:39:27] baweaver: https://gist.github.com/siaw23/7318f46ae3f81bf9555c379af11b34bd#file-full-txt-L14 - that one specifically. zincrby right above is doing something odd.
[01:40:04] xco: which means there’s nothing wrong with https://gist.github.com/siaw23/7318f46ae3f81bf9555c379af11b34bd#file-job-rb ? because i spent days checking image_response and similar_object models and couldn’t find anything
[01:40:17] baweaver: Doesn't look like it
[01:40:34] baweaver: I'd set binding.pry right around there and look at what gets passed where
[01:40:43] baweaver: if you can find where that 0 gets through to redis, that's probably your irk
[01:42:54] baweaver: xco: I won't have too much more time before I check out for a bit, but if you post those two models I'll take a peek and see if I can spot something
[01:43:42] xco: baweaver: i’d be grateful cause i have searched for days and can’t find anything… with binding.pry of course
[01:44:27] baweaver: never know, I always try and ask as many questions as possible
[02:05:21] libastral: has joined #RubyOnRails
[02:35:25] cam27: has joined #RubyOnRails
[02:40:16] hadricus: Is there a better way of achieving has_secure_password validation than this: https://gist.github.com/nmanzi/21aa316549dd2c0ac258aaf974fe8ffc
[02:41:32] hadricus: In the "validation" context, I'm building a model object from a factory, but when validate_confirmation_of runs against the factory built object, it fails because the password is populated. So I've broken it into a child context block and create a Model.new.
[02:41:36] hadricus: I'm sure there's a better way?
[02:42:12] hadricus: I should specify this is an rspec spec, I'm testing for has_secure_password.
[02:44:41] Jameser: has joined #RubyOnRails
[02:46:59] quuxman: OK I just hacked together a solution. Now I want to know how to apply a configure pretty_value call to a whole bunch of fields in RailsAdmin
[02:51:24] Coldblackice: has joined #RubyOnRails
[03:00:08] quirkycoders: has joined #RubyOnRails
[03:07:51] cam27: has joined #RubyOnRails
[03:16:51] patarr: has joined #RubyOnRails
[03:18:41] romeoh: has joined #RubyOnRails
[03:20:35] Rodya_: has joined #RubyOnRails
[03:22:07] hugo_dc: has joined #RubyOnRails
[03:23:15] Tempesta: has joined #RubyOnRails
[03:36:57] armyriad: has joined #RubyOnRails
[03:44:19] hndk: has joined #RubyOnRails
[04:17:33] rakm: has joined #RubyOnRails
[04:19:53] romeoh: has joined #RubyOnRails
[04:21:17] Rodya_: has joined #RubyOnRails
[04:29:59] ger0: has joined #RubyOnRails
[04:43:46] dionysus69: has joined #RubyOnRails
[04:43:48] dminuoso: !goodmorning
[04:43:48] helpa: おはよう ございます
[04:57:34] dminuoso: I agree with you completely.
[05:20:41] MrCrackPotBuilde: has joined #RubyOnRails
[05:22:05] romeoh: has joined #RubyOnRails
[05:23:21] Rodya_: has joined #RubyOnRails
[05:27:11] MrCrackPotBuilde: im getting the rails abort error when using rails generate scaffold do i just install the gem pty???
[05:28:17] MrCrackPotBuilde: sorry command not found not error abort
[05:29:05] havenwood: MrCrackPotBuilde: have you run `bundle` and are you prefixing your command with `bundle exec`?
[05:30:17] MrCrackPotBuilde: i use bundle install then this -- rails g scaffold User name:string email:string
[05:34:15] craysiii: i know this isn't #opal but i was wondering if anyone had an open source project integrating opal into rails that I could have a peek at just to see how its really used
[05:40:04] havenwood: MrCrackPotBuilde: Confirm it still fails in the context of your Gemfile.lock bundle: bundle exec rails g scaffold User name:string email:string
[05:42:45] cgfbee: has joined #RubyOnRails
[05:43:05] MrCrackPotBuilde: it worked with bundle exec rails g scaffold User name:string email:string
[05:43:40] MrCrackPotBuilde: thanks is this a new feature of rails 5 ??? if i want to make a new controller same thing bundle exec rails g controler staticPage
[05:47:15] m13io: has joined #RubyOnRails
[05:54:26] morfin: has joined #RubyOnRails
[05:54:34] morfin: i have maybe a bit strange question
[05:55:34] morfin: Can you broadcast using ActionCable.server.broadcast from worker being executed in Sidekiq?
[05:57:25] dminuoso: Seriously morfin? From C++ to Rails? :|
[05:59:03] morfin: why you ask again?
[05:59:16] morfin: basically at my workplace we use RoR
[05:59:45] dminuoso: morfin: I couldn't remember the reason. I figured if I asked again you'd have forgotten and not remind me.
[05:59:48] dminuoso: Guess I lost that bet.
[05:59:57] morfin: and i want to notify user that his job has been finished so he should be able to see emails processing in admin panel
[06:00:52] dminuoso: morfin: You just have to specify the url for your redis in your cable.yml explicitly.
[06:01:48] dminuoso: morfin: Well to be more precise you have to use the redis adapter to begin with.
[06:02:06] Kilo`byte: has joined #RubyOnRails
[06:02:12] dminuoso: morfin: The reason is that the default async adapter sucks.
[06:02:28] dminuoso: morfin: Once you switch you can just do a straight ActionCable.server.broadcast
[06:12:33] drale2k_: has joined #RubyOnRails
[06:12:40] srinidhi: has joined #RubyOnRails
[06:15:51] morfin: well, since Sidekiq use Redis anyway i don't care much
[06:16:56] morfin: and yes, about C++ - i stalled a bit. Need lots of reading because i underestimated complexity of task i want to do
[06:20:22] quirkycoders: has joined #RubyOnRails
[06:21:10] drale2k_: has joined #RubyOnRails
[06:22:56] srinidhi: has joined #RubyOnRails
[06:23:03] romeoh: has joined #RubyOnRails
[06:27:15] pwnd_nsfw: has joined #RubyOnRails
[06:27:34] conta: has joined #RubyOnRails
[06:29:50] drale2k_: has joined #RubyOnRails
[06:35:22] pLaTo0n: has joined #RubyOnRails
[06:36:04] drale2k_: has joined #RubyOnRails
[07:05:29] pLaToOn: has joined #RubyOnRails
[07:07:04] morfin: btw why Sidekiq can't reload workers when i change code?
[07:08:33] platoon23: has joined #RubyOnRails
[07:13:31] Radar: morfin: because Rails does that code reloading and Sidekiq doesn't run within that "domain"
[07:15:17] r3vDev: has joined #RubyOnRails
[07:16:27] arBmind: has joined #RubyOnRails
[07:18:06] tbuehlmann: morfin: when using sidekiq >= 4.2 and rails >= 5.0, sidekiq will pickup code changes in your workers
[07:18:22] tbuehlmann: (in development, that is)
[07:21:34] osliusar: has joined #RubyOnRails
[07:23:58] romeoh: has joined #RubyOnRails
[07:25:05] Rodya_: has joined #RubyOnRails
[07:25:29] rgr_: has joined #RubyOnRails
[07:32:51] marr: has joined #RubyOnRails
[07:34:18] morfin: hmm weird
[07:35:09] morfin: sidekiq 3.4.2
[07:36:54] helpa: has joined #RubyOnRails
[07:38:25] Qchmqs: has joined #RubyOnRails
[07:41:30] ejnahc_: has joined #RubyOnRails
[07:42:44] arBmind: has joined #RubyOnRails
[07:43:41] xhoy: Rails has these nice Model.where(start: date1..date2) things, i tried to reproduce something like that isn't a 'standaard' ruby magic thing isn't it?
[07:46:28] tbuehlmann: date1..date2 is a range, so that's just ruby
[07:47:34] osliusar: has joined #RubyOnRails
[07:48:46] morfin: has joined #RubyOnRails
[07:49:10] morfin: heh and no Sinatra required
[07:51:02] tbuehlmann: right, like celluloid
[07:53:12] osliusar: has joined #RubyOnRails
[07:57:29] xhoy: tbuehlmann: ow thanks, never looked at it that way :) everything is an object...
[07:57:42] Radar: xhoy: https://github.com/radar/by_star
[07:58:16] xhoy: Radar: thanks
[07:58:21] Radar: all good :)
[07:59:07] xhoy: but i have a Model.active_in_periode(d1,d2) method with some complex queryies :) and its weird writing it two ways :)
[08:01:36] ferr: has joined #RubyOnRails
[08:06:00] mikecmpbll: has joined #RubyOnRails
[08:11:20] cgfbee: has joined #RubyOnRails
[08:16:22] blackmesa: has joined #RubyOnRails
[08:21:38] shotbug: has joined #RubyOnRails
[08:24:08] mjora7: has joined #RubyOnRails
[08:24:44] romeoh: has joined #RubyOnRails
[08:26:05] Rodya_: has joined #RubyOnRails
[08:28:07] drale2k_: has joined #RubyOnRails
[08:37:53] francuz: has joined #RubyOnRails
[08:38:15] dionysus69: has joined #RubyOnRails
[08:39:53] naftilos76: has joined #RubyOnRails
[08:56:43] osliusar: has joined #RubyOnRails
[09:01:22] patarr: has joined #RubyOnRails
[09:02:08] quazimodo: has joined #RubyOnRails
[09:02:56] drale2k_: has joined #RubyOnRails
[09:13:28] shotbug: has joined #RubyOnRails
[09:15:59] nobitanobi: has joined #RubyOnRails
[09:18:40] nobitanobi: If I have a table called `design_templates_3d` and I have a model called DesignTemplate3D which lives in a file named design_template_3_d, why am I getting uninitialized constant DesignTemplate3D, when doing DesignTemplate3D.new in console? I have a feeling it has something to do with the 3d suffix
[09:24:03] nobitanobi: fixed by changing file name to design_template3_d
[09:25:05] lxsameer: has joined #RubyOnRails
[09:25:24] romeoh: has joined #RubyOnRails
[09:26:02] drale2k_: has joined #RubyOnRails
[09:27:02] Rodya_: has joined #RubyOnRails
[09:29:44] sonOfRa: has joined #RubyOnRails
[09:32:01] workmad3: has joined #RubyOnRails
[09:33:57] arBmind: has joined #RubyOnRails
[09:35:30] chouhoulis: has joined #RubyOnRails
[09:39:09] blackmesa: has joined #RubyOnRails
[09:44:15] cgfbee: has joined #RubyOnRails
[09:47:27] quazimodo: has joined #RubyOnRails
[09:56:43] dionysus69: has joined #RubyOnRails
[10:13:45] drale2k_: has joined #RubyOnRails
[10:15:04] frojnd: has joined #RubyOnRails
[10:15:12] frojnd: Hello there.
[10:17:27] frojnd: I have a question regarding routes and scopes in my routes.rb I have scope "bla", modoule "bla" do reources :something do get :another_something end end
[10:17:38] frojnd: The problem is I don't see any paths on the left side
[10:17:50] frojnd: like if I do it without scope
[10:19:04] frojnd: I mean normally I would just do something_path
[10:19:16] frojnd: but now I have bla/something and I don't know how to call path on that
[10:19:33] frojnd: also is there a way to just call something_path and auto prepand bla ?
[10:22:10] frojnd: I think I figured it out
[10:25:45] frojnd: nope did not
[10:26:07] romeoh: has joined #RubyOnRails
[10:27:37] Rodya_: has joined #RubyOnRails
[10:28:11] Takumo: if its just inside a `scope` block it shouldn't affect the path variable names
[10:28:31] Takumo: but you may not get the routes listed if you're using a scope to filter the matchable routes
[10:29:07] Takumo: frojnd: ^
[10:29:07] frojnd: yeah, I'm not getting listed routes
[10:29:24] Takumo: is it just a simple `scope` call or is there other stuff, could you paste the routes.rb ?
[10:29:31] Takumo: (into gist or something, not here!)
[10:29:37] frojnd: Takumo: yah ok
[10:30:22] HoierM_: has joined #RubyOnRails
[10:30:32] frojnd: Takumo: https://gist.github.com/frojnd/1c2d8c4d11357d03a5c21ec8fed1b0ee
[10:31:17] Takumo: ok, what would happen if you removed that module param on the scope call, and just added "super_users/" to one of the controllers
[10:31:21] Takumo: do the routes get listed then?
[10:32:46] frojnd: Takumo: added "super_users/" how? I meane where prepand?
[10:33:00] frojnd: Takumo: like at the very beginning
[10:33:17] frojnd: instead of session/new "super_users/session/new" ?
[10:34:26] Takumo: "super_users/session#new" though you should just be able to use `resource :session, controller: 'super_users/sessions'` in place of your current routes
[10:34:27] frojnd: Takumo: then I get supervisor_user_session_new GET /supervisor_users/supervisor_user/session/new(.:format) not sure how can I do this for resources
[10:35:37] frojnd: Takumo: get 'session/new', to: "supervisor_users/sessions#new" gives me session_new GET /supervisor_users/session/new(.:format)
[10:35:55] Takumo: yeah, just trying to see what the inclusion of that :module param was
[10:36:54] frojnd: Takumo: well path is the same
[10:37:11] frojnd: But for the resources I don't see any paths
[10:37:30] GodFather: has joined #RubyOnRails
[10:37:57] xco: hello, will it be ok to have something like this in a private method in a controller? @direction ||= params.fetch(:direction, 'asc') what could be wrong with this line? haven’t seend params.fetch used like this before
[10:38:04] Fernando-Basso: has joined #RubyOnRails
[10:39:38] blackmesa: has joined #RubyOnRails
[10:48:12] xco: has joined #RubyOnRails
[10:59:38] xco: if some1 responded to this i got disconnected so posting again:
[10:59:39] xco: hello, will it be ok to have something like this in a private method in a controller? @direction ||= params.fetch(:direction, 'asc') what could be wrong with this line? haven’t seend params.fetch used like this before
[10:59:41] r3vDev: has joined #RubyOnRails
[11:01:29] arBmind: has joined #RubyOnRails
[11:02:00] patarr: has joined #RubyOnRails
[11:03:56] universa1: what are you worried about?
[11:07:24] marahin: has joined #RubyOnRails
[11:07:55] marahin: Hello! I need some of the great methods ActiveSupport provides in a JRuby script. I installed 'activesupport' gem but sadly it throws an exception that "No such file can be loaded", during require 'active_support' or require 'active_support'.
[11:08:08] marahin: Used ruby version is jruby (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]
[11:13:58] GodFather_: has joined #RubyOnRails
[11:27:13] romeoh: has joined #RubyOnRails
[11:28:22] Rodya_: has joined #RubyOnRails
[11:29:12] r3vDev: has joined #RubyOnRails
[11:32:14] blackmesa: has joined #RubyOnRails
[11:32:17] uksio: has joined #RubyOnRails
[11:39:05] r3vDev: has joined #RubyOnRails
[11:45:31] ldnunes: has joined #RubyOnRails
[11:46:55] Jameser: has joined #RubyOnRails
[11:48:15] marahin: has left #RubyOnRails: ("Textual IRC Client: www.textualapp.com")
[11:50:09] r3vDev: has joined #RubyOnRails
[11:50:47] cam27: has joined #RubyOnRails
[11:56:21] adlerdias: has joined #RubyOnRails
[12:00:59] drale2k_: has joined #RubyOnRails
[12:03:11] blackmesa: has joined #RubyOnRails
[12:03:18] romeoh: has joined #RubyOnRails
[12:03:43] romeoh_: has joined #RubyOnRails
[12:06:09] quirkycoders: has joined #RubyOnRails
[12:07:18] leeky: has joined #RubyOnRails
[12:14:02] fugee: has joined #RubyOnRails
[12:17:26] fugee: i have a types list in my address model ADDRESS_STATE_TYPES for creating a select list in form view, how can i use the list in my controller too to get state name Alabama when I only have in the params list address_state="AL"
[12:27:56] Jameser: has joined #RubyOnRails
[12:29:03] Rodya_: has joined #RubyOnRails
[12:31:33] frojnd: Is there a way to modify root path withour routes? Eg when I click on a link it would add preeflx "myprefix"/something/12
[12:31:38] frojnd: Is this possible in rails?
[12:32:18] frojnd: So instead of "/something/12" I would have "myprefix/something12" for all existing views and buttons
[12:32:35] fugee: in the web server config file you can create rewrites maybe
[12:34:00] fugee: i'm not experienced though, someone else would know better than me
[12:35:09] fugee: sounds like what he wants to do is unconventional within rails so i suggested that fix
[12:39:15] blackmesa: has joined #RubyOnRails
[12:40:45] frojnd: it is unconvecial
[12:41:02] frojnd: But I need it nevertheless
[12:46:49] jphase: has joined #RubyOnRails
[12:47:58] fugee: route's play tricks all by themselves they're hard to control, for example, just because you refer to a route by it's alias or real path doesn't mean that's the route your request is gonna hit, you may have to re-order them to make them work, for reasons unknown, so i wouldn't try to play any tricks on routes
[12:50:14] chouhoulis: has joined #RubyOnRails
[12:50:47] normie1: has joined #RubyOnRails
[12:52:14] normie1: how do i get my post request to a restful controller to return the id
[12:55:16] universa1: already gone, deploy to sub-directorywould ave been it ;)
[12:55:22] universa1: normie1: code? ...
[12:56:37] normie1: just a simple post request @task.save then in respond_to render :json => @task.id
[12:56:59] universa1: so what is the problem then?!
[12:57:00] HoierM: has joined #RubyOnRails
[12:57:31] TinkerTyper: has joined #RubyOnRails
[12:58:31] brent__: has joined #RubyOnRails
[12:58:36] hashrocket: has joined #RubyOnRails
[12:59:00] normie1: i may just be retarded
[13:01:11] normie1: without the json parse it acts as if nothing returned, that was the problem
[13:11:21] am55: has joined #RubyOnRails
[13:15:10] Knockys: has joined #RubyOnRails
[13:18:24] Knockys: Hello there, I'm having an issue with a join table, I want this table to have an extra column, but I don't know how to do it and how to access it after. Here is a gist with the two models that are joined : https://gist.github.com/GaldanM/fdf2dd52ac0413b4eaaf8108f656a735
[13:19:21] rfoust: has joined #RubyOnRails
[13:20:24] Knockys: (my question is about the column "grade" btw)
[13:24:44] beauby: has joined #RubyOnRails
[13:27:31] mwlang: has joined #RubyOnRails
[13:27:39] tbuehlmann: Knockys: instead of has_and_belongs_to_many, use has_many and has_many :through
[13:28:39] mwlang: I’ve got a routes.rb file closing in on 1,000 lines of code. Strongly considering breaking it up into several small files. Anybody else do this?
[13:29:12] xco: has joined #RubyOnRails
[13:29:15] mwlang: seeking opinions on pros and cons
[13:29:57] Rodya_: has joined #RubyOnRails
[13:30:32] Knockys: To both ? What will it change ? I'm already using this and it seems to be working, I just don't know how to handle the "grade" column, will has_many solve the problem ?
[13:30:37] tbuehlmann: mwlangm on how to do: http://blog.arkency.com/2015/02/how-to-split-routes-dot-rb-into-smaller-parts/
[13:31:51] tbuehlmann: Knockys: you don't have access to the join table when using has_and_belongs_to_many, right? well, you'd have access to the join table rows directly by having the has_many
[13:33:33] DLSteve: has joined #RubyOnRails
[13:35:07] Rodya_: has joined #RubyOnRails
[13:35:08] Knockys: Ok, I think I don't understand correctly how the has_many through works, I'll check on the docs. I still don't get how I will be able to get a specific row in the join table just by putting has_many through since I can already access student.courses for example
[13:36:03] mwlang: tbuehlmann: Ah, good idea about using eval to load and draw on included files in the routes. I was thinking to just have Rails.application.routes.draw do … end blocks in every file, but perhaps that doesn’t work.
[13:36:35] tbuehlmann: Knockys: oh, you would have a new model as well, the model for the join table
[13:37:14] Knockys: Ohhhhhhh ok ! You mean to make a through :newModel ?
[13:37:54] tbuehlmann: right, something like Course.has_many course_students; Course.has_many :students, through: :course_students
[13:39:35] Knockys: Ok, I think I see your point, I'll check it out, thank you :)
[13:41:41] bbrowning: has joined #RubyOnRails
[13:42:37] Technodrome: has joined #RubyOnRails
[13:43:28] tbuehlmann: Knockys: also, see http://guides.rubyonrails.org/association_basics.html#the-has-many-through-association
[13:43:41] mwlang: splitting out and just wrapping each file in Rails.application.routes.draw block works similar to the blog article (just confirmed it)
[13:44:43] Knockys: That's what I was looking at ahah, thanks ;)
[13:45:51] EXCHGR: has joined #RubyOnRails
[13:48:56] mwlang: ah, but the files aren’t properly reloaded on refresh with my approach.
[13:54:43] neruda: has joined #RubyOnRails
[13:55:20] yorickpeterse: has joined #RubyOnRails
[13:56:06] yorickpeterse: Inside a model's class method, how can I create a relation that has any default scopes applied, but not those from a current relation (e.g. when the method is called in a chain)
[13:56:31] yorickpeterse: e.g. you have a method `User.foo`, which is called as `User.where(...).foo`
[13:56:54] yorickpeterse: inside that method I basically want a relation for User with any default scopes applied, but nothing else
[13:57:07] yorickpeterse: there appears to be default_scoped, but it's not documented so I'm not sure if it's part of the public API
[13:57:34] neruda: keeping getting strange error when i try to submit form: https://gist.github.com/anonymous/7f6d905e6fd317134580e0ab0961e0f0
[13:57:38] neruda: any help appreciated
[14:00:19] Skull0Inc: has joined #RubyOnRails
[14:00:41] r3vDev: has joined #RubyOnRails
[14:03:21] tbuehlmann: yorickpeterse: do you want to work with that default scoped relation in that foo class method or return it?
[14:04:04] romeoh: has joined #RubyOnRails
[14:04:57] yorickpeterse: It's only used inside the method
[14:05:29] yorickpeterse: basically my method is called on a relation that is to be used for a WHERE EXISTS (as the body). I want to then construct the outer part of the query using the same model
[14:05:55] tbuehlmann: shouldn't you be able to just create the relation then? like User.where() inside that method?
[14:05:59] yorickpeterse: so you get something like `MyModel.where(current-relation-here.arel.exists)....` with the `MyModel.where` part not copying over anything from current-relation-here
[14:06:52] yorickpeterse: where(nil) doesn't work sadly :/
[14:06:55] yorickpeterse: e.g. say my method does this:
[14:07:16] yorickpeterse: def self.foo; where(nil).where(id: 4).to_sql; end # just as an example
[14:07:24] mauro1254: has joined #RubyOnRails
[14:07:37] patarr: has joined #RubyOnRails
[14:07:40] yorickpeterse: if I then do `MyModel.where(id: 5).foo` the returned relation includes both a WHERE for id = 4 and id = 5
[14:07:56] yorickpeterse: same goes for using MyModel instead of where(nil)
[14:08:23] yorickpeterse: using `default_scoped.where(id: 4)` does work
[14:08:44] tbuehlmann: okay, and the only problem is it's not documented as public API?
[14:09:00] yorickpeterse: Hm, seems #all uses #default_scoped
[14:09:10] yorickpeterse: https://github.com/rails/rails/blob/17ef58db1776a795c9f9e31a1634db7bcdc3ecdf/activerecord/lib/active_record/scoping/named.rb#L28
[14:10:33] tbuehlmann: I mean, it's only merging the default scope into a new relation, so..
[14:11:07] ResidentBiscuit: has joined #RubyOnRails
[14:12:44] yorickpeterse: has left #RubyOnRails: ()
[14:14:48] cek: Hi. How do I define an updater for a model that would work for a relation, like update_all, but with my things.
[14:16:54] handicraftsman: has joined #RubyOnRails
[14:17:01] Skull0Inc: question on deployment: when setting up on VPS/ AWS is the preferred "rails way" of deployment to serve rails app socket through Nginx? or should rails server (puma, unicorn..) be broadcastig just by itself without Nginx?
[14:17:39] tbuehlmann: Skull0inc: I prefer having an nginx as a reverse proxy
[14:18:53] Skull0Inc: That's how I have setup so far. Just wondering if rails server could just be broadcast on its own and what are advantages/disadvantages of each setup.
[14:19:45] Skull0Inc: Apart from load balancing, would it not be faster connecting directly to rails server rather than through nginx?
[14:21:18] tbuehlmann: shouldn't be much faster. the advantage is that nginx can serve your public files/assets directly without ever touching the rails stack
[14:22:56] tbuehlmann: also, nginx is quite good with dealing with slow clients
[14:23:23] Skull0Inc: Hmm, ok. Will try it that way. Thanks for your response!
[14:23:51] Skull0Inc: Kinda new to Rails and have a lot to learn.
[14:25:05] tbuehlmann: aaaand I'm off, happy hacking!
[14:25:30] Andr3as: tbuehlmann: half day off, eh? ;)
[14:30:34] mauro1254: Hi folks, I'm trying to write a gem but I don't know how to pass config data to it. Is there a guide on gem and initializers?
[14:32:38] mikecmpbll: has joined #RubyOnRails
[14:32:46] Jameser: has joined #RubyOnRails
[14:40:06] ksinkar: has joined #RubyOnRails
[14:40:58] mordof: mauro1254: i haven't made a gem before, so this may be wrong, but i think the normal pattern seems to be adding a self.configure block where you're making config.<items> available to be set
[14:41:45] mauro1254: mordof : something like this http://brandonhilkert.com/blog/ruby-gem-configuration-patterns/ ?
[14:42:24] mordof: potentially like a singleton config class with attr writers for the properties you need - and yielding that to the block provided.. then when people do config.<items> it's a writer to your singleton
[14:42:34] mordof: ACTION nods
[14:42:39] mordof: mauro1254: yep
[14:42:54] mauro1254: mordof : thx!
[14:43:14] mordof: that article describes exactly what i thought it might look like xD
[14:44:00] mauro1254: mordof : I hope it will work. Let's give a try!
[14:45:19] mordof: mauro1254: the article is written in a manner of test-driven development. things are written with a test, and expected to fail. keep that in mind when following the article, as the examples are mainly expected to fail through the article until near the end
[14:45:25] mordof: so don't stop half-way through
[14:45:42] DocWinter: has joined #RubyOnRails
[14:49:24] theunraveler: has joined #RubyOnRails
[14:50:29] r3vDev: has joined #RubyOnRails
[14:51:11] patarr1: has joined #RubyOnRails
[14:52:03] blackmesa: has joined #RubyOnRails
[14:52:51] mikecmpbll: has joined #RubyOnRails
[14:55:37] mwlang: has joined #RubyOnRails
[14:57:05] mwlang: what’s the deal with “identify to join room” I’m now being told every time I come back to Colloquy that I need t first identify to join room. I then type “/join #rubyonrails” and it works. (I’m obviously identified and have been for years…)
[15:00:00] Technodrome: has joined #RubyOnRails
[15:00:52] ovaltine: Why do I have to do this: bin/rails db:environment:set RAILS_ENV=test
[15:01:59] Skull0Inc: check your PATHS
[15:02:50] djgraham: has joined #RubyOnRails
[15:03:03] Skull0Inc: looks like that is using *system* rails. try using rbenv or RVM to manage your gems
[15:03:52] Skull0Inc: usually $PATHS are exported to ~/.bashrc or whichever your shell env is.
[15:04:00] ovaltine: i think its this actually https://github.com/DatabaseCleaner/database_cleaner/issues/445
[15:04:26] ovaltine: sorry Skull0inc i wasn't clear, my issue is why do i have to do db:env:set, rails without bin/rails works fine
[15:05:23] ahrs: has joined #RubyOnRails
[15:05:39] Skull0Inc: oh, think thats definitely different. Maybe someone else who has tackled that before can help.
[15:08:15] ovaltine: looks like i was inadvertently clobbering ar_internal_metadata on my test database which caused me to have to drop and create in certain circumstances
[15:08:54] choke: has joined #RubyOnRails
[15:09:23] pupsicle: has joined #RubyOnRails
[15:09:36] mordof: mwlang: might be a bug with your client? this room does require being registered and identified - but if you've already identified then it should just let you enter
[15:10:11] mordof: every time you log on to an irc server you need to identify though - so it depends on what you mean by "coming back" to it
[15:10:27] beauby: has joined #RubyOnRails
[15:10:36] mordof: if you're sitting idle - maybe Colloquy is actually disconnecting you?
[15:11:40] tbuehlmann: Andr3as: "half"
[15:15:32] justAllgood: has joined #RubyOnRails
[15:17:39] patarr: has joined #RubyOnRails
[15:17:53] quirkycoders: has joined #RubyOnRails
[15:18:40] arBmind: has joined #RubyOnRails
[15:22:40] mwlang: mordof: I think something changed on freenode.net, though…Colloquy hasn’t changed since 2014. The behavior changed last week and I first noticed it with “auto-joining” this channel. What I mean by “coming back” is that I seem to be disconnected if I don’t switch colloquy back to foreground for an extended period (I’m coding in the editor, so shouldn’t be losing network connection).
[15:24:14] ravster: has joined #RubyOnRails
[15:26:15] arBmind: has joined #RubyOnRails
[15:31:28] AzaToth: has joined #RubyOnRails
[15:33:12] mauro1254: mordof : it works!
[15:40:22] bachmann: has joined #RubyOnRails
[15:41:38] mordof: mwlang: true now that you mention it - i've been getting disconnected a bunch too and having to re-identify.. but i just assumed it was my network, because my internet at work kinda sucks
[15:41:45] DrYockel: has joined #RubyOnRails
[15:41:47] mordof: well, it's choppy and sometimes disconnects. otherwise it's fine
[15:41:50] mordof: mauro1254: nice! congrats :)
[15:42:16] mauro1254: mordof : the next step is to let the gem generate an initializers.
[15:43:04] mordof: make it so people don't have to search documentation to know what your gem offers is a good idea. documentation is still important though
[15:43:26] mauro1254: bin/rails generate mygem:install
[15:43:38] mauro1254: mordof : has it to do with rails generators?
[15:43:54] mordof: i don't pay much attention to generators - can't help you there
[15:44:09] mauro1254: mordof : ok, np
[15:50:54] arBmind: has joined #RubyOnRails
[15:52:45] juggler: has joined #RubyOnRails
[16:00:49] pLaTo0n: has joined #RubyOnRails
[16:03:17] justAllgood: has joined #RubyOnRails
[16:05:32] tercenya: has joined #RubyOnRails
[16:10:04] drale2k_: has joined #RubyOnRails
[16:11:32] gusrub: has joined #RubyOnRails
[16:12:26] justAllgood1: has joined #RubyOnRails
[16:15:39] richardjohn: has joined #RubyOnRails
[16:37:49] bbrowning: has joined #RubyOnRails
[16:38:45] teddysmoker: has joined #RubyOnRails
[16:45:51] gusrub: has joined #RubyOnRails
[16:49:15] dblessing: has joined #RubyOnRails
[16:58:21] srinidhi: has joined #RubyOnRails
[17:00:18] mikecmpbll: has joined #RubyOnRails
[17:03:01] blackmesa: has joined #RubyOnRails
[17:09:15] pupsicle: has joined #RubyOnRails
[17:28:29] mustmodify: has joined #RubyOnRails
[17:29:14] mustmodify: So the people who set up bots that fill in random forms on the internet... the ones we try to stop with catchas... what is their goal?
[17:29:26] cseder: has joined #RubyOnRails
[17:34:00] [Butch]: has joined #RubyOnRails
[17:35:53] mordof: mustmodify: highly depends on the forms. for ticket purchasing things for example - the goal is usually to buy all the tickets, and then sell the tickets for higher prices
[17:36:16] gusrub: has joined #RubyOnRails
[17:37:08] beauby: Is there a centralized place where the Rails Rack env variables are documented? (such as action_dispatch.request.request_parameters)
[17:37:10] mordof: if you're a blog filtering comments - the idea there is that generating backlinks requires posting content. comments are one section where backlinks could be placed - pretty sure this is considered bad though
[17:37:16] mordof: mustmodify: -^
[17:38:03] mordof: mustmodify: since there's bots that will try to find as many blogs as they can to automate posting comments with backlinks to their stuff. In the past this helped increase rank for search engines.. pretty sure google now penalises this
[17:38:59] mustmodify: ok. backlinks.
[17:39:26] mustmodify: I get a bunch of completely blank submissions. Weird.
[17:39:52] mordof: i wonder if they're attempting to inject code in - and either it renders nothing, or it gets filtered out?
[17:39:56] mordof: still be cautious about stuff
[17:40:16] mordof: also - captchas aren't terribly great at stopping bots if a person actually wants to get past them (unfortunately)
[17:41:09] jliberman: has joined #RubyOnRails
[17:41:11] mordof: it does mean the bots need to be programmed to handle it though - which for simple/smaller bots they're probably not going to bother
[17:44:17] mustmodify: well this one site is VERY simple. It's not actually on rails. It's on some gem named "serve" ..
[17:44:45] mustmodify: we don't even have a db. The only code just sends email. And the only think you could inject would be a body. So ...
[17:45:06] mustmodify: the only thing I really need to do I guess is just filter out the blanks. Still, odd.
[17:45:29] mordof: code injection has more purposes than just trying to attack the server
[17:45:51] mustmodify: I saw a fun js injection attach one time.
[17:46:08] mustmodify: harmless but funny, demonstrated that it could be an issue.
[17:46:37] mordof: a big reason why images were disabled by default in email clients is because code could be run to collect a users' authentication cookie, and send it to a third party
[17:47:00] mordof: then that third party has full access to your email if you've used the "remember me" feature at all
[17:47:01] mustmodify: Hunh. That's clever. I hadn't thought of that.
[17:47:29] mustmodify: I wondered why Google, et al were *so* passionate about that.
[17:47:38] mordof: ACTION nods
[17:48:10] mordof: pretty sure there's still that filter in place, but they've established some form of "trustworthiness" for which images get allowed by default
[17:48:19] mordof: i don't see that filter happening as much these days
[17:49:59] mordof: mustmodify: another risk for injection is things like ... i don't think this directly qualifies as phishing, but it's similar. posting a link which masquarades as something else, getting a user to log into one of their services.. but whether it be a fake site (actual phishing) or a means of monitoring what they enter... that third party steals cred
[17:49:59] mordof: entials that way
[17:49:59] uks: has joined #RubyOnRails
[17:50:17] mordof: code injected onto a page can place a link anywhere on the page, and make the links seem credible to the user
[17:54:21] mustmodify: yep. dangerous.
[17:54:57] mustmodify: Wish there was a way to find those devs and, even if it wasn't their idea, revoke their license to develop.
[17:55:08] mordof: no kidding
[17:57:18] mustmodify: one interesting thing about the bot that's submitting this form like two or three times an hour... there's a hidden field called "thank you message" and it's not being posted.
[17:57:32] mustmodify: The only parameter is "submitted", a datetime.
[17:59:26] mordof: oh so it's actually sending a built post request to your server, instead of navigating to your form and filling it out automated
[17:59:34] mustmodify: this is the source IP for one submission.
[17:59:36] mustmodify:
[17:59:51] mordof: ACTION views it with wget instead of a browser
[18:00:01] cagomez: has joined #RubyOnRails
[18:01:00] mordof: so an atuomated thing within the tor network is hitting your server with a premade post request
[18:01:02] mordof: fun times
[18:02:36] mordof: default page doesn't give any information about who's running that router either
[18:03:28] mustmodify: interesting. Just discovered that I'm adding 'submitted' so it is, in fact, a post with no body.
[18:03:51] mustmodify: Sure, but it's coming from a different IP each time.
[18:03:59] mustmodify: because tor.
[18:04:14] mordof: ACTION hasn't looked into tor much at all
[18:04:19] mustmodify: I totally respect tor for human rights stuff.
[18:04:20] mordof: ACTION doesn't really care about anonymity
[18:04:26] mustmodify: If you're in China
[18:04:35] mustmodify: s/China/GGGGGGiiiiiiiiiina/
[18:04:41] mordof: oh for sure, there's valid reasons to use it
[18:04:57] Technodrome: has joined #RubyOnRails
[18:05:03] mustmodify: anyway, easy fix I guess.
[18:05:07] quirkycoders: has joined #RubyOnRails
[18:05:10] mordof: ACTION nods
[18:05:11] mordof: filter time
[18:05:25] mustmodify: but I can't help but feel I'm plugging holes with my fingers or whatever-that-expression-is.
[18:05:43] mordof: yeah.. it feels dirty
[18:05:51] mordof: i don't know of any other way to deal with it though
[18:06:00] mustmodify: I could put in a captcha but my audience is SOOOO anti-technology... or, rather, intentionally-not-savvy...
[18:06:04] mordof: if IP rotates, then you can't just blacklist
[18:06:23] mustmodify: I imagine someone has a "blacklist all of Tor" thing but... I don't care enough.
[18:06:30] dionysus69: has joined #RubyOnRails
[18:06:35] Maletor: has joined #RubyOnRails
[18:06:40] mordof: i also don't think that's an appropriate response
[18:06:48] Maletor: how do i add an object to a habtm relation only if it doesn't already exist there?
[18:06:53] mordof: i guess that depends on your audience
[18:07:53] mustmodify: maletor: usually I'll do @object.relation.build(params) in the #new and #edit actions of a controller if I'm pretty sure they won't need bunches of entries.
[18:08:03] mustmodify: otherwise you have to build that out with js.
[18:08:13] Maletor: JS? this has nothing to do with JS
[18:08:14] mustmodify: or just have a separate resource for adding.
[18:08:35] Maletor: or even controllers for that matter
[18:08:40] mustmodify: You can use JS to add blank entries.
[18:08:53] mustmodify: Sorry, I made an assumption.
[18:08:57] mustmodify: Tell me more about your issue.
[18:09:33] Maletor: i have cars habtm people and people habtm cars
[18:09:47] User458764: Hi, how do I prioritise scss?
[18:09:56] Maletor: i want to do car.people.push(person) without adding a person if it's already in the join table
[18:10:33] mordof: it doesn't already handle that case?
[18:10:38] mustmodify: So there's no meta-data on this relationship? I mean, you don't need a "driver" model?
[18:10:40] mordof: that seems like something rails should already take care of...
[18:11:05] dionysus69: has joined #RubyOnRails
[18:11:32] mustmodify: It's probably an option or validation. If you had a driver model there... cars habtm drivers, drivers belong_to person or something... you could do a validation on the Driver model. But if there's no meta-data, then that may be overkill.
[18:11:57] mustmodify: oh wait... it wouldn't be driver. I'd have to think about the name of that relationship.
[18:12:50] mordof: maletor: http://stackoverflow.com/questions/1129781/has-and-belongs-to-many-avoiding-dupes-in-the-join-table
[18:12:58] mordof: does this address your issue?
[18:13:21] Maletor: that returns records as uniq from the table
[18:13:34] Maletor: you can do .include?(tag) but that's pretty inefficient
[18:13:46] mordof: ah, right
[18:14:23] mustmodify: well, you could put a unique index on the join table.
[18:14:42] mustmodify: It'd be efficient but I think it'll raise an error which you'd have to rescue.
[18:14:46] mustmodify: which is slow.
[18:15:06] mustmodify: ok so... since it isn't an option on habtm, here's what I would do.
[18:15:15] mustmodify: What's the name of your join table?
[18:15:16] mordof: maletor: http://stackoverflow.com/questions/4988630/habtm-uniqueness-constraint how bout this one
[18:15:20] mordof: looks a bit more promising
[18:15:32] mordof: nevermind
[18:15:35] mordof: that's effectively the same
[18:15:56] mordof: the only point in both that has any possibility of being useful is adding the constraint to the actual database table...
[18:16:08] mordof: which generally doesn't fit with the rails way of doing things
[18:16:11] jliberman: has joined #RubyOnRails
[18:16:32] mustmodify: maletor: What's your join table name?
[18:16:53] mustmodify: Well, s/he seems to have left.
[18:16:57] mustmodify: so that's nice.
[18:17:59] mordof: maletor: http://stackoverflow.com/questions/7112432/has-and-belongs-to-many-validation-such-that-users-cant-apply-multiple-times-to this seems to be the most efficient solution. dropping the use of habtm on each side and setting up the join table yourself
[18:18:10] mordof: that way you can add validations to it directly
[18:19:50] patarr: has joined #RubyOnRails
[18:20:04] gambl0re: has joined #RubyOnRails
[18:21:47] Maletor: gonna use .exists?
[18:22:22] mordof: how would you call that?
[18:24:05] Maletor: car.people.exists?(person_id: person.id)
[18:24:34] Maletor: then ... || car.people << preson
[18:25:23] mordof: i personally like the car.people << person unless car.people.exists(person) better
[18:25:36] mordof: but either way
[18:26:12] mordof: oh apparently it's deprecated to pass the object itself :(
[18:26:27] defsdoor: has joined #RubyOnRails
[18:27:38] mustmodify: maletor: join table name?
[18:28:54] patarr: has joined #RubyOnRails
[18:30:40] brent__: has joined #RubyOnRails
[18:31:40] gusrub: has joined #RubyOnRails
[18:34:49] drale2k_: has joined #RubyOnRails
[18:35:11] patarr: has joined #RubyOnRails
[18:37:36] rakm: has joined #RubyOnRails
[18:52:07] rakm: has joined #RubyOnRails
[18:59:24] tercenya: has joined #RubyOnRails
[19:00:54] Technodrome: has joined #RubyOnRails
[19:01:08] drale2k_: has joined #RubyOnRails
[19:01:49] gusrub: has joined #RubyOnRails
[19:04:08] rakm: has joined #RubyOnRails
[19:12:10] patarr: has joined #RubyOnRails
[19:21:23] GodFather: has joined #RubyOnRails
[19:21:24] tweeeaks: has joined #RubyOnRails
[19:22:06] patarr: has joined #RubyOnRails
[19:29:17] pupsicle: has joined #RubyOnRails
[19:29:24] quirkycoders: has joined #RubyOnRails
[19:30:59] quirkycoders: has joined #RubyOnRails
[19:32:10] mustmodify: has left #RubyOnRails: ()
[19:38:21] lxsameer: has joined #RubyOnRails
[19:42:27] amite: has joined #RubyOnRails
[19:43:15] patarr: has joined #RubyOnRails
[19:43:57] amite: hi all, do you see anything wrong this code: event.set('JobElapsedTime', ((Time.parse( event.get('EndTime') )- Time.parse( event.get('StartTime') )) / 60)) when I run this through logstash I get can't dup nilclass error
[19:44:32] whatasunnyday: has joined #RubyOnRails
[19:46:04] whatasunnyday: Hi! I'm not new to programming but a bit new to rails. I'm having a problem with my controller design. I have a ProjectsController and CommentsController. When you're visiting the project (and invoked the show action), you can add a comment from the project. The form posts CommentsController#create. It's working fine but how do I deal with error? I can use redirect_to but it doesn't show the form errors.
[19:47:03] mlt-: has joined #RubyOnRails
[20:00:42] gusrub: has joined #RubyOnRails
[20:02:34] patarr: has joined #RubyOnRails
[20:07:06] fryguy: whatasunnyday: re-render the form instead of redirecting
[20:07:57] mlt-: I have a form with a "batch" field, i.e. I want to create a bunch of individual objects iterating over items in that field and the rest on the form. It has to be either all or none. Hence I use transaction. I can validate an individual object only. How would I report an error back to a user? Right now I set instance variable @errors by copying @errors from the failed object. Is there a better way to handle batch object creation &
[20:07:57] mlt-: validation?
[20:11:39] whatasunnyday: @fryguy yeah i think that's the way to go, i was having issues with render earlier
[20:15:57] arBmind: has joined #RubyOnRails
[20:23:48] rakm: has joined #RubyOnRails
[20:23:56] aseibert: has joined #RubyOnRails
[20:25:07] patarr: has joined #RubyOnRails
[20:28:54] rgr: has joined #RubyOnRails
[20:37:42] beingjohnm: probably stupid question but can you run a controller method from an activejob? I generate a report (in the reports_controller) but it takes > 30 secs to generate with wicked_pdf. So I want to move the generation to a worker (queue the job from the controller) but wicked_pdf uses the templates in the report views. I don't really see how I can pass all of the variables to the views from the job without going back through reports_controlle
[20:38:18] beingjohnm: So, I'm looking to go <controller> -> <activejob> -> <controller>
[20:39:07] mikecmpbll: beingjohnm : not really. it's tricky, we've done the same thing a few months ago.
[20:39:13] DoctorMonocular: has joined #RubyOnRails
[20:39:27] gusrub_: has joined #RubyOnRails
[20:39:57] mikecmpbll: we needed 'view context' type stuff for the report rendering, so we built our own FakeViewContext class and included what modules we could from the rails framework
[20:40:23] mikecmpbll: patched current_user to work, etc
[20:40:26] beingjohnm: mikecmpbll: I've seen one article that renders the html in the controller and then passes that to adtivejob to render the pdfs but even rendering the html takes longer than I would like
[20:40:42] mikecmpbll: yeah, that's a nonsensical solution
[20:42:04] mikecmpbll: now, there's something interesting i read about in rails 5 (we've not upgraded just yet) where you can render views outside of actions
[20:42:46] mikecmpbll: https://evilmartians.com/chronicles/new-feature-in-rails-5-render-views-outside-of-actions
[20:43:01] gusrub: has joined #RubyOnRails
[20:44:13] beingjohnm: mikecmpbll: I'll look at view_context
[20:44:40] beingjohnm: Definitely not looking to upgrade to rails 5 any time soon.
[20:45:01] beingjohnm: I'm now old enough that I never want to upgrade anything if it works. :)
[20:46:04] mikecmpbll: that sounds like a perilous choice :)
[20:46:38] beingjohnm: the key being "if it works"
[20:47:15] mikecmpbll: but yeah, to mock the view stuff you'll want to look at ActionView::Base and it's @_controller and @_request instance vars
[20:47:50] beingjohnm: I used to upgrade Ubuntu or my Mac the day a new OS version was released. Or moving from Bootstrap 1 to 2. Inevitably there would be problems so now I schedule time for those types of things as too mnay responsobilities to deal with broken systems
[20:48:05] semperfried76: has joined #RubyOnRails
[20:49:27] mikecmpbll: yeah, it's all a balance. it's about giving maintenance due respect, rather than assuming/hoping it's something that can be done in and around everything else
[20:50:27] justAllgood: has joined #RubyOnRails
[20:51:16] beingjohnm: previously I would have taken that info about rails 5 and used that as my solution but not taken into account all of the effort of migrating the rest of the code base
[20:52:20] beingjohnm: I think deliverables and deadlines increasing with age is the real root of my upgrade paranioa
[20:56:12] rakm_: has joined #RubyOnRails
[20:56:53] amperry: has joined #RubyOnRails
[20:59:58] amperry: hi folks, I'm using the best_in_place gem (https://github.com/bernat/best_in_place) for a few forms, and on some of them, I want to prevent auto-completion; in normal forms, I'd put the hash "html: {autocomplete: :off}" somewhere in the line, but that doesn't seem to work. Is there a way to do this?
[21:02:39] dblessing: has joined #RubyOnRails
[21:03:57] mikecmpbll: amperry : `html_arrs` as listed in the options for the gem you linked to?
[21:06:34] amperry: mikecmpbll: this is one of *those* days. Thanks!
[21:07:32] aFineDay: has joined #RubyOnRails
[21:07:35] cagomez: has joined #RubyOnRails
[21:07:41] ArTiSTiX: has joined #RubyOnRails
[21:08:41] duderonomy: has joined #RubyOnRails
[21:11:03] cam27: has joined #RubyOnRails
[21:12:00] semperfried76: yo folks, I'm at railsconf!
[21:12:45] chrisgopher: has joined #RubyOnRails
[21:13:09] baweaver: I'm at work :D
[21:16:48] JusticeFries: has joined #RubyOnRails
[21:17:57] Eindoofus: has joined #RubyOnRails
[21:19:54] Rodya_: has joined #RubyOnRails
[21:20:03] workmad3: has joined #RubyOnRails
[21:23:22] chouhoulis: has joined #RubyOnRails
[21:23:38] gambl0re: has joined #RubyOnRails
[21:23:54] patarr: has joined #RubyOnRails
[21:26:13] bachmann: has joined #RubyOnRails
[21:28:39] tercenya: has joined #RubyOnRails
[21:36:58] patarr: has joined #RubyOnRails
[21:39:28] rgr_: has joined #RubyOnRails
[21:48:26] patarr: has joined #RubyOnRails
[21:55:50] beingjohnm: mikecmpbll: got it working my moving the wicked_pdf generation to a model and passing data as locals to render_to_string
[21:56:23] mikecmpbll: ah that's cool! :) that's alright when you don't have a ton of helper methods
[21:56:33] mikecmpbll: which subsequently rely on the request object
[21:56:47] mikecmpbll: glad that it was simple in your case tho :)
[21:57:27] patarr: has joined #RubyOnRails
[21:59:50] beingjohnm: I did do the current_user workaround and moved the helper methods (only about 20) as well
[22:05:52] quirkycoders: has joined #RubyOnRails
[22:06:27] brent__: has joined #RubyOnRails
[22:07:20] mices: has joined #RubyOnRails
[22:07:58] mices: how do i access a hash in model from the controller
[22:14:55] AzaToth: has joined #RubyOnRails
[22:20:06] patarr: has joined #RubyOnRails
[22:28:33] brent__: has joined #RubyOnRails
[22:33:57] amperry: mices: I don't know if I can help, but I'm unclear on your question. What are you trying to do?
[22:37:33] mices: i put the options for my select list in the model, now i need to use the hash for lookups
[22:37:40] mices: amperry ^
[22:38:05] quirkycoders: has joined #RubyOnRails
[22:38:24] amperry: if it were me, I'd write a method in the model that gets the hash, and call it from the controller. Or even call it from the view.
[22:38:53] mices: hash looks like states=[['Alabama','AL'],['Arkansas','AR'],...
[22:39:14] mices: so i need Alabama from looking up AL
[22:39:36] mices: how do i write the method
[22:40:22] patarr: has joined #RubyOnRails
[22:40:56] amperry: where is the hash defined? In a table, or in the models/whatever.rb file itself?
[22:41:07] havenwood: mices: Your "hash" is an array. Calling it a hash is confusing (since it isn't a hash).
[22:41:29] havenwood: mices: Do you know how to turn an Array of pairs into a Hash?
[22:42:06] mices: havenwood: that's what i thought
[22:42:26] havenwood: mices: What's this?: [[1, 2], [3, 4]]
[22:42:41] mices: i guess it's a 2 dimensional array
[22:42:50] havenwood: >> [[1, 2], [3, 4]].to_h
[22:42:54] havenwood: #=> {1=>2, 3=>4}
[22:43:01] baweaver: ACTION calls hax
[22:43:37] mices: can you assign it to something and call key from value
[22:43:47] AzaToth: has joined #RubyOnRails
[22:43:52] mices: and visa versa please
[22:43:54] mices: demonstrate
[22:43:57] havenwood: mices: Brush up on a brief tutorial on how to use a Hash in Ruby.
[22:44:05] havenwood: mices: I'd be happy to help in #ruby if you get stuck.
[22:44:07] semperfried76: has joined #RubyOnRails
[22:44:32] havenwood: mices: Maybe start here: https://rubymonk.com/learning/books/1-ruby-primer/chapters/10-hashes-in-ruby/lessons/47-hashes-in-and-out
[22:45:03] havenwood: Or there are lots of other resources. We can help you with Ruby basics in the #ruby channel if you're interested in learning and have questions.
[22:45:32] mices: so i'm there now
[22:46:02] havenwood: mices: Give it a read. Try working with Hashes in your REPL. I think you'll find they're handy once you get the hang of it.
[22:48:27] romeoh: has joined #RubyOnRails
[22:50:12] bronson: has joined #RubyOnRails
[22:58:03] quirkycoders: has joined #RubyOnRails
[23:15:19] patarr: has joined #RubyOnRails
[23:31:37] romeoh: has joined #RubyOnRails
[23:31:51] quazimodo: has joined #RubyOnRails
[23:33:56] beauby: has joined #RubyOnRails
[23:56:23] cagomez: has joined #RubyOnRails
[23:57:40] cagomez: has joined #RubyOnRails
[23:58:17] cagomez: has joined #RubyOnRails