« Back to channel list

#RubyOnRails - 13 March 2017

« Back 1 day Forward 1 day »
[00:05:12] jordansz: has joined #RubyOnRails
[00:11:01] superlou: has joined #RubyOnRails
[00:14:07] jhack_: has joined #RubyOnRails
[00:17:05] treefrob: has joined #RubyOnRails
[00:20:49] welfkarling: has joined #RubyOnRails
[00:20:52] beingjohnm_: that feeling when the new feature you pushed for the big demo tomorrow is causing the server to run out of memory every single time
[00:21:30] cpruitt: has joined #RubyOnRails
[00:21:39] tomasm-: has joined #RubyOnRails
[00:21:59] linoge: has joined #RubyOnRails
[00:28:41] Axsuul: has joined #RubyOnRails
[00:28:56] hotpanca_: has joined #RubyOnRails
[00:31:06] fourcolors: has joined #RubyOnRails
[00:33:17] nyanz: has joined #RubyOnRails
[00:33:20] jgt: has joined #RubyOnRails
[00:42:33] tanuki: has joined #RubyOnRails
[00:48:35] nahtnam: has joined #RubyOnRails
[00:54:27] gambl0re: has joined #RubyOnRails
[00:55:16] doodlehaus: has joined #RubyOnRails
[01:07:24] tvw: has joined #RubyOnRails
[01:07:48] fourcolors: has joined #RubyOnRails
[01:09:00] daydream: has joined #RubyOnRails
[01:09:57] cschneid_: has joined #RubyOnRails
[01:11:10] baweaver: beingjohnm_: Oh?
[01:11:27] baweaver: What's the feature? Tried performance tuning it yet?
[01:16:32] beingjohnm_: baweaver: it is running some projections over a series of accounts
[01:17:00] beingjohnm_: Heroku is absolutely choking on it. Even after going up a dyno level
[01:18:11] baweaver: Tried running EXPLAIN on it or Bullet?
[01:18:20] beingjohnm_: I suspect the issue starts with this (@accounts = user.accounts.where(:account_type => @account_types).sort_by(&:current_balance).reverse!) and then goes downhill from there
[01:18:55] baweaver: Is current_balance computed?
[01:19:01] baweaver: or is it a column?
[01:19:24] beingjohnm_: yeah. not a column. Sum of all transactions for the account
[01:19:37] baweaver: In typical Ruby you want to negate the search instead of reversing it after
[01:19:43] baweaver: What are transactions?
[01:19:46] baweaver: Is it another table?
[01:20:08] beingjohnm_: Another table. Each account has many transactions
[01:21:15] baweaver: Immediate speed improvements: @accounts = user.accounts.includes(:transactions).where(account_type: @account_types).sort_by { |a| -a.current_balance }
[01:21:26] baweaver: further speed improvements would be doing some SQL-fu
[01:22:12] baweaver: which would basically amount to something like: SUM(SELECT balance FROM transactions)
[01:22:22] baweaver: ACTION needs to look up the SQL for that
[01:22:40] baweaver: but that first one will eager load those transactions and take a huge strain off
[01:22:53] baweaver: the next one (putting it into SQL for sums) will get most of the rest of it
[01:30:25] arBmind1: has joined #RubyOnRails
[01:32:59] roflmyeggo: worth it to use something like Locomotion CMS? Or Spina?
[01:33:21] roflmyeggo: or better to just spin up an app from scratch
[01:33:56] roflmyeggo: id prefer to isolate myself from maintaining the core app but still have the extensibility of a custom web app
[01:33:57] xaviergmail: has joined #RubyOnRails
[01:36:29] aperkins81: has joined #RubyOnRails
[01:37:11] tomasm-: has joined #RubyOnRails
[01:38:40] baweaver: beingjohnm_: also look into using SELECT and SUM methods
[01:45:39] urkle: has joined #RubyOnRails
[01:46:18] xaviergmail: What are your favourite ways to manage front-end dependencies? Ideally I'd like to stay away from npm but that may be impossible.. Is there anything straight forward that integrates well into rails 5?
[01:46:33] beingjohnm_: baweaver: just pushing your change and a few others now to see how they work.
[01:47:11] baweaver: beingjohnm_: Also, what's that sum method look like on the other model?
[01:47:35] beingjohnm_: If I could think of a way to "cache" that query so it only loads once per page load (I hit it a few times each page load) that woudl help as well
[01:48:36] baweaver: Rails has caching
[01:48:44] baweaver: I'd have to look at exactly how again
[01:49:01] baweaver: xaviergmail: It'd be NPM. Rails 5.1 is using Webpack for dep management
[01:49:11] baweaver: Avoid Bower, it's redundant
[01:49:21] baweaver: (and bad at its job too)
[01:49:25] beingjohnm_: I did a quick glance and the examples didn't fit this use case but I didn't look closely
[01:49:42] xaviergmail: Ah, I think I heard about webpack
[01:50:51] baweaver: Webpack not being a replacement for NPM but a build step
[01:51:06] baweaver: (trust me, it's a lot to take in there)
[01:52:50] beingjohnm_: still running out of ram
[01:52:59] xaviergmail: Yeah I know the difference, but I didn't want to have to manually set up my own agonizing dependency conglomerator
[01:53:18] beingjohnm_: this is going ot take some refactoring
[01:53:18] baweaver: Making sure
[01:53:21] baweaver: it's a deep well
[01:53:59] baweaver: I'll see if I can simulate an example that combines it in one query
[01:54:46] _3dwardsharp: has joined #RubyOnRails
[01:54:54] beingjohnm_: just thought of a poor man's cache that I will try
[01:55:16] baweaver: http://guides.rubyonrails.org/caching_with_rails.html
[01:55:21] baweaver: beingjohnm_ ^
[01:56:43] doodlehaus: has joined #RubyOnRails
[01:56:58] beingjohnm_: baweaver: saw that. I thought fragment cacheing might work but need to explore
[02:05:04] jnoob22: In a view I'm trying to get a username representation for users instead of the user_id -> http://pastebin.com/s5z1V3xe
[02:06:14] fragamus: has joined #RubyOnRails
[02:06:15] jnoob22: https://gist.github.com/hseritt/4d9156ff187ca0e686d3795951ea1ac3
[02:06:50] jnoob22: Can anyone maybe point me to where I can read on how to do this properly? I'm using 5.0.2
[02:08:12] Rodya_: has joined #RubyOnRails
[02:10:07] baweaver: flip the arguments on line 5
[02:10:13] baweaver: also don't use map against AR#all
[02:10:28] baweaver: User.pluck(:id, :username)
[02:10:55] baweaver: docs - http://apidock.com/rails/ActionView/Helpers/FormOptionsHelper/options_for_select
[02:10:56] jnoob22: hmm ok ill try that
[02:11:17] baweaver: notice it wants a hash too
[02:11:23] d0nn1e: has joined #RubyOnRails
[02:12:02] gusrub: has joined #RubyOnRails
[02:14:26] gusrub: has joined #RubyOnRails
[02:14:30] jnoob22: baweaver, like this? <%= f.text_field :user_id, options_for_select([[User.username, User.id], [User.id, User.id]]) %>
[02:15:04] jnoob22: If I do that, I get: undefined method `username' for #<Class:0x007f36fd72f278>
[02:16:26] KnownSyntax: has joined #RubyOnRails
[02:16:26] KnownSyntax: has joined #RubyOnRails
[02:20:57] welfkarling: has left #RubyOnRails: ()
[02:23:34] hahuang65: has joined #RubyOnRails
[02:36:11] bitshift: has joined #RubyOnRails
[02:37:39] harfangk: has joined #RubyOnRails
[02:37:51] daydream: has joined #RubyOnRails
[02:38:51] ResidentBiscuit: has joined #RubyOnRails
[02:39:16] ResidentBiscuit: has joined #RubyOnRails
[02:43:26] _3dwardsharp: jnoob22 do you mean @user or current_user instead of User?
[02:45:00] hakash: has joined #RubyOnRails
[02:45:06] _3dwardsharp: oops, should of read more.
[02:46:21] _3dwardsharp: not sure what options_for_select does for a f.text_field? do you want f.select?
[02:49:00] hahuang65: has joined #RubyOnRails
[02:58:32] gusrub: has joined #RubyOnRails
[03:05:36] libastral: has joined #RubyOnRails
[03:23:04] Trynemjoel: has joined #RubyOnRails
[03:27:17] samgranieri: has joined #RubyOnRails
[03:28:01] xall: has joined #RubyOnRails
[03:38:52] irishfromua: has joined #RubyOnRails
[03:43:03] hakash: has joined #RubyOnRails
[03:47:44] nyaa: has joined #RubyOnRails
[03:54:50] cschneid_: has joined #RubyOnRails
[03:59:31] ProtoJazz: has joined #RubyOnRails
[04:00:19] blackmesa: has joined #RubyOnRails
[04:32:43] tomasm-: has joined #RubyOnRails
[04:33:11] alex88: has joined #RubyOnRails
[04:33:25] hotpancakes: has joined #RubyOnRails
[04:35:44] hotpancakes: has joined #RubyOnRails
[04:35:53] kiki_lamb: has joined #RubyOnRails
[04:37:09] kiki_lamb: In routes.rb, in a call to 'match', can I artificially add extra parameters to the controller method being called?
[04:37:15] jnoob22: has joined #RubyOnRails
[04:37:58] kiki_lamb: i.e., say I already have "match 'something/:id' to: 'thing#something'"...
[04:38:33] kiki_lamb: can I have "match 'something_special/:id', to: 'thing#something', params: { special: true }", or something along those lines?
[04:40:27] _3dwardsharp: kiki_lamb sure, use the defaults hash: http://guides.rubyonrails.org/routing.html#defining-defaults
[04:42:23] kiki_lamb: _3dwardsharp: cool, i'll search for that, thanks
[04:43:12] itsgokul: has joined #RubyOnRails
[04:57:50] nyanz: has joined #RubyOnRails
[05:06:25] duderonomy: has joined #RubyOnRails
[05:07:23] dionysus69: has joined #RubyOnRails
[05:09:00] duderono_: has joined #RubyOnRails
[05:09:56] w0rd-driven: has joined #RubyOnRails
[05:16:22] pickle_: has joined #RubyOnRails
[05:17:18] zero1one0: has joined #RubyOnRails
[05:19:52] zero1one0: has joined #RubyOnRails
[05:26:41] pulkit4tech: has joined #RubyOnRails
[05:35:48] Derperperd: has joined #RubyOnRails
[05:44:30] bruce_lee: has joined #RubyOnRails
[05:57:13] dionysus69: has joined #RubyOnRails
[06:08:10] bitshift: has joined #RubyOnRails
[06:08:16] beingjohnm_: baweaver: I have refactored that whole model. It is quite snappy with a small amount of transactions over all accounts but still chokes for a user with 1672 transactions across about 20 accounts
[06:15:29] hotpancakes: has joined #RubyOnRails
[06:22:47] bitshift: has joined #RubyOnRails
[06:26:03] hotpancakes: has joined #RubyOnRails
[06:28:41] beingjohnm_: baweaver: and, I am flabergasted. literally swearing in amazement. The issue was a related method that went off into an infinite loop until running out of memory. User did not have a payment entered and it didn't check for it.
[06:28:45] beingjohnm_: thanks for your help
[06:30:32] Jameser: has joined #RubyOnRails
[06:32:02] beingjohnm_: five or six hours on this :(
[06:32:20] lightheaded: has joined #RubyOnRails
[06:37:54] duderonomy: has joined #RubyOnRails
[06:49:32] pwnd_nsfw`: has joined #RubyOnRails
[07:01:21] rfoust: has joined #RubyOnRails
[07:13:30] xall: has joined #RubyOnRails
[07:15:52] hotpancakes: has joined #RubyOnRails
[07:16:31] lightheaded: has joined #RubyOnRails
[07:19:43] dionysus69: has joined #RubyOnRails
[07:24:47] nOwz: has joined #RubyOnRails
[07:28:58] pickle_: has joined #RubyOnRails
[07:34:38] morfin: has joined #RubyOnRails
[07:34:56] conta: has joined #RubyOnRails
[07:35:28] morfin: RoR do not autoload third level directories e.g app/controllers/admin/subnamespace?
[07:35:40] doodlehaus: has joined #RubyOnRails
[07:43:05] pawnbox: has joined #RubyOnRails
[07:48:22] pawnbox: has joined #RubyOnRails
[07:48:38] zpe: has joined #RubyOnRails
[07:48:43] jeyraof^mbpr: has joined #RubyOnRails
[07:55:56] JDeen: has joined #RubyOnRails
[08:08:51] srinidhi: has joined #RubyOnRails
[08:10:21] toomus: has joined #RubyOnRails
[08:11:56] pawnbox: has joined #RubyOnRails
[08:12:20] toomus: Is it possible to pass Rspec example block to some function?
[08:14:32] Qchmqs: has joined #RubyOnRails
[08:18:47] artto: has joined #RubyOnRails
[08:20:44] antgel: has joined #RubyOnRails
[08:20:54] aganov: has joined #RubyOnRails
[08:23:02] pawnbox: has joined #RubyOnRails
[08:27:38] gambl0re: has joined #RubyOnRails
[08:30:14] hotpancakes: has joined #RubyOnRails
[08:33:36] amritoit: has joined #RubyOnRails
[08:35:52] pLaTo0n: has joined #RubyOnRails
[08:39:19] larcara: has joined #RubyOnRails
[08:44:24] fourcolors: has joined #RubyOnRails
[08:47:55] Cork: is it possible to check if a model exists in rails?
[08:48:25] Cork: Object.const_defined?() fails if the model isn't loaded yet so it often gives false negatives
[08:50:56] tbuehlmann: Cork: you could just call the model and rescue NameError
[08:51:30] keerthana: has joined #RubyOnRails
[08:51:34] Cork: ya, i'm thinking about that too, but wondering if there is a cleaner solution (that doesn't cause errors)
[08:52:16] nertzy: has joined #RubyOnRails
[08:54:33] tbuehlmann: why do you need to know this at all?
[08:56:05] hays: has joined #RubyOnRails
[08:56:05] hays: has joined #RubyOnRails
[08:56:42] szulak: has joined #RubyOnRails
[08:57:16] ebcz: has joined #RubyOnRails
[08:59:25] Cervajz: has joined #RubyOnRails
[09:00:48] cschneid_: has joined #RubyOnRails
[09:01:19] JDeen: In mini tests, do we have a way to know if a delayed job was enqueued? I got a model with a ar hook including some logic and firing a delayed job. since it is a private method, easiest would be test a job getting enqueued i guess
[09:01:29] morfin: nvm - Admin was model...
[09:04:45] artto: has joined #RubyOnRails
[09:04:47] naprimer_3: has joined #RubyOnRails
[09:04:51] mikecmpbll: has joined #RubyOnRails
[09:07:11] Derperperd: has joined #RubyOnRails
[09:07:49] tbuehlmann: jdeen, found this: http://api.rubyonrails.org/classes/ActiveJob/TestHelper.html
[09:07:59] tbuehlmann: assuming you're using activejob
[09:08:58] dangerousdave: has joined #RubyOnRails
[09:10:25] Andr3as: good morning everyone.. i'm trying to create an admin panel where admin can edit users and other models - i thought in-place editing might be a good idea.. but all those gems are pretty old and i am not sure if i'd use them or if i'd regret that later.. anyone with a tip?
[09:10:29] larcara: has joined #RubyOnRails
[09:11:15] larcara: has joined #RubyOnRails
[09:15:29] thomashickey: has joined #RubyOnRails
[09:16:46] JDeen: tbuehlmann: i noticed, it gave me a no method error when I tried it inside a ActiveSupport::TestCase. i am writing the tests in the modal spec, should i write it in the job spec instead?
[09:17:25] mikecmpbll: Andr3as : 'in place editing'? what do you mean by that
[09:17:54] JDeen: tbuehlmann: the case is like this... when a modal is created, i need to check if the existing records are sufficiently new and if not to trigger the active job. i am using a after_create hook in the modal to check and trigger the job
[09:18:16] fourcolors: has joined #RubyOnRails
[09:19:06] pwnd_nsfw: has joined #RubyOnRails
[09:19:20] tbuehlmann: jdeen: I'm not that familiar with minitest. in rspec I'd use https://www.relishapp.com/rspec/rspec-rails/docs/matchers/have-enqueued-job-matcher or expect the job class to receive a specific method call
[09:20:41] mikecmpbll: Andr3as : just include ActiveJob::TestHelper
[09:20:50] mikecmpbll: whups; jdeen : ^
[09:21:53] Andr3as: mikecmpbll: well, as an exapmle, i want table with all users listed and would want to edit certain fields directly inside that table
[09:23:13] mikecmpbll: oh okay. just create a form for each record, put the fields in a row, probably make it 'remote'.
[09:25:39] tbuehlmann: having an on-change callback that submits the form is inplace editing already, right?
[09:27:04] Andr3as: tbuehlmann: it technically is, yeah
[09:27:31] Andr3as: hmm.. i'll think that through - thank you, mikecmpbll and tbuehlmann
[09:28:00] _3dwardsharp: Andr3as i've used this before: https://vitalets.github.io/x-editable/
[09:28:57] ferr1: has joined #RubyOnRails
[09:29:06] Andr3as: thank _3dwardsharp - that looks nice too...
[09:30:01] Andr3as: fwfw - here's a rails demo https://x-editable-rails.herokuapp.com/
[09:30:37] DrYockel: has joined #RubyOnRails
[09:32:03] DrYockel: has joined #RubyOnRails
[09:34:38] DrYockel: has joined #RubyOnRails
[09:36:38] artto: has joined #RubyOnRails
[09:36:47] Cervajz: has joined #RubyOnRails
[09:38:27] hotpancakes: has joined #RubyOnRails
[09:44:32] jsrn_: has joined #RubyOnRails
[09:46:26] blackmesa: has joined #RubyOnRails
[09:47:30] pwnd_nsfw`: has joined #RubyOnRails
[09:51:00] netzfisch: has joined #RubyOnRails
[09:53:06] mark_66: has joined #RubyOnRails
[09:54:27] matthewd: Cork: What are you trying to do? safe_constantize might help
[09:56:42] DaveTaboola: has joined #RubyOnRails
[10:00:07] lxsameer: has joined #RubyOnRails
[10:00:29] netzfisch: has joined #RubyOnRails
[10:02:09] thomashickey: has joined #RubyOnRails
[10:05:20] arBmind: has joined #RubyOnRails
[10:05:54] marr: has joined #RubyOnRails
[10:06:51] hotpancakes: has joined #RubyOnRails
[10:09:35] Fernando-Basso: has joined #RubyOnRails
[10:11:34] artto_: has joined #RubyOnRails
[10:14:48] artto: has joined #RubyOnRails
[10:15:08] fourcolors: has joined #RubyOnRails
[10:19:04] artto_: has joined #RubyOnRails
[10:21:33] artto: has joined #RubyOnRails
[10:24:41] artto: has joined #RubyOnRails
[10:25:31] merzu2: has joined #RubyOnRails
[10:34:50] arup_r: has joined #RubyOnRails
[10:36:35] arup_r: Can anyone tell me why `.save` throwing exception instead of returning `false`? https://gist.github.com/aruprakshit/e9bc438caf586b9de2ad2b29183a4f4a
[10:42:54] Rodya_: has joined #RubyOnRails
[10:43:06] arup_r: nvm ignore me
[10:44:29] artto_: has joined #RubyOnRails
[10:45:11] thomashickey: has joined #RubyOnRails
[10:46:35] workmad3: has joined #RubyOnRails
[10:52:25] artto: has joined #RubyOnRails
[10:52:41] Jameser: has joined #RubyOnRails
[10:58:22] Jameser: has joined #RubyOnRails
[11:01:20] larcara: has joined #RubyOnRails
[11:06:32] gloscombe: has joined #RubyOnRails
[11:09:29] Jameser: has joined #RubyOnRails
[11:16:00] xall: has joined #RubyOnRails
[11:17:26] xaviergmail: has joined #RubyOnRails
[11:19:11] nettoweb: has joined #RubyOnRails
[11:19:18] thomashickey: has joined #RubyOnRails
[11:25:18] merzu3: has joined #RubyOnRails
[11:28:10] zhustec: has joined #RubyOnRails
[11:30:34] Robtop__: has joined #RubyOnRails
[11:32:35] Jameser: has joined #RubyOnRails
[11:33:21] teddysmoker: has joined #RubyOnRails
[11:37:45] doodlehaus: has joined #RubyOnRails
[11:41:17] ldnunes: has joined #RubyOnRails
[11:45:17] Rodya_: has joined #RubyOnRails
[11:45:25] artto: has joined #RubyOnRails
[11:46:36] HoierM: has joined #RubyOnRails
[11:48:54] doodlehaus: has joined #RubyOnRails
[11:51:54] workmad3: has joined #RubyOnRails
[11:55:57] conta: has joined #RubyOnRails
[11:58:19] artto: has joined #RubyOnRails
[12:01:26] artto: has joined #RubyOnRails
[12:02:11] gambl0re: has joined #RubyOnRails
[12:04:56] artto: has joined #RubyOnRails
[12:05:21] pwnd_nsfw: has joined #RubyOnRails
[12:07:06] andrcmdr: has joined #RubyOnRails
[12:14:45] gambl0re: has joined #RubyOnRails
[12:16:41] augcesar: has joined #RubyOnRails
[12:17:31] doodlehaus: has joined #RubyOnRails
[12:17:39] rikkipitt: has joined #RubyOnRails
[12:18:22] rikkipitt: hey folks, i'm using rolify (which seems to do a HABTM under the hood for roles), is there a decent way to get all has_many through a HABTM association?
[12:18:54] eclecticjohny: has joined #RubyOnRails
[12:19:56] artto: has joined #RubyOnRails
[12:22:26] hotpancakes: has joined #RubyOnRails
[12:23:57] artto: has joined #RubyOnRails
[12:24:12] xall: has joined #RubyOnRails
[12:26:28] greengriminal: has joined #RubyOnRails
[12:30:23] lightheaded: has joined #RubyOnRails
[12:30:34] mikecmpbll: rikkipitt : not sure what you mean?
[12:31:27] rikkipitt: hey mikecmpbll. Essentially, a user can has_many roles, each role can have many permissions, but using rolify the roles association is HABTM
[12:31:35] rikkipitt: i might just remove rolify
[12:31:40] lightheaded: has joined #RubyOnRails
[12:32:39] adlerdias_: has joined #RubyOnRails
[12:32:58] mikecmpbll: okay, what is it you're trying to do that you're unsure of?
[12:35:39] rikkipitt: find all permissions via all of user roles. essentially, it's u.roles.joins(:permissions) I think
[12:36:31] larcara: has joined #RubyOnRails
[12:37:58] keegnotrub: has joined #RubyOnRails
[12:38:06] matthewd: `class User; has_many :permissions, through: :roles`, maybe?
[12:39:03] fragamus: has joined #RubyOnRails
[12:40:04] vicsy: has joined #RubyOnRails
[12:41:29] rikkipitt: matthewd: thanks, fairly certain this threw an error ealier, hence me worrying about the HABTM issue with Rolify
[12:41:38] rikkipitt: this works I think, cheers.
[12:42:49] shinnya: has joined #RubyOnRails
[12:46:01] Rodya_: has joined #RubyOnRails
[12:47:10] jnoob22: has joined #RubyOnRails
[12:50:49] raul782: has joined #RubyOnRails
[12:51:05] agit0: has joined #RubyOnRails
[12:51:23] lightheaded: has joined #RubyOnRails
[12:51:59] raul782: I'm having an issue with this gem act-as-auidted, where my auditable_id and auditable_type are saved as nil for the user model, other models are audited just fine any advice?
[12:52:39] raul782: http://stackoverflow.com/questions/42735377/ruby-on-rails-audit-on-users-model-auditable-type-and-auditable-id-is-nil
[12:53:29] raul782: I'm trying to find where the gem is setting both variables to start debugging the issue, but haven't had so much luck so far
[12:53:56] matthewd: raul782: "I've also extended the audit model as follows"
[12:54:06] matthewd: raul782: I'd start there
[12:55:55] raul782: matthewd: thanks, I've debugged the custom audit model
[12:55:58] alex88: has joined #RubyOnRails
[12:56:34] raul782: but the only method I've added, only gets called for models with associated_type, and the user model doesn't have one.
[12:57:35] raul782: I've added this callback before_save :inspect_attributes to start reviewing the attributes, but it's not giving me more clues where to look
[12:57:46] vicsy: I'm really glad for you
[12:58:43] raul782: matthewd: When looking at the source code for act-as-audited I've focused on Audited::Adapters::ActiveRecord::Audit and Audited::Audit
[12:58:59] artto: has joined #RubyOnRails
[12:59:06] raul782: but I don't see where the auditable_id and auditable_type are being captured, do you?
[13:00:36] hotpancakes: has joined #RubyOnRails
[13:01:19] vicsy: Ha ok sorry for taking time to answer you is that I'm registering:-D
[13:02:02] matthewd: vicsy: Who are you talking to?
[13:03:02] matthewd: raul782: Maybe try reducing it to a stand-alone test case, e.g. using the AR test file: https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb
[13:04:27] larcara: has joined #RubyOnRails
[13:06:57] blackmesa: has joined #RubyOnRails
[13:07:09] vicsy: With matthewd: Your Conquer
[13:07:26] raul782: Ok, I'll try to see if that gives me any hints
[13:07:52] Derperperd: has joined #RubyOnRails
[13:08:41] nettoweb: has joined #RubyOnRails
[13:09:22] vicsy: Look, look, you can help me with something.
[13:09:25] lightheaded: has joined #RubyOnRails
[13:10:13] rfoust: has joined #RubyOnRails
[13:10:50] vicsy: Look, look, you can help me with something.
[13:13:17] lightheaded: has joined #RubyOnRails
[13:19:17] xall: has joined #RubyOnRails
[13:19:42] agent_white: has joined #RubyOnRails
[13:20:05] greengriminal: has joined #RubyOnRails
[13:22:04] nettoweb: has joined #RubyOnRails
[13:27:24] agent_white: Mornin' folks
[13:30:34] mikecmpbll: agent_white : mornin'.
[13:33:47] vicsy: Sorry my computer is damaged and changes the words
[13:33:59] patarr: has joined #RubyOnRails
[13:34:34] mikecmpbll: sounds likely.
[13:35:04] ule: has joined #RubyOnRails
[13:35:13] tomasm-: has joined #RubyOnRails
[13:35:17] hotpancakes: has joined #RubyOnRails
[13:35:32] workmad3: has joined #RubyOnRails
[13:35:54] DLSteve: has joined #RubyOnRails
[13:36:35] fourcolors: has joined #RubyOnRails
[13:42:19] xall: has joined #RubyOnRails
[13:44:06] Toledo: has joined #RubyOnRails
[13:45:36] tomasm-: has joined #RubyOnRails
[13:46:17] szulak: has joined #RubyOnRails
[13:46:49] Rodya_: has joined #RubyOnRails
[13:48:09] pawnbox: has joined #RubyOnRails
[13:49:56] koneko: has joined #RubyOnRails
[13:51:20] mikecmpb_: has joined #RubyOnRails
[13:52:47] tomasm-: hey i have a problem with a has_many association, I have PhotoAlbum has_many Photos, I've saved my album like: @photo_album.assign_attributes(params.require(:photo_album).permit(...)), then @photo_album.save, then I assign the photo id's to the album since they are uploaded via ajax and not assigned yet: @photo_album.photo_ids = params[:photos].pluck(:id) ; # Unfortunately, I never have photo_album_id saved on my photos model, it just does an UPDATE wi
[13:52:47] tomasm-: th updated_at. I know the photo id's are there, since I print them to my log file. just the foreign key isnt saved despite calling @photo_album.photo_ids = # what could I be doing wrong? same approach works on another model
[13:54:23] tomasm-: I see the query where it tries to find existing photos in the photo_album_id, ie SELECT * from photos WHERE photo_album_id = 2; # But the UPDATE after that doesn't set photo_album_id
[13:56:16] matthewd: tomasm-: Is autosave enabled on the association? If the parent model's already been created, I think it needs to be.
[13:57:22] tomasm-: why does autosave need to work? I am calling @photo_album.photo_ids = params[:photos].pluck(:id) explicitly
[13:57:50] roamingdog: has joined #RubyOnRails
[13:58:26] tercenya: has joined #RubyOnRails
[13:58:39] matthewd: I believe that will set photo_album_id on the children, but you need autosave to then save them [without explicitly calling save on each]
[13:59:12] matthewd: (but note a big "I'm not very familiar with this area" warning around anything I say)
[13:59:20] tomasm-: well i dont have autosave set on another parent has_many model set, and that works
[13:59:41] jordansz: has joined #RubyOnRails
[14:00:08] jordansz: hi everyone im back at my table_renderer again, how would i count the number of items inside multidimensional array like so; = render_table(@organisations, [['name', 'Name', true],['divisions', 'Divisions', true],['employees', 'Employees', true]])
[14:00:23] jordansz: i would like to detect a count 3 for each element that consists of 3 subitems
[14:00:41] jordansz: or if there is a better way to do this i would be interested in any expert advice regarding this
[14:00:43] matthewd: tomasm-: Is the parent already saved before you set the ids in those cases?
[14:01:42] jordansz: currently i have this implementatoin; https://gist.github.com/jordanlance/c50a413ce57dd95568ecf1f01f791d60 but it quite s*cks
[14:04:13] artto: has joined #RubyOnRails
[14:12:38] roamingdog: has joined #RubyOnRails
[14:13:27] roamingdog: has joined #RubyOnRails
[14:14:17] roamingdog: has joined #RubyOnRails
[14:14:55] Ayey_: has joined #RubyOnRails
[14:17:27] eclecticjohny: has joined #RubyOnRails
[14:17:53] pawnbox: has joined #RubyOnRails
[14:20:43] chouhoulis: has joined #RubyOnRails
[14:24:41] spicerack: has joined #RubyOnRails
[14:27:00] emers2n: has joined #RubyOnRails
[14:27:48] emers2n: In my rails App, where should I put a class like this: https://cdn-images-1.medium.com/max/800/1*_jpqy6mBUrrcwMynAyfSUQ.png ???
[14:29:27] fryguy: emers2n: lib/ or create a new subdir under apps/, something like app/services or similar
[14:29:55] Derperperd: has joined #RubyOnRails
[14:30:14] emers2n: fryguy: Does the file have to have a certain name? How do I call that file? (Like require_once() in PHP)?
[14:32:55] fryguy: emers2n: if it's in lib you just use it and rails will autoload it for you
[14:33:14] emers2n: fryguy: awesome, thanks mate
[14:33:17] Jameser: has joined #RubyOnRails
[14:33:23] fryguy: if it's in app/services you can add app/services to your autoload path in your config (just search for autoload_path)
[14:33:35] lightheaded: has joined #RubyOnRails
[14:34:13] envint: has joined #RubyOnRails
[14:34:16] keerthana: has joined #RubyOnRails
[14:35:12] matthewd: app/* is autoloaded by default
[14:35:31] fryguy: oh right, i forgot that's true in modern versions of rails
[14:36:40] nettoweb: has joined #RubyOnRails
[14:36:57] tomasm-: matthewd, yeah, I call @photo_album.save; @photo_album.photo_ids = params[:photos].pluck(:id)
[14:37:15] ramortegui: has joined #RubyOnRails
[14:37:17] Cervajz: has joined #RubyOnRails
[14:38:48] matthewd: If the same pattern has a different result in another place, I'm not sure what's causing the difference
[14:41:52] artto: has joined #RubyOnRails
[14:42:48] envint: has joined #RubyOnRails
[14:46:27] lightheaded: has joined #RubyOnRails
[14:46:47] Technodrome: has joined #RubyOnRails
[14:47:31] pawnbox: has joined #RubyOnRails
[14:47:41] Rodya_: has joined #RubyOnRails
[14:50:30] tomasm-: odd, it works now
[14:51:30] emers2n: fryguy: I have amazon.rb within app/assets/amazon which contains the AmazonAPI class... Attempting to call it in a view leads to unitialized constant. Any idea?
[14:52:04] tvw: has joined #RubyOnRails
[14:57:43] pawnbox: has joined #RubyOnRails
[15:00:14] fryguy: don't put those things in assets
[15:00:58] hotpancakes: has joined #RubyOnRails
[15:01:22] cschneid_: has joined #RubyOnRails
[15:05:28] emers2n: fryguy: Thanks, got it all figured out
[15:07:50] tomasm-: is there any gem or plugin that helps with the UI end of uploading and managing a paperclip photo via ajax? ie something with an upload button, crop, zoom, etc.
[15:09:46] Cervajz: has joined #RubyOnRails
[15:09:46] artto: has joined #RubyOnRails
[15:12:05] polishdub: has joined #RubyOnRails
[15:17:44] Ayey_: has joined #RubyOnRails
[15:23:28] envint: has joined #RubyOnRails
[15:24:14] jordansz: hi everyone is there a way to check if an object is acollection or singluar?
[15:24:23] jordansz: is_a?(collection) expected but is not available
[15:25:04] hotpancakes: has joined #RubyOnRails
[15:27:54] Cohedrin: has joined #RubyOnRails
[15:28:42] brent__: has joined #RubyOnRails
[15:30:01] cpruitt: has joined #RubyOnRails
[15:30:12] patarr1: has joined #RubyOnRails
[15:31:16] alex88: has joined #RubyOnRails
[15:33:55] andrcmdr: has left #RubyOnRails: ("Leaving")
[15:35:24] larcara: has joined #RubyOnRails
[15:35:30] gremly: has left #RubyOnRails: ("WeeChat 1.4")
[15:36:54] metadox: has joined #RubyOnRails
[15:36:55] xall: has joined #RubyOnRails
[15:39:57] Cervajz: has joined #RubyOnRails
[15:43:36] chouhoulis: has joined #RubyOnRails
[15:43:37] hotpancakes: has joined #RubyOnRails
[15:43:45] Omnilord: has joined #RubyOnRails
[15:45:50] Technodrome: has joined #RubyOnRails
[15:45:53] chouhoulis: has joined #RubyOnRails
[15:47:10] pawnbox: has joined #RubyOnRails
[15:48:21] Rodya_: has joined #RubyOnRails
[15:49:09] hotpanca_: has joined #RubyOnRails
[15:49:39] jordansz: has joined #RubyOnRails
[15:50:25] Dysp: has joined #RubyOnRails
[15:50:52] Rodya_: has joined #RubyOnRails
[15:51:03] Dysp: Hi there. I have some issues with rails regarding plural/singular. It seems like I messed up somewhere, but I cannot exactly figure out where. Model is singular, controller is plural; right?
[15:52:07] Dysp: https://gist.github.com/Dysp/ab1b0c505d3964bf426178cd85f62c38
[15:52:27] matthewd: Dysp: `resources`, plural
[15:52:52] matthewd: Dysp: You have `resource`.
[15:53:02] tomasm-: 'resource' makes it a singleton
[15:53:09] Dysp: There it was.
[15:53:39] envint: has joined #RubyOnRails
[15:54:08] Dysp: Thank you.
[15:55:51] mello: has joined #RubyOnRails
[15:57:52] d0nn1e: has joined #RubyOnRails
[16:00:25] jordansz: hmm is there any way to check if a object is a collection? cant figure ito ut
[16:00:32] jordansz: object.count works for collection but fails on non collection
[16:00:57] pawnbox: has joined #RubyOnRails
[16:02:10] djbkd: has joined #RubyOnRails
[16:04:58] larcara: has joined #RubyOnRails
[16:05:36] [Butch]: has joined #RubyOnRails
[16:05:38] dionysus69: has joined #RubyOnRails
[16:05:39] hotpancakes: has joined #RubyOnRails
[16:07:36] lxsameer: has joined #RubyOnRails
[16:08:11] matthewd: jordansz: What are you trying to do?
[16:08:28] jordansz: check if an object is singular or collection i fixed it with: if object.is_a?(ActiveRecord::Relation)
[16:09:02] helpa: It seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
[16:10:43] artto: has joined #RubyOnRails
[16:11:30] [Butch]: has joined #RubyOnRails
[16:14:37] jonsnow: has joined #RubyOnRails
[16:15:53] jonsnow: alexander.valach
[16:19:04] hamster88: has joined #RubyOnRails
[16:19:11] hamster88: Greetings people
[16:19:41] thomashickey: has joined #RubyOnRails
[16:20:32] hamster88: I was facing augmentation error.like this block in assert_valid_keys': Unknown key: :order (ArgumentError)
[16:21:20] matthewd: hamster88: !gist the whole error and the application code it's pointing to, please
[16:21:20] helpa: hamster88: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[16:21:34] hamster88: in order to resolve I had commented out the line(rbenv installed( that raises this.. this resolved the issue.
[16:21:45] hamster88: I am not sure if that's right approach
[16:23:34] hamster88: matthewd, my question is if that's right approach.. reason being I was not able to find any thing with "optional" as a key in my code
[16:24:20] matthewd: hamster88: I can't answer that question without any information
[16:29:02] ramortegui: has joined #RubyOnRails
[16:29:28] envint_: has joined #RubyOnRails
[16:30:36] jordansz: has joined #RubyOnRails
[16:33:11] ResidentBiscuit: has joined #RubyOnRails
[16:33:55] Or1on: has joined #RubyOnRails
[16:38:34] gusrub: has joined #RubyOnRails
[16:39:07] username1: has joined #RubyOnRails
[16:41:52] Cervajz: has joined #RubyOnRails
[16:42:45] Cervajz_: has joined #RubyOnRails
[16:43:20] Dysp: https://gist.github.com/Dysp/72f43615b441b3bca097f091cf068492
[16:44:48] Dysp: Another problem. When in the view, nothing is rendered to enter "clinical". Illness has_one clinical. I assume it is because no "new" clinical is created and thus nothing is rendered. How do I address this?
[16:45:01] linoge: has joined #RubyOnRails
[16:45:57] Dysp: In the model I have accepts_nested_attributes_for :clinical, :reject_if => :all_blank, :allow_destroy => true
[16:47:11] Cervajz: has joined #RubyOnRails
[16:47:52] SteenJobs: has joined #RubyOnRails
[16:49:36] envint: has joined #RubyOnRails
[16:53:59] hotpancakes: has joined #RubyOnRails
[16:56:46] keerthana: has joined #RubyOnRails
[17:01:21] pawnbox: has joined #RubyOnRails
[17:03:04] Derperperd: has joined #RubyOnRails
[17:04:19] SteenJobs: has joined #RubyOnRails
[17:05:51] koneko: has joined #RubyOnRails
[17:08:41] cnk: has joined #RubyOnRails
[17:09:08] gthank: has joined #RubyOnRails
[17:09:08] gthank: has joined #RubyOnRails
[17:09:47] Cache_Money: has joined #RubyOnRails
[17:10:05] hotpancakes: has joined #RubyOnRails
[17:10:56] gusrub: has joined #RubyOnRails
[17:17:09] _djbkd: has joined #RubyOnRails
[17:21:31] szulak: has joined #RubyOnRails
[17:24:23] Ayey_: has joined #RubyOnRails
[17:24:37] xall: has joined #RubyOnRails
[17:26:38] gthank: has joined #RubyOnRails
[17:26:38] gthank: has joined #RubyOnRails
[17:26:54] merzu3: has joined #RubyOnRails
[17:29:34] xall_: has joined #RubyOnRails
[17:29:38] metadox: has joined #RubyOnRails
[17:32:35] larcara: has joined #RubyOnRails
[17:33:18] TheMonster: has joined #RubyOnRails
[17:33:34] mchelen2: has joined #RubyOnRails
[17:34:15] hotpancakes: has joined #RubyOnRails
[17:35:28] vedu: has joined #RubyOnRails
[17:35:40] AzaToth: has joined #RubyOnRails
[17:37:13] brahman: has joined #RubyOnRails
[17:37:13] brahman: has joined #RubyOnRails
[17:38:51] brahman: Hi, I am building a rails 5 api, I have created the project with 'rails new projectname --api', this creates the new project but does not seem to include the ActiveModel::Serializer Do I need to add this gem manually ?
[17:42:02] dopamean_: has joined #RubyOnRails
[17:43:18] Rodya_: has joined #RubyOnRails
[17:43:42] dminuoso: DHH: "It's pretty inefficient to store enums as text."
[17:43:47] dminuoso: ACTION pokes matthewd 
[17:43:52] dminuoso: What the fuck is DHH on about with that comment?
[17:44:00] blackmesa: has joined #RubyOnRails
[17:44:07] SteenJobs: has joined #RubyOnRails
[17:44:07] dminuoso: That's straight from https://github.com/rails/rails/commit/db41eb8a6ea88b854bf5cd11070ea4245e1639c5
[17:44:30] dminuoso: string enums have that beautiful advantage of being able to look at a database and make sense of data..
[17:44:39] pawnbox: has joined #RubyOnRails
[17:44:56] Ayey_: has joined #RubyOnRails
[17:46:55] Papierkorb: Who stores enums as strings in postgres, which actually supports enums?
[17:48:18] adlerdias__: has joined #RubyOnRails
[17:49:26] matthewd: dminuoso: Said advantage doesn't necessarily invalidate the claim it's inefficient ¯\_(ツ)_/¯
[17:49:35] gthank: has joined #RubyOnRails
[17:49:35] gthank: has joined #RubyOnRails
[17:50:05] matthewd: Papierkorb: and those have their own issues too (being insert-only, mostly)
[17:50:12] dminuoso: Papierkorb: We're using Oracle.
[17:50:20] dminuoso: The world does not revolve around Postgres
[17:50:33] dminuoso: matthewd: Im not convinved the performance argument holds true.
[17:50:44] dminuoso: Besides, why does DHH get to decide whether I'm willing to take that hit or not.
[17:51:04] dminuoso: I want the right to shoot myself in the foot. :(
[17:51:19] Papierkorb: matthewd: sure they have, though the insert-only thing has a reasonable cause
[17:52:32] benlieb: has joined #RubyOnRails
[17:53:23] jordansz: has joined #RubyOnRails
[17:57:36] Cohedrin: has joined #RubyOnRails
[17:58:18] juggler: has joined #RubyOnRails
[17:59:02] matthewd: dminuoso: David gets to decide what he cares about. If you want to shoot yourself in the foot, you or someone else might need to do a bit more implementation first.
[17:59:42] matthewd: dminuoso: And I'm pretty sure this is a case where someone has, in fact, subsequently done said work
[17:59:53] dminuoso: matthewd: Is David anything like nobu in that regard?
[18:00:04] dminuoso: as in "If I dont like it it's never gonna happen" ?
[18:01:29] matthewd: David controls the API; if he thinks an API's existence will lead people down a bad path, he'll veto it
[18:01:58] rogue_koder: has joined #RubyOnRails
[18:02:01] hotpancakes: has joined #RubyOnRails
[18:02:02] jordansz: im trying to make a tab with badge count, the badge span should go below the link argh cant figure it out; https://gist.github.com/jordanlance/ff5becf39eff1f61a28e2d088b13b5ae
[18:02:05] matthewd: .. but he doesn't generally care about the implementation
[18:02:14] dminuoso: Fair enough. Ill just ninja pack the change into some "localization fix" commit.
[18:02:15] jordansz: how would i approach this? nested_content tag also fails
[18:02:20] duderonomy: has joined #RubyOnRails
[18:02:39] hotpancakes: has joined #RubyOnRails
[18:02:51] dminuoso: jordansz: You sir need variables.
[18:03:06] tbuehlmann: dminuoso: while you're at it, wanna remove that activerecord suppression stuff? :)
[18:03:12] dminuoso: jordansz: Rule of thumb, is there's actual methods (other than plain accessor-style methods), hoist the code out. :-)
[18:03:40] jordansz: dminuoso i already searched examples really can't grasp how to get this reversed
[18:04:21] jordansz: the span class badge should be chid instead of link now the link variable just gets added
[18:04:26] dminuoso: tbuehlmann: what suppression stuff was that?
[18:04:41] jordansz: so i think i need a href content_tag with the span inside it?
[18:05:17] tbuehlmann: dminuoso: https://medium.com/spritle-software/rails-5-activerecord-suppress-a-step-too-far-d7ec2e4ed027#.enja83nq8
[18:05:33] dminuoso: Ohh right I remember
[18:05:52] dminuoso: tbuehlmann: Well DHH wanted it that way
[18:05:54] tbuehlmann: very controversial, sorry for bringing it up
[18:06:09] dminuoso: tbuehlmann: I remember the discussion on github
[18:06:39] tbuehlmann: I remember the response to ryan and didn't like it
[18:07:09] dminuoso: tbuehlmann: The "shut up, my will has been done" kind of response?
[18:07:27] tbuehlmann: "you're too late to the party, this is done"
[18:07:47] dminuoso: Though I think in the end it's an opt-in thing anyway
[18:08:04] tbuehlmann: yup, I'm just not using it and that's it
[18:08:08] dminuoso: I've started to majorly dislike callbacks.
[18:08:14] dminuoso: of any kind.
[18:08:32] matthewd: Opening a PR that just deletes a whole feature is not conducive to a friendly conversation ¯\_(ツ)_/¯
[18:08:40] dminuoso: invisible side effects that are completely disconnected from your code can create difficult to track down bugs
[18:09:06] dminuoso: (and by invisible I mean that they are not just hidden by the implementation of an api)
[18:09:19] dminuoso: matthewd: Haha, that's a fair point though.
[18:09:23] tbuehlmann: matthewd: yeah, I guess..
[18:10:13] Ayey_: has joined #RubyOnRails
[18:10:18] jordansz: this renders only the bagde inside the li @li = content_tag(:li, content_tag(:a, content_tag(:span, @badge, :class => "badge")) ) but unable to get the link text in ;s
[18:15:17] Or1on: has joined #RubyOnRails
[18:15:30] Rodya_: has joined #RubyOnRails
[18:17:48] antgel: has joined #RubyOnRails
[18:18:18] jordansz: how hard can it be, dminuoso i now have this https://gist.github.com/jordanlance/f4761d170cdcecfa8f0f7c5d1555ef96 it works except no link text i cannot figure out how to add it
[18:18:58] Ayey_: has joined #RubyOnRails
[18:20:14] artto: has joined #RubyOnRails
[18:21:51] robnester: has joined #RubyOnRails
[18:25:53] artto: has joined #RubyOnRails
[18:28:39] apotry: has joined #RubyOnRails
[18:28:41] envint: has joined #RubyOnRails
[18:32:00] choke: has joined #RubyOnRails
[18:32:15] SteenJobs: has joined #RubyOnRails
[18:34:41] Ayey_: has joined #RubyOnRails
[18:42:11] lightheaded: has joined #RubyOnRails
[18:44:24] Ayey_: has joined #RubyOnRails
[18:52:17] jordansz: argh still havent figured it out, content_tag(:a, content_tag(:span, @badge, :class => "badge"), :class => "#{ 'active' if @active }") works but how do i add link and data attribute?
[18:52:22] jordansz: its really not clear from the docs
[18:53:17] weaksauce: has joined #RubyOnRails
[18:55:19] cpruitt: jordansz: I believe :class => “”, :href => “”, “data-whatever” => “” should do what I think you want.
[18:55:56] Ayey_: has joined #RubyOnRails
[18:56:18] cpruitt: But I’m just reading your last message. I might be missing background here
[18:56:42] Rodya_: has joined #RubyOnRails
[19:01:29] hotpancakes: has joined #RubyOnRails
[19:01:51] defsdoor: has joined #RubyOnRails
[19:01:59] Ayey_: has joined #RubyOnRails
[19:03:05] Andr3as: if i dont want to have an edit html view, can i just ommit the template? or is there a better way?
[19:04:25] cnk: Omit that html and the controller action
[19:05:08] Andr3as: if i do updates via json then its enough to have an update action, right?
[19:05:27] cpruitt: has joined #RubyOnRails
[19:06:26] cnk: Yes. Though check the error condition of someone making a request with .html or accepts text/html
[19:06:46] Andr3as: thank you, cnk
[19:06:51] cnk: In my older rails projects that throws an error message that gets emailed ot me. V annoying
[19:06:53] Rodya_: has joined #RubyOnRails
[19:07:11] Andr3as: i see, will do.. (<)
[19:07:39] Andr3as: was meant to be a (y) - but still aint gonna work in irc anyway ;)
[19:08:29] jnoob22: has joined #RubyOnRails
[19:09:58] ahrs: has joined #RubyOnRails
[19:13:20] Rodya_: has joined #RubyOnRails
[19:14:39] hotpancakes: has joined #RubyOnRails
[19:15:11] eclecticjohny: has joined #RubyOnRails
[19:15:13] joelwallis: has joined #RubyOnRails
[19:17:02] hotpancakes: has joined #RubyOnRails
[19:19:58] jsrn_: has joined #RubyOnRails
[19:22:22] SteenJobs_: has joined #RubyOnRails
[19:23:08] dminuoso: Attachments. So let's say you have a form-style component where you can modify a resource and upload associated attachments. How would you sensibly handle uploading when you create a new resource?
[19:24:47] dminuoso: Ideally I want to upload the attachments the moment you toss them in, as opposed to waiting until you hit the save button for responsiveness reasons.
[19:26:25] dminuoso: The idea of simply uploading them, and passing their IDs through nested attributes in the resource leaves that slightly annoying bit of accidentally leaking attachments, which I would have to regularly clean up
[19:26:44] dminuoso: (Because you could open the form to create a new resource, upload a few files and then leave the form)
[19:27:18] Ayey_: has joined #RubyOnRails
[19:29:47] tbuehlmann: refile (and probably others) has a cache for these uploads. using s3, those could expire after a time
[19:30:59] dminuoso: tbuehlmann: Mmm. I was trying to downsize rails :(
[19:32:36] DoctorMonocular: has joined #RubyOnRails
[19:33:39] envint: has joined #RubyOnRails
[19:36:28] SteenJobs: has joined #RubyOnRails
[19:40:30] Technodrome: has joined #RubyOnRails
[19:41:28] Derperperd: has joined #RubyOnRails
[19:41:47] Ayey_: has joined #RubyOnRails
[19:42:48] dminuoso: tbuehlmann: Alternate idea. opening the new form could create a draft resource. opening another new document could then reset and reuse that same draft resource.
[19:43:05] dminuoso: Problem would be having multiple tabs with that form open.. not liking this.
[19:43:55] artto: has joined #RubyOnRails
[19:43:59] Nicmavr: Hey, so i'm trying to make a multi-step form in rails using the Wicked gem and I'm trying to link to Step 2 from Step 1 using the path method thingy but it is simply linking me back to the step 1 when I try it out
[19:44:10] Nicmavr: anyone familiar with rails paths to give me a quick pointer?
[19:44:11] chimmy: has joined #RubyOnRails
[19:44:53] pulkit4tech: has joined #RubyOnRails
[19:45:32] dionysus69: has joined #RubyOnRails
[19:45:42] Nicmavr: I have views profile_general_info as the first step and profile_additional_info as the second step, both under folders register/profile_steps
[19:45:50] joelwall_: has joined #RubyOnRails
[19:46:14] Nicmavr: if I try link_to profile_register_steps_path on step 1 it just links to the root of the path.. how can I make it link to step 2?
[19:47:16] chimkan: has joined #RubyOnRails
[19:48:41] chimkan_: has joined #RubyOnRails
[19:48:48] chimkan_: has left #RubyOnRails: ()
[19:51:17] szulak: has joined #RubyOnRails
[19:52:34] blackmesa: has joined #RubyOnRails
[19:56:56] reichni: has joined #RubyOnRails
[19:58:16] bitshift: has joined #RubyOnRails
[19:58:50] SteenJobs: has joined #RubyOnRails
[19:58:53] zpe: has joined #RubyOnRails
[20:01:30] envint: has joined #RubyOnRails
[20:02:58] DoctorMonocular: has joined #RubyOnRails
[20:09:01] meoblast001: has joined #RubyOnRails
[20:10:27] srinidhi: has joined #RubyOnRails
[20:15:19] Ayey_: has joined #RubyOnRails
[20:20:21] dionysus69: has joined #RubyOnRails
[20:20:30] hotpanca_: has joined #RubyOnRails
[20:20:59] thomashickey: has joined #RubyOnRails
[20:22:14] chouhoul_: has joined #RubyOnRails
[20:29:13] Leonardo_0112: has joined #RubyOnRails
[20:36:39] Andr3as: can i use if statements and controller methods within the routes.rb file? i thought i could have a different application route depending on if a user is signed in or not.... but dont really get it to work
[20:38:37] bitshift: Andr3as: Don't use controller methods, use a helper or something like that.
[20:38:54] _djbkd: has joined #RubyOnRails
[20:39:02] epochwolf: Andr3as: the routes file is only loaded on application startup.
[20:39:04] bitshift: maybe define it in place, I can't remember if you'll only extend the eigenclass of the instance of the routes, but chances are you'll only screw things up if you collide with something else.
[20:39:49] Andr3as: so so no luck for a dynamic app root?
[20:40:00] epochwolf: Andr3as: just use a redirect?
[20:40:11] dionysus69: has joined #RubyOnRails
[20:40:50] dminuoso: baweaver: !mcve
[20:40:50] helpa: baweaver: Please provide a Minimal, Complete, and Verifiable example of your problem to assist us - http://stackoverflow.com/help/mcve
[20:40:59] dminuoso: ACTION pokes baweaver with a whitelist
[20:41:07] joelwallis: has joined #RubyOnRails
[20:41:15] Andr3as: epochwolf: could you elaborate a little deeper?
[20:41:40] matthewd: Andr3as: http://guides.rubyonrails.org/v5.0/routing.html#advanced-constraints
[20:41:55] dminuoso: Andr3as: There is routing constraints you can use.
[20:41:57] epochwolf: oh... I forgot about those.
[20:42:02] dminuoso: matthewd raced me on that one.
[20:42:13] workmad3: has joined #RubyOnRails
[20:42:14] Andr3as: thanks matthewd, dminuoso
[20:42:27] Andr3as: will digg a bit
[20:45:51] blackmesa: has joined #RubyOnRails
[20:47:18] Andr3as: fwiw, found an example for my use case https://www.viget.com/articles/using-routing-constraints-to-root-your-app
[20:47:27] Andr3as: thanks again, guys
[20:48:24] Ayey_: has joined #RubyOnRails
[20:51:27] hahuang65: has joined #RubyOnRails
[20:51:57] dionysus69: has joined #RubyOnRails
[20:57:38] dionysus69: has joined #RubyOnRails
[21:00:09] joelwallis: has joined #RubyOnRails
[21:03:52] envint: has joined #RubyOnRails
[21:04:56] Technodrome: has joined #RubyOnRails
[21:10:22] raul782: has joined #RubyOnRails
[21:12:24] Ayey_: has joined #RubyOnRails
[21:12:31] Cache_Money: has joined #RubyOnRails
[21:14:41] evertversteeg: has joined #RubyOnRails
[21:18:01] lxsameer: has joined #RubyOnRails
[21:22:18] Ayey_: has joined #RubyOnRails
[21:23:34] nertzy: has joined #RubyOnRails
[21:25:50] jenrzzz: has joined #RubyOnRails
[21:25:53] arBmind: has joined #RubyOnRails
[21:25:57] dionysus70: has joined #RubyOnRails
[21:26:09] KnownSyntax: has joined #RubyOnRails
[21:27:15] eclecticjohny: has joined #RubyOnRails
[21:30:44] Cache_Money: has joined #RubyOnRails
[21:31:15] envint: has joined #RubyOnRails
[21:32:33] eclecticjohny: has joined #RubyOnRails
[21:33:35] eclecticjohny: has joined #RubyOnRails
[21:38:32] Ayey_: has joined #RubyOnRails
[21:39:31] _3dwardsharp: has joined #RubyOnRails
[21:45:04] pawnbox: has joined #RubyOnRails
[21:45:35] envint: has joined #RubyOnRails
[21:46:56] jsrn_: has joined #RubyOnRails
[21:58:22] jfelchner: has joined #RubyOnRails
[22:02:13] szulak_: has joined #RubyOnRails
[22:03:34] SteenJobs: has joined #RubyOnRails
[22:13:17] quazimodo: has joined #RubyOnRails
[22:15:20] Technodrome: has joined #RubyOnRails
[22:17:38] NoGodDamnIdea: has joined #RubyOnRails
[22:18:32] fourcolors: has joined #RubyOnRails
[22:18:49] fourcolors: has joined #RubyOnRails
[22:20:17] Suslov: has joined #RubyOnRails
[22:24:31] pawnbox: has joined #RubyOnRails
[22:28:35] Suslov: has joined #RubyOnRails
[22:32:23] Suslo: has joined #RubyOnRails
[22:33:47] artto: has joined #RubyOnRails
[22:34:03] marahin: Hello! How do I properly permit that kind of parameters? https://gist.githubusercontent.com/Marahin/88278d8cf1b2d4d2e5ab6ffcc89686e7/raw/d5375a8ac8c539355b1da0ced77f64dd15c12cd5/gistfile1.txt
[22:34:32] marahin: I want to get an array of hashes, e.g. [{"stack_id" => ..., "rank" => ..., "name" => ... }, ...]
[22:34:48] marahin: somehow params.permit(badges: [:stack_id, :rank, :name]) doesn't generate that for me :'(
[22:34:49] marahin: Rails 5 here.
[22:36:49] _3dwardsharp: marahin: well, an important thing to understand is that strong params is about permitting key names, and here you've got integer key names. it make more sense if your data structure was an array of hashes, and not a hash with integer keys...
[22:36:51] dminuoso: marahin: I would produce an unsafe hash and filter by hand.
[22:37:19] marahin: _3dwardsharp well sad thing is that I actually send an array of hashes. It is being parsed like that somewhere on Rails layer I believe
[22:37:32] dminuoso: marahin: Then you are passing it incorrectly.
[22:37:39] dminuoso: marahin: Can you please show how you pass it in the raw form?
[22:39:06] marahin: dminuoso https://gist.github.com/Marahin/c39e50634aa6c16740f717da92591b57
[22:39:16] marahin: Sorry for the indentation - copy pasting didn't go well I think
[22:39:23] dminuoso: That shows nothing.
[22:39:54] dminuoso: I have no idea what class badges is or what it produces. Show me a raw HTTP body.
[22:40:11] aperkins81: has joined #RubyOnRails
[22:40:38] marahin: well... dminuoso, badges at the moment of sending is an array (as you can see, I'm using .map there), and inside I am generating just a hash ({}).
[22:40:52] dminuoso: marahin: Note you likely need to provide a manual name such as "badges[]"
[22:40:52] marahin: Raw HTTP body - what exactly do you mean?
[22:41:11] dminuoso: marahin: so params: { "badges[]": badges }
[22:41:32] marahin: On Typhoeus side? I mean, while sending the request?
[22:41:44] marahin: That's weird.
[22:41:59] marahin: As far as I'm concerned it _worked_ with nested_attributes in other app
[22:42:19] dminuoso: marahin: How are parameters passed there?
[22:42:24] dminuoso: I would like to see a raw HTTP request.
[22:42:31] dminuoso: Not Ruby code, just plain HTTP.
[22:42:31] marahin: just one moment
[22:42:36] dminuoso: tcpdump if you have to
[22:42:38] marahin: dminuoso is Rails logs sufficient?
[22:42:50] cpruitt: marahin: Rails doesn’t care how the request is generated (typhoeus or otherwise). If you are passing an array of anything, the param name should be `foo[]` with the brackets.
[22:42:52] dminuoso: marahin: I dont care. As long as I see what rails receives
[22:43:36] dminuoso: marahin: or pass it in a body.
[22:44:01] marahin: dminuoso sure, I will do my best to see if I can get a real HTTP data, before-processing
[22:44:07] marahin: I will get back to you
[22:44:15] dminuoso: Okay, you do that.
[22:45:34] gambl0re: has joined #RubyOnRails
[22:46:00] blackhuey: has joined #RubyOnRails
[22:46:26] dminuoso: marahin: There's two ways to transmit parameters to rails. Either through params or the body. In the body you can just dump any JSON encoded object and Ruby will understand it like you would expect it to.
[22:47:16] marahin: dminuoso that's what I would want then, as I'm used to sending stuff like { blahblah: [array, of, elements] }.to_json
[22:47:22] marahin: and I _expect_ Rails to process it as blahblah: [] :)
[22:47:25] dminuoso: marahin: If you transmit them through params, you have to follow a special convention, because URI is only "key=value", so rails adheres to a special syntax that allows it to wrap any nested set of hashes/arrays through "list[]=2&list[]=3"
[22:47:41] dminuoso: marahin: Either adhere to the rails format if you use params, or pass it as a body.
[22:47:42] marahin: I am unsure if something has changed in Rails 5 or I just do not remember how did I use params with arrays in them.
[22:47:50] dminuoso: Just read what I said and process it.
[22:47:58] marahin: Yes, allright.
[22:48:37] marahin: Allright! I think we just got step ahead.
[22:49:01] marahin: dminuoso passing it in body as {key: array}.to_json worked as a charm, as now Rails process these as:
[22:49:16] marahin: https://gist.githubusercontent.com/Marahin/b3930804b09408984506c0c355a3eb0f/raw/95a2ee7c65e27301e4ceda8d355a5e01c92fb3d7/gistfile1.txt
[22:49:36] dminuoso: marahin: You can also undo that batches[] thing by the way.
[22:49:38] marahin: dminuoso thank you very much for explanation of difference between passing stuff in params and in body, it has proven useful.
[22:49:43] marahin: Yes, I assume :)
[22:50:14] dminuoso: matthewd: Do we have official documentation on that param format?
[22:50:47] marahin: I hope not, that would at least excuse my lack of knowledge a little. ;-)
[22:57:56] dminuoso: marahin: http://guides.rubyonrails.org/action_controller_overview.html#hash-and-array-parameters
[22:59:47] workmad3: has joined #RubyOnRails
[23:04:15] Ayey_: has joined #RubyOnRails
[23:06:42] artto: has joined #RubyOnRails
[23:08:38] xaviergmail: has joined #RubyOnRails
[23:17:38] patarr: has joined #RubyOnRails
[23:19:22] jfelchner_: has joined #RubyOnRails
[23:31:13] eyeye: has joined #RubyOnRails
[23:32:48] tenderlove: has joined #RubyOnRails
[23:32:49] dru: has joined #RubyOnRails
[23:40:31] Ayey_: has joined #RubyOnRails
[23:43:20] Dr_Wolf: has joined #RubyOnRails
[23:46:14] pawnbox: has joined #RubyOnRails
[23:47:31] robm: has joined #RubyOnRails
[23:51:00] matcouto: has joined #RubyOnRails
[23:51:10] Layla: has joined #RubyOnRails
[23:51:34] tomasm-: has joined #RubyOnRails
[23:53:11] fourcolors: has joined #RubyOnRails