« Back to channel list

#RubyOnRails - 08 July 2016

« Back 1 day Forward 1 day »
[00:05:11] Ponyo: has joined #RubyOnRails
[00:05:30] Synthbread: has joined #RubyOnRails
[00:06:44] pawnbox: has joined #RubyOnRails
[00:19:29] rafaelfranca: has joined #RubyOnRails
[00:21:38] quazimodo: I think I need to do a post request after oauth2 sign in (omniauth with devise)
[00:21:52] JoshGlzBrk: has joined #RubyOnRails
[00:22:32] quazimodo: flow is anonymous user fills in form, clicks submit, we throw modal to sign in via facebook. Once transparent redirect is done, submit the form
[00:23:30] quazimodo: so, either I store the params in the session, or i pass them through to facebook and get them back on the redirect, then that page probably needs JS
[00:26:13] allcentury: has joined #RubyOnRails
[00:41:22] pur3eval: has joined #RubyOnRails
[00:43:26] pur3eval: has joined #RubyOnRails
[00:44:02] Rainbow-Sapphire: has joined #RubyOnRails
[00:44:05] macsteps: has joined #RubyOnRails
[00:46:36] hazelux: has joined #RubyOnRails
[00:50:30] weaksauce: has joined #RubyOnRails
[00:50:50] Hobogrammer: has joined #RubyOnRails
[00:58:10] pawnbox: has joined #RubyOnRails
[00:59:09] kevr: has joined #RubyOnRails
[01:01:46] jenrzzz: has joined #RubyOnRails
[01:01:49] shinnya: has joined #RubyOnRails
[01:02:58] daffy_duck_2: has joined #RubyOnRails
[01:02:59] hahuang61: has joined #RubyOnRails
[01:16:19] rogue_koder: has joined #RubyOnRails
[01:22:49] roamingdog: has joined #RubyOnRails
[01:23:03] adre: has joined #RubyOnRails
[01:31:05] kinduff: has joined #RubyOnRails
[01:32:56] Darmani: roamingdog: hello ^.^
[01:33:34] Darmani: good timing I just got back myself lol
[01:35:34] Darmani: roamingdog: @variant = Variant.find_by(variant_id: params[:variant_id])
[01:35:42] Darmani: I don't think that line actually works.
[01:36:11] roamingdog: @variant = Variant.find(params[:variant_id])
[01:36:24] roamingdog: how is it now working exactly
[01:36:44] Darmani: It's not o.o
[01:37:19] Darmani: the one you wrote comes up with recordnotfound q.q
[01:37:19] roamingdog: well your line is searching variants table for variant_id. does that table have that column?
[01:37:53] Darmani: roamingdog: Oh I thought it was using the params submitted from the collection_select form o.o
[01:38:04] roamingdog: what is the value of params[:variant_id]
[01:38:29] Darmani: I'm not sure o.o
[01:38:50] roamingdog: @variant = Variant.find_by(id: params[:variant_id]) notice the difference, this line would work but it's a little verbose
[01:39:35] Darmani: roamingdog: That line will work?
[01:39:36] roamingdog: i'd recommend adding 'awesome_print' to your Gemfile. then put `ap params` in that method, then look at the log
[01:40:17] Darmani: roamingdog: Still comes with a nilclass error unfortunately...
[01:40:43] roamingdog: the issue is there's probably nothing in params[:variant_id], so have a look at it
[01:40:56] Darmani: roamingdog: Can I use a pry for that?
[01:42:10] Darmani: roamingdog: Well the @variant comes up nil...
[01:42:29] roamingdog: care to gist params?
[01:42:35] Darmani: yeah sure ^^
[01:42:57] Darmani: roamingdog: https://gist.github.com/mfifth/5c2d8a661d9ff3fdc86b47493e3932eb#file-params
[01:43:29] roamingdog: variant_id is hiding there under 'name'
[01:43:50] Darmani: roamingdog: hiding? o.o
[01:43:59] roamingdog: not sure why, but try @variant = Variant.find(params[:name][:variant_id])
[01:44:00] Ponyo: has joined #RubyOnRails
[01:44:53] Darmani: hang on...
[01:45:41] Darmani: roamingdog: that worked.....
[01:45:57] roamingdog: it's the :name in your collection_select
[01:46:01] Darmani: Well first of all why is the id hiding under the name??
[01:47:27] Darmani: Perhaps what collection_select does is actually lost on me...
[01:47:32] Darmani: It seems like a complicated method.
[01:50:05] jahbrewski: has joined #RubyOnRails
[01:51:26] ekinmur: has joined #RubyOnRails
[01:51:34] watersoul: has joined #RubyOnRails
[01:51:36] pawnbox: has joined #RubyOnRails
[01:51:43] Darmani: roamingdog: Well thank you friend. You're sage advice is always appreciated ^^
[01:52:33] roamingdog: sure. i'd change some things in collection_select and keep looking at params to see what does what (also look at the docs for it)
[01:53:16] Darmani: roamingdog: 10-4
[01:56:20] watersoul: has joined #RubyOnRails
[01:56:26] rafaelfranca: has joined #RubyOnRails
[01:57:10] jeromelanteri: Radar, i find solution for use jquery-ui. In fact, i had two problems: 1/my coffeescript code was not well include in correct file, 2/ i had no them css file added, no jquery.js file in the app/assets/stylesheet directory.
[01:57:34] zacts: has joined #RubyOnRails
[01:57:50] jeromelanteri: that is why ther were no error generate by the execution of the code (there is situations like that: no error happen, but something not works).
[01:58:24] jeromelanteri: Radr, yes... there is a lot of things i don't know well about rails, and much more about web programmation codes.
[02:00:47] jeromelanteri: Radar, now i have an other strange (strange for me...) problem occurs. I use jstree (a jquery code for show trees). This works fine... but not perfectly. When i do refresh the page, the jstree show his content (content has been pass through ajax), but when i call page from bootstrap menu navigation bar, the jstree content is empty. The ajax call does not occur in this particular situation and i have to refresh the
[02:00:47] jeromelanteri: page for see the content.
[02:01:06] Radar: jeromelanteri: as I keep saying: I'll need to see the issue occurring on my machine in order to help you.
[02:01:08] jeromelanteri: Radar, i would like to show you my code for this part
[02:01:19] Radar: jeromelanteri: an app which reproduces the issue is the only way I can debug something this complex.
[02:01:21] jeromelanteri: Radar, yes, i understand that.
[02:01:28] Radar: It is not a matter of pointing and saying "there is the problem"
[02:02:20] jeromelanteri: RAdar, yesterday, because of this, i do a simple apps for use jquery-ui and works directly with simple new application.
[02:02:37] jeromelanteri: Radar, i not talk about that, i understand what you tell me.
[02:02:42] MuffinPimp: has joined #RubyOnRails
[02:02:44] jeromelanteri: i'm ok with that.
[02:03:26] jeromelanteri: Radar, you think that just show the concerned code is not suffisant for a good dev to see were the problem come from ?
[02:03:34] Radar: jeromelanteri: correct.
[02:03:39] Radar: jeromelanteri: An app which reproduces the issue, please.
[02:03:53] jeromelanteri: Radar, you need absolutly a special little application to play with for be able to see were the problem is from ?
[02:04:01] Radar: jeromelanteri: Yes.
[02:04:09] Radar: jeromelanteri: As I have told you now for 3 days.
[02:04:30] Radar: There are too many moving parts in this code of yours for me to be able to point to a single spot and say there is the problem.
[02:04:32] jeromelanteri: SO i'm going to construct an app with bottstrap nav bar and jstree. But after that... you will have to populate a database...
[02:04:54] Radar: So the app should have a seeds file.
[02:05:43] jeromelanteri: Radar, you can also directly come to look at my full code...
[02:05:49] jeromelanteri: it is more simple
[02:06:01] jeromelanteri: i have it on botbucket
[02:06:13] Radar: Ok. As long as there's a way for me to quickly reproduce the issue that you're seeing.
[02:06:22] Radar: Create some steps for me to reproduce it and I will take a look after lnuch.
[02:07:03] jeromelanteri: Radar, very good... let me add you to the team of this app code of bitbucket. if you want.
[02:07:28] jeromelanteri: when you want, you are the helper
[02:09:10] jeromelanteri: Radar, i need your email or username on bitbucket for add you to the access list
[02:11:12] pwnd_nsfw: has joined #RubyOnRails
[02:12:26] jeromelanteri: Radar, i find name: "RadaR", i don't know if it is yours. (good lunch)
[02:13:59] jeromelanteri: https://bitbucket.org/jerome___/mon_site/src
[02:15:40] flashpoint9: has joined #RubyOnRails
[02:15:43] nettoweb: has joined #RubyOnRails
[02:15:45] blackmesa: has joined #RubyOnRails
[02:16:56] rubyonrails289: has joined #RubyOnRails
[02:22:34] pvertenten: has joined #RubyOnRails
[02:27:37] pawnbox: has joined #RubyOnRails
[02:38:39] siaw23: has joined #RubyOnRails
[02:48:31] SteenJobs: has joined #RubyOnRails
[02:52:04] enitiz: has joined #RubyOnRails
[02:56:07] Oliphaunte: has joined #RubyOnRails
[02:56:42] rafaelfranca: has joined #RubyOnRails
[02:59:53] timdotrb: has joined #RubyOnRails
[03:03:35] pawnbox: has joined #RubyOnRails
[03:03:44] hahuang61: has joined #RubyOnRails
[03:05:46] chipotle: has joined #RubyOnRails
[03:08:09] jishankai: has joined #RubyOnRails
[03:15:22] OldN0rse_: has joined #RubyOnRails
[03:15:49] jenrzzz: has joined #RubyOnRails
[03:15:49] jenrzzz: has joined #RubyOnRails
[03:16:13] OldN0rse_: Is there a way to have a helper for FactoryGirl
[03:16:54] OldN0rse_: essentially want to call a function that returns a hash for a "from email address" and then call it again for a "to email address"
[03:17:03] roamingdog: has joined #RubyOnRails
[03:17:32] blackmesa: has joined #RubyOnRails
[03:18:31] Radar: OldN0rse_: Example?
[03:18:38] braincras: has joined #RubyOnRails
[03:19:06] xcesariox: has joined #RubyOnRails
[03:19:48] OldN0rse_: http://pastebin.com/LJ8p2ZHH
[03:20:29] OldN0rse_: http://pastie.org/10901634
[03:20:55] OldN0rse_: FactoryGirl doesn't seem to like that
[03:21:13] OldN0rse_: trying to follow the DRY
[03:21:40] Radar: from_identity get_identity
[03:22:39] treaki_: has joined #RubyOnRails
[03:23:39] jeromelanteri: Radar, did your user name on bitbucket is RadaR ?
[03:24:04] OldN0rse_: still same issue
[03:24:04] Radar: It's ryanbigg, not Radar.
[03:24:10] jeromelanteri: (my english is bad)
[03:24:31] jeromelanteri: Radar, do you accept i add you to my accepted list of helpers ?
[03:26:05] Jasaka: has joined #RubyOnRails
[03:27:18] dc4: has joined #RubyOnRails
[03:27:30] jeromelanteri: Radar, you can said no. It is not a problem. Is it a problem to ask you that ?
[03:27:50] Radar: jeromelanteri: I am now busy with work, sorry.
[03:28:01] Radar: jeromelanteri: DId you get some steps up to reproduce the issue?
[03:28:01] AntiSpamMeta: has joined #RubyOnRails
[03:28:15] jeromelanteri: Radar, ok, i don't want to distrub you, sorry. Have a good day, bye.
[03:28:19] chouhoul_: has joined #RubyOnRails
[03:29:01] jeromelanteri: Radar, don't loose your time here, i don't want you have problem at works because you help people here.
[03:29:53] jishankai: Can I replace 404.html with 404.html.slim? After that, I got error "no route matches [GET] '/404'"
[03:30:33] jeromelanteri: jishankai, do you try also without hmtl extention (just slim) ?
[03:31:05] jishankai: jeromelanteri: yes, i have tried, same error.
[03:31:55] jeromelanteri: jishankai, and you added rails-slim gem to ?
[03:32:35] jishankai: jeromelanteri: yes. .slim works well in app/views
[03:33:23] jeromelanteri: jishankai, mmm.... maybe it can not works on thesse special pages (404erorr and all of these) because out of the mecanism. I don't know more.
[03:33:55] jeromelanteri: jishankai, i just read this: http://code.runnable.com/Um2m5sRjRW9QAABf/how-can-i-use-slim-as-a-template-engine-for-ruby-on-rails-
[03:34:15] jeromelanteri: and see that maybe it should have to go by controller for works...
[03:34:52] jeromelanteri: so maybe you should render these slim files to be read as html page at the end.
[03:35:43] jishankai: jeromelanteri: thank u, bro. i will change them back.
[03:36:06] jeromelanteri: jishankai, i'm not sure... but hope this help you.
[03:39:22] Guest683: has joined #RubyOnRails
[03:46:05] upsell5: has joined #RubyOnRails
[03:57:35] queequeg1: has joined #RubyOnRails
[04:02:09] Oliphaunte: has joined #RubyOnRails
[04:05:18] rickmasta: has joined #RubyOnRails
[04:07:47] pontiki: has joined #RubyOnRails
[04:09:43] harfangk: has joined #RubyOnRails
[04:09:52] xcesariox: has joined #RubyOnRails
[04:11:02] sypheren: has joined #RubyOnRails
[04:16:00] pawnbox: has joined #RubyOnRails
[04:17:42] hahuang61: has joined #RubyOnRails
[04:22:46] blackmesa: has joined #RubyOnRails
[04:25:05] hahuang61: has joined #RubyOnRails
[04:30:22] duncannz: has joined #RubyOnRails
[04:31:04] duncannz: has joined #RubyOnRails
[04:37:32] DX1: has joined #RubyOnRails
[04:38:46] jenrzzz: has joined #RubyOnRails
[04:38:54] jenrzzz: has joined #RubyOnRails
[04:41:37] Macaveli: has joined #RubyOnRails
[04:45:11] Tempesta: has joined #RubyOnRails
[04:46:37] ensyde__: has joined #RubyOnRails
[04:51:57] pawnbox: has joined #RubyOnRails
[04:53:09] AndrewIsHere: has joined #RubyOnRails
[04:55:20] flashpoint9: has joined #RubyOnRails
[04:55:41] alfiemax: has joined #RubyOnRails
[05:07:12] rvanlieshout: has joined #RubyOnRails
[05:07:54] jenrzzz: has joined #RubyOnRails
[05:09:59] pawnbox: has joined #RubyOnRails
[05:10:00] xibalba: has joined #RubyOnRails
[05:10:02] zacts: has joined #RubyOnRails
[05:14:41] tvw: has joined #RubyOnRails
[05:21:16] manfrin_: has joined #RubyOnRails
[05:22:17] djbkd: has joined #RubyOnRails
[05:23:43] wldcordeiro: has joined #RubyOnRails
[05:25:49] blackmesa: has joined #RubyOnRails
[05:28:48] pawnbox_: has joined #RubyOnRails
[05:35:03] mitt3ns: has joined #RubyOnRails
[05:41:31] harfangk: has joined #RubyOnRails
[05:47:23] tego101: has joined #RubyOnRails
[05:49:24] dtzuzu: has joined #RubyOnRails
[05:56:40] yfeldblum: has joined #RubyOnRails
[06:04:01] Guest683: has joined #RubyOnRails
[06:05:58] kevr: has joined #RubyOnRails
[06:06:35] zacts: has joined #RubyOnRails
[06:06:47] pawnbox: has joined #RubyOnRails
[06:07:05] arBmind: has joined #RubyOnRails
[06:07:46] daumie: has joined #RubyOnRails
[06:09:40] pawnbox: has joined #RubyOnRails
[06:11:25] solars: has joined #RubyOnRails
[06:18:18] jenrzzz: has joined #RubyOnRails
[06:18:18] jenrzzz: has joined #RubyOnRails
[06:20:52] Palsson: has joined #RubyOnRails
[06:25:10] AndrewIsHere: has joined #RubyOnRails
[06:25:50] hahuang61: has joined #RubyOnRails
[06:26:41] cd-rum: has joined #RubyOnRails
[06:27:35] blackmesa: has joined #RubyOnRails
[06:27:46] toomus: has joined #RubyOnRails
[06:27:53] conta: has joined #RubyOnRails
[06:33:57] zacts: has joined #RubyOnRails
[06:33:59] Pupeno: has joined #RubyOnRails
[06:38:28] toomus: How to display date as Today, Yesterday, Tomorrow. I know time_ago_in_words
[06:39:01] toomus: but I don't see this functionality in time_ago_in_words
[06:39:14] dminuoso: has joined #RubyOnRails
[06:39:19] jahbrewski: has joined #RubyOnRails
[06:44:41] finnnnnnnnnnn: has joined #RubyOnRails
[06:45:45] pawnbox: has joined #RubyOnRails
[06:46:47] comrad: has joined #RubyOnRails
[06:52:47] fermonkus: has joined #RubyOnRails
[06:53:24] aganov: has joined #RubyOnRails
[06:54:52] ur5us: has joined #RubyOnRails
[06:58:26] Macaveli: has joined #RubyOnRails
[06:58:41] alfiemax: has joined #RubyOnRails
[07:04:44] Palsson: has joined #RubyOnRails
[07:05:16] dionysus69: has joined #RubyOnRails
[07:06:38] deecross: has joined #RubyOnRails
[07:06:57] dminuoso: has joined #RubyOnRails
[07:13:06] darutoko: has joined #RubyOnRails
[07:13:45] artto: has joined #RubyOnRails
[07:16:07] GoranPavlovic: has joined #RubyOnRails
[07:18:38] srinidhi: has joined #RubyOnRails
[07:18:44] mark_66: has joined #RubyOnRails
[07:23:46] atomx: has joined #RubyOnRails
[07:26:17] deecross: has joined #RubyOnRails
[07:26:40] chipotle: has joined #RubyOnRails
[07:29:22] blackmesa: has joined #RubyOnRails
[07:29:27] Pupeno: has joined #RubyOnRails
[07:29:58] Darmani: Hey guys! Question.
[07:30:16] Darmani: So this line here ->> @order = Order.find_by!(user_id: current_user.id) <-- is how I find an order for a user.
[07:30:30] Darmani: The problem is when I logout I get a nil-class error cause it can't find the user anymore :[
[07:30:33] Darmani: How do I fix this?
[07:30:48] tbuehlmann: well, that's to be expected, isn't it?
[07:31:02] Darmani: tbuehlmann: You know, to be honest I never thought that far ahead lol
[07:31:26] tbuehlmann: if there's no current_user (== nil), current_user.id will raise an error
[07:31:42] Darmani: tbuehlmann: yeah. I know why the error is happening.
[07:31:48] Darmani: I just don't know how to fix it...
[07:32:40] chipotle: has joined #RubyOnRails
[07:32:59] tbuehlmann: how does it come to this situation? how are you trying to find an Order when you don't have a user?
[07:33:34] Kedare: has joined #RubyOnRails
[07:34:15] Darmani: Well the shirts controller loads it on the index page...
[07:35:07] Darmani: :O I think what I need to do is only load that variable when a user is logged in o.o
[07:35:10] Darmani: What do you think?
[07:36:32] tbuehlmann: hard to say without knowing a bit of your app, but finding a user's order when there's no user seems weird
[07:36:58] Darmani: tbuehlmann: yeah I have done bug testing yet. I've just been creating it little by little.
[07:40:06] shortCircuit__: has joined #RubyOnRails
[07:40:53] Darmani: tbuehlmann: Fixed! The variable only loads if someone is logged in, like it should be.
[07:41:04] Darmani: ACTION waves to shortCircuit__ 
[07:41:12] kevr: has joined #RubyOnRails
[07:41:51] dkam: has joined #RubyOnRails
[07:42:00] cd-rum: If you're using Devise (like for current_user) then wrap the call in an if user_signed_in? condition
[07:42:14] shortCircuit__: I was trying to understand how rails builds associations when we write something like has_one and has_many .. I have found one intriguing thing .. Reflection and I also looked through the Association inheritance tree .. I also saw Hasone builder .. but I am not beiing able to understand what I sought in the first place
[07:42:18] tbuehlmann: Darmani: \o/
[07:42:20] shortCircuit__: I need some help
[07:42:30] Darmani: cd-rum: yeah that's what I did ^.^
[07:45:07] cd-rum: Darmani Still not working?
[07:45:14] Palsson: has joined #RubyOnRails
[07:45:39] cd-rum: Darmani I'd avoid using current_user in the find method tbh, also calling it with a ! will always fail loudly
[07:46:01] Darmani: cd-rum: yeah it works now...
[07:46:09] cd-rum: Darmani Solid
[07:49:48] finnnnnnnnnnn: has joined #RubyOnRails
[07:53:01] ferr: has joined #RubyOnRails
[07:55:08] coffeejunk: has joined #RubyOnRails
[07:57:22] alfiemax: has joined #RubyOnRails
[08:00:14] Pupeno: has joined #RubyOnRails
[08:02:20] Pupeno: has joined #RubyOnRails
[08:02:32] Dimik: has joined #RubyOnRails
[08:03:22] Darmani: You didn't ask a question lol
[08:04:42] ngw: has joined #RubyOnRails
[08:08:16] artto: has joined #RubyOnRails
[08:10:43] Pupeno: has joined #RubyOnRails
[08:11:35] hahuang61: has joined #RubyOnRails
[08:12:50] zacts: has joined #RubyOnRails
[08:15:54] blackmesa: has joined #RubyOnRails
[08:16:14] artto_: has joined #RubyOnRails
[08:16:58] Pupeno: has joined #RubyOnRails
[08:17:10] jahbrewski: has joined #RubyOnRails
[08:17:22] ja: has joined #RubyOnRails
[08:17:38] brainslug: has joined #RubyOnRails
[08:18:00] GragHarker: has joined #RubyOnRails
[08:19:46] shortCircuit__: the question is when I write something like class User has_many :profiles .. how dows active record work / what does it do to ensure that an user object will have a .profiles method. How role does Reflection in association.rb play?
[08:20:19] dmz: has joined #RubyOnRails
[08:21:20] Pupeno: has joined #RubyOnRails
[08:22:34] dminuoso: shortCircuit__: Rails uses a combination of method_missing and adapter specific magic
[08:23:13] dminuoso: shortCircuit__: The first time method_missing is invoked, it does a few things - amongst of which it also checks whether there is a matching column name, if so a method is automatically defined (so that it doesn't have to go through these steps again).
[08:23:52] dminuoso: shortCircuit__: For has_many and belongs_to I expect it to actually just straight up define a method.
[08:24:53] AzaToth: has joined #RubyOnRails
[08:25:01] Guest683: has joined #RubyOnRails
[08:25:37] Pazician: has joined #RubyOnRails
[08:26:29] Pupeno: has joined #RubyOnRails
[08:26:58] shortCircuit__: I first started here https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations.rb, and after that from associations/has_one.rb and singular_association.rb I reached https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/builder/association.rb .. but after that I can't understand what is happening
[08:28:21] marr: has joined #RubyOnRails
[08:33:45] dminuoso: shortCircuit__: It might be easier if you trace/step through the first time you attempt to use an association.
[08:35:37] artto: has joined #RubyOnRails
[08:37:47] Boatkenende: has joined #RubyOnRails
[08:39:15] blackhuey: has joined #RubyOnRails
[08:44:40] agit0: has joined #RubyOnRails
[08:47:08] AzaToth: has joined #RubyOnRails
[08:47:24] circ-user-2GSed: has joined #RubyOnRails
[08:51:42] linnal: Hi, can anyone suggest me a good gem for drag and drop list?
[08:51:48] AimlessRAven: has joined #RubyOnRails
[08:52:41] AimlessRAven: i have post view with comments .. How to create js view who rend my edit comment form to my post-comment place
[08:52:46] rvanlieshout: linnal: jquery-ui?
[08:52:47] AimlessRAven: no go to different page for edit comment
[08:56:02] chipotle_: has joined #RubyOnRails
[08:56:42] oystersauce8: has joined #RubyOnRails
[08:58:58] linnal: rvanlieshout do you have any suggestion for how to handle the row order, when you have to save them on a database?
[09:00:55] universa1: rvanlieshout: order attribute?!
[09:01:05] arBmind: has joined #RubyOnRails
[09:01:58] lxsameer: has joined #RubyOnRails
[09:02:35] linnal: I want to avoid updating all the items of the list, just because I move one element or added a new one.
[09:02:37] alfiemax: has joined #RubyOnRails
[09:04:43] artto: has joined #RubyOnRails
[09:05:20] universa1: linnal: there is one gem which uses a float column for a rank attribute, and puts moved elements in the middle, and only rescales if necessary... ...can't remember the name though, maybe it is on ruby-toolbox.org
[09:05:39] universa1: s/.org/.com/
[09:06:23] universa1: https://www.ruby-toolbox.com/categories/Active_Record_Sortables
[09:06:56] Pupeno: has joined #RubyOnRails
[09:09:28] linnal: universa1: do you mean this one https://github.com/mixonic/ranked-model
[09:09:51] universa1: linnal: i don't know, i read some blog post a long time ago. can't remember any specifics.
[09:10:06] artto: has joined #RubyOnRails
[09:11:49] Pupeno: has joined #RubyOnRails
[09:12:10] linnal: universa1: ok thanks, I used this one but uses negative numbers too, and it does not handle update when you put something in the top. like if I have -3 -2 0 2 3 and I move 3 to top, ti updates 3 to 0 but it does not update the negative numbers, so they always stay in the top. Any way thank you!
[09:18:13] mattwithoos: has joined #RubyOnRails
[09:24:00] wldcordeiro: has joined #RubyOnRails
[09:26:12] finnnnnnnnnnn: has joined #RubyOnRails
[09:29:09] blackmesa: has joined #RubyOnRails
[09:29:47] nachtw1nd: has joined #RubyOnRails
[09:34:28] nettoweb: has joined #RubyOnRails
[09:35:53] nachtw1nd: has joined #RubyOnRails
[09:38:22] Circuit8: has joined #RubyOnRails
[09:40:04] harfangk: has joined #RubyOnRails
[09:41:24] Circuit8: Does anyone here have Rails setup with NPM as the front end dependency manager and module support with browserify and Es6 compilation? I can't for the life of me get it all working together...
[09:42:02] universa1: Circuit8: webpack? gulp?
[09:44:20] Circuit8: So are you suggesting forgoing the rails assets pipeline completely and using one of these?
[09:45:28] universa1: Circuit8: http://nandovieira.com/using-es6-with-asset-pipeline-on-ruby-on-rails
[09:45:41] universa1: it was more of a question if you're using one of those..
[09:47:44] Circuit8: No I haven't been using those
[09:47:55] Circuit8: I was trying several methods
[09:48:06] Circuit8: mainly down the babelify / browserify route
[09:48:23] Circuit8: but actually I haven't tried everything in that article you linked so I'll give some of that a go
[09:48:32] workmad3: has joined #RubyOnRails
[09:48:46] universa1: Circuit8: first hit on google ;) so no clue about it. i am not a front-end guy.
[09:48:57] dkam: has joined #RubyOnRails
[09:52:58] alfiemax: has joined #RubyOnRails
[09:55:25] allcentury: has joined #RubyOnRails
[09:56:52] roshanavand: has joined #RubyOnRails
[10:04:56] pawnbox: has joined #RubyOnRails
[10:11:01] Hobogrammer: has joined #RubyOnRails
[10:12:20] hahuang61: has joined #RubyOnRails
[10:13:16] zacts: has joined #RubyOnRails
[10:15:58] harfangk: has joined #RubyOnRails
[10:18:39] jahbrews1i: has joined #RubyOnRails
[10:20:33] srinidhi: has joined #RubyOnRails
[10:20:35] samuel02: has joined #RubyOnRails
[10:24:05] SteenJobs: has joined #RubyOnRails
[10:27:54] AndrewIsHere: has joined #RubyOnRails
[10:32:43] wldcordeiro: has joined #RubyOnRails
[10:33:26] blackmesa: has joined #RubyOnRails
[10:38:07] dionysus69: is imageable here belongs_to :imageable, polymorphic: true just a variable? it is not a keyword right?
[10:39:05] universa1: dionysus69: it is not a variable.
[10:39:12] dionysus69: what is it then?
[10:39:17] universa1: dionysus69: it is a symbol, and the first argument to the function belongs_to
[10:40:16] dionysus69: I mean, that much I understand but, if the model is called, then would it be imageable or pictureable?
[10:40:28] dionysus69: if model is called picture*
[10:45:16] abhvl: has joined #RubyOnRails
[10:46:06] abhvl: in my model unit test i have t = Namespace::Model.find_by_id(1234) which failes. how can i make it give more info about why it failes? this line works in rails c and inside app
[10:46:55] SteenJobs: has joined #RubyOnRails
[10:51:23] AimlessRAven: has joined #RubyOnRails
[10:51:47] AimlessRAven: What is the besht way to make ransack sort_link who sort association
[10:53:51] pawnbox: has joined #RubyOnRails
[10:54:59] wldcordeiro: has joined #RubyOnRails
[10:55:18] oweff: has joined #RubyOnRails
[10:57:42] artto: has joined #RubyOnRails
[10:58:11] dangerousdave: has joined #RubyOnRails
[10:58:51] chipotle: has joined #RubyOnRails
[11:00:29] rodfersou: has joined #RubyOnRails
[11:02:21] dangerousdave: failed with my first word.
[11:02:30] umdstu: has joined #RubyOnRails
[11:02:44] bonswouar: has joined #RubyOnRails
[11:03:08] binaryplease3: has joined #RubyOnRails
[11:03:13] dangerousdave: A client of mine has made some company acquisitions ~30. Each of these companies has their own site and authentication. They want me to create a master authentication system that can be used by all the company sites, and that will allow for a gradual consolidation of accounts over a period of time. Any ideas on good approach to this problem please?
[11:04:25] dminuoso: AimlessRaven: !rule1
[11:04:25] helpa: AimlessRaven: Do your research before hand. Your question may be answerable with a quick Google search or by simply experimenting. If you're using a method in Rails, look it up in the API Docs or in the Official Guides.
[11:04:54] workmad3: dangerousdave: start reading up on SSO systems like CAS, OpenID, SAML
[11:05:09] gregf_: has joined #RubyOnRails
[11:05:13] dminuoso: dangerousdave: OAuth 2.0 is the industry standard for authoziation. Also read up on OpenID connect.
[11:05:55] dminuoso: dangerousdave: And like workmad3 suggested - READ. Don't try to look for gems until you thoroughly understand each method and know why you picked something.
[11:06:32] workmad3: yeah, understanding the problem space and existing standards for solutions is a major bonus when it comes to centralised authentication and authorization
[11:06:55] dangerousdave: thanks, good advice. I was thinking more about the mechanism by which consolidation could take place. How would a user go from an account on subsidiary site, to a master account on the parent site?
[11:07:18] fermonkus: has joined #RubyOnRails
[11:07:19] dminuoso: dangerousdave: If you start reading up on these topics, it will become obvious how that works.
[11:07:40] workmad3: (my current company has an oauth2 setup with an identity layer on top that is almost but not quite openid-connect... because of a lack of reading by the original implementors :( )
[11:07:48] umdstu: trying to parse some data from resp, and after cleaning it up, and i trying to render it back as json in a response, I get “Encoding::UndefinedConversionError (“\xD9” from ASCII-8BIT to UTF-8):; even after i called to_s.encode(‘UTF-9’, {invalid: :replace, undef: :replace, replace: ‘?’}) on the values being cleaned up.
[11:07:52] dangerousdave: dminuoso , let me post by google history, I didn't find anything of use...
[11:08:14] workmad3: dangerousdave: have you read up on oauth2 and openid-connect yet?
[11:08:27] dminuoso: dangerousdave: Do.
[11:08:31] workmad3: dangerousdave: then follow dminuoso's advice ;)
[11:09:04] dminuoso: workmad3: We too have something that is almost, but not quite, entirely unlike openid-connect.
[11:09:04] pawnbox: has joined #RubyOnRails
[11:09:15] workmad3: dminuoso: heh :)
[11:10:03] artto: has joined #RubyOnRails
[11:11:07] workmad3: dminuoso: I've got the dubious pleasure of being involved in the next stage of our centralisation, where we're planning on pushing various user attributes into our JWT tokens so client apps can start making use of them in a form of ABAC scheme
[11:12:36] dminuoso: workmad3: Oh I just had the pleasure of hacking an SSO mechanism into a closed source application with no APIs or plugin features.
[11:17:48] umdstu: well i just drank a red bull, so....
[11:18:25] Xentil: has joined #RubyOnRails
[11:18:51] cd-rum: has joined #RubyOnRails
[11:20:17] Macaveli: has joined #RubyOnRails
[11:22:33] umdstu: sugar free, of course. gotta keep this hot bod.
[11:23:31] bonswouar: has joined #RubyOnRails
[11:25:46] njero: has joined #RubyOnRails
[11:26:14] flashpoint9: has joined #RubyOnRails
[11:30:49] flujan: has joined #RubyOnRails
[11:31:50] flujan: Hello guys. So caching a action is removed. How I am supposed to cache a page where I used to use the cache_action? I should put cache () on the very beginning of the page?
[11:33:10] bonswouar: has joined #RubyOnRails
[11:33:47] dionysus69: has joined #RubyOnRails
[11:35:13] blackmesa: has joined #RubyOnRails
[11:35:52] ldnunes: has joined #RubyOnRails
[11:36:09] deecross: has joined #RubyOnRails
[11:36:24] rickmasta: has joined #RubyOnRails
[11:36:46] herbst: has joined #RubyOnRails
[11:37:23] herbst: I need to test if a form is triggered with the right params to a external url with capybara and minitest. Does anyone have any suggestions? Stuck right now
[11:37:49] herbst: whenever i click the search button i get "ActionController::RoutingError: ActionController::RoutingError: No route matches [GET] "/@@search""
[11:38:26] dminuoso: !rule3 herbst
[11:38:26] helpa: Clearly explain what is happening and create a Gist (http://gist.github.com), (formatted neatly please: http://bit.ly/1q75oia) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces.
[11:38:44] pydave6367: has joined #RubyOnRails
[11:38:54] pydave6367: has joined #RubyOnRails
[11:39:06] herbst: sure, sorry: https://gist.github.com/b1nary/c7f7e5e2efe35a82c96418999bdcaa35
[11:39:58] dminuoso: herbst: what exactly are you trying to test?
[11:40:23] herbst: that it creates the right get request / builds the right url. I realize its pretty obvious it does, but it needs to be tested nontheless :)
[11:40:37] dminuoso: herbst: Why do you only care about the URL?
[11:41:14] dminuoso: herbst: what happens if the url is wrong?
[11:41:18] herbst: I have tests that confirm everything around it, i just have none that confirms that the button indeed redirects you to the right page with the right parameters
[11:41:24] matthewd: herbst: Does it? If "/@@search" is correct, it should be routed, shouldn't it?
[11:41:33] herbst: its not the same application
[11:41:36] herbst: its external
[11:41:48] dminuoso: That's a good enough reason then.
[11:42:00] herbst: else it would be easy, but i never had to test something like this so far
[11:42:27] matthewd: I think it should work
[11:42:38] matthewd: Does the external URL really contain '@@search' ?!
[11:42:47] herbst: yes -.- i dont question our python team anymore
[11:43:04] herbst: its http://domain.tld/@@search what is written in action
[11:43:45] herbst: it seems rails ignores the host and only tries to query the path, what then fails
[11:43:51] herbst: at least that is what i think i see it doing
[11:43:58] dminuoso: herbst: Well, that would be capybara, not rails.
[11:44:13] matthewd: Ah, you might need to use a different driver
[11:44:24] rafaelfr_: has joined #RubyOnRails
[11:44:56] herbst: huh, you are right. Next to unrelated log stuff poltergeist actually uses the whole url
[11:48:07] herbst: awesome. really works like a charm. And poltergeist is already included anyway. Thanks a lot guys!
[11:49:09] Xentil: has joined #RubyOnRails
[11:51:49] pawnbox: has joined #RubyOnRails
[11:52:36] bruce_lee: has joined #RubyOnRails
[11:52:36] bruce_lee: has joined #RubyOnRails
[11:55:11] artto: has joined #RubyOnRails
[11:55:18] jahbrews1i: has joined #RubyOnRails
[11:58:59] SteenJobs: has joined #RubyOnRails
[12:01:16] znc|: has joined #RubyOnRails
[12:03:56] znc|: has joined #RubyOnRails
[12:05:05] oystersauce8: has joined #RubyOnRails
[12:06:04] avelldiroll: has joined #RubyOnRails
[12:06:27] allcentury: has joined #RubyOnRails
[12:06:46] lexileo: has joined #RubyOnRails
[12:09:14] pawnbox: has joined #RubyOnRails
[12:13:02] lupine: has joined #RubyOnRails
[12:13:04] hahuang61: has joined #RubyOnRails
[12:13:22] dblessing: has joined #RubyOnRails
[12:26:49] SteenJobs: has joined #RubyOnRails
[12:29:22] AndrewIsHere: has joined #RubyOnRails
[12:30:41] artto: has joined #RubyOnRails
[12:31:42] rodfersou: has joined #RubyOnRails
[12:33:06] adlerdias: has joined #RubyOnRails
[12:37:00] quazimodo: has joined #RubyOnRails
[12:38:14] blackmesa: has joined #RubyOnRails
[12:39:28] pawnbox: has joined #RubyOnRails
[12:40:53] bradflaugher: has joined #RubyOnRails
[12:43:14] flashpoint9: has joined #RubyOnRails
[12:44:55] Detch: has joined #RubyOnRails
[12:46:29] Moeh: has joined #RubyOnRails
[12:47:06] flashpoint9: has joined #RubyOnRails
[12:47:17] Moeh: Hey guys, we are using https://github.com/rubysherpas/paranoia and it seems that the validation "validates :email, presence: true, allow_blank: false" in the User model is not enforced. So I create a user with email "asd@asd.com", soft delete it, and create another user with email "asd@asd.com" without problems.
[12:47:19] rubyonrails164: has joined #RubyOnRails
[12:47:31] utal: has joined #RubyOnRails
[12:47:36] Moeh: Is there a way to enforce uniqueness also for users that have "deleted_at" filled?
[12:47:47] rubyonrails164: how can i display docx file in browser?
[12:48:17] rubyonrails164: i have to display docx file on link click
[12:49:04] workmad3: Moeh: err... the validation you've put there isn't a uniqueness validation...
[12:50:33] dionysus69: I want to use a common method for two serializers. would module suit this situation?
[12:50:43] Moeh: workmad3: Sorry, copy past error, this is the actual line: "validates :email, presence: true, allow_blank: false, uniqueness: true"
[12:51:48] workmad3: Moeh: ah right... so it's probably having an issue because `paranoia` is setting up a default scope that hides 'deleted' users from the uniqueness check
[12:52:31] workmad3: Moeh: so for starters - you should also have a uniqueness constraint on the database table (the uniqueness validator cannot guarantee uniqueness... duplicate records can slip through in a large variety of concurrency-related circumstances)
[12:52:54] tkiel: has joined #RubyOnRails
[12:54:11] tvw: has joined #RubyOnRails
[12:54:27] workmad3: Moeh: for the uniqueness itself... you may be able to do `uniqueness: { conditions: ->{ unscoped } }` to remove the default scope from consideration when the validation checks for duplicates
[12:54:29] nettoweb: has joined #RubyOnRails
[12:55:48] finnnnnnnnnnn: has joined #RubyOnRails
[12:56:16] blackmesa: has joined #RubyOnRails
[12:56:54] Moeh: We do have a uniqueness constraint in the db, but we would rather like to have rails catch the error
[12:56:59] pawnbox: has joined #RubyOnRails
[12:57:18] Moeh: Will try the conditions
[12:59:18] Moeh: How would the entire line look like with the 'conditions' part? I somehow can't find examples for using conditions
[13:00:40] akira616: has joined #RubyOnRails
[13:00:46] ramortegui: has joined #RubyOnRails
[13:01:20] utal: has joined #RubyOnRails
[13:02:09] mark_66: has joined #RubyOnRails
[13:02:50] zacts: has joined #RubyOnRails
[13:03:43] Moeh: workmad3: validates :email, presence: true, allow_blank: false, uniqueness: { conditions: ->{ unscoped }} - this seems to work, is it correct? Because I don't see the "true" anywhere
[13:04:18] utal: has joined #RubyOnRails
[13:04:46] Moeh: Okay, using this line it fails for every email address, so there is an error
[13:05:19] Macaveli: has joined #RubyOnRails
[13:06:16] finnnnnnnnnnn_: has joined #RubyOnRails
[13:06:23] deecross_: has joined #RubyOnRails
[13:07:54] daumie: has joined #RubyOnRails
[13:09:34] emachnic: has joined #RubyOnRails
[13:10:56] pwnd_nsfw`: has joined #RubyOnRails
[13:13:42] aegis3121: has joined #RubyOnRails
[13:17:30] ekinmur: has joined #RubyOnRails
[13:18:48] GorillaApe: has joined #RubyOnRails
[13:18:59] flashpoint9: has joined #RubyOnRails
[13:20:10] deecross: has joined #RubyOnRails
[13:21:21] naftilos76: has joined #RubyOnRails
[13:22:25] deecross: has joined #RubyOnRails
[13:26:11] orolo: has joined #RubyOnRails
[13:26:43] artto: has joined #RubyOnRails
[13:27:55] naftilos76: Hi everyone, i am sending an ajax request. However i sometimes alter the contents of one specific css stylesheet file which i want to be taken into consideration before rendering the target template view in order to reflect the changes in the css styling towards the view being rendered. Is that doable? Can i somehow re-load the css file i am interested in from my js view?
[13:28:15] naftilos76: I am on rails 4.2.4 and ruby 2.0
[13:29:18] Xentil2: has joined #RubyOnRails
[13:30:48] bonswouar_: has joined #RubyOnRails
[13:32:02] ebbflowgo: has joined #RubyOnRails
[13:32:26] AimlessRAven: has joined #RubyOnRails
[13:32:31] dikons: has joined #RubyOnRails
[13:33:09] AimlessRAven: hi all, i have @post.comments -> i loop this @post comments to show in view all comments on post -> i have edit button after all comment who on click rend js view with edit form
[13:33:33] AimlessRAven: the problem is when i click edit bitton the form rend in all %p.body not just to current %p.body
[13:33:40] AimlessRAven: any ideas how to fix this
[13:33:41] camonz: has joined #RubyOnRails
[13:34:15] macsteps: has joined #RubyOnRails
[13:34:20] shock_one: has joined #RubyOnRails
[13:35:07] deecross: has joined #RubyOnRails
[13:35:07] sergio_101: has joined #RubyOnRails
[13:36:44] solars: anyone using reek/rubycritic?
[13:36:58] sk0r: has joined #RubyOnRails
[13:37:01] jahbrewski: has joined #RubyOnRails
[13:37:38] deecross: has joined #RubyOnRails
[13:39:43] antgel: has joined #RubyOnRails
[13:40:52] naftilos76: Can a specific stylesheet be reloaded before rendering a template view after an ajax request?
[13:45:48] harfangk: has joined #RubyOnRails
[13:48:36] chipotle: has joined #RubyOnRails
[13:48:50] flashpoint9: has joined #RubyOnRails
[13:50:48] allcentury: has joined #RubyOnRails
[13:53:05] kriptonium: has joined #RubyOnRails
[13:54:29] Rodya_: has joined #RubyOnRails
[13:55:41] antgel: has joined #RubyOnRails
[13:58:05] machinewar: has joined #RubyOnRails
[13:58:55] nettoweb: has joined #RubyOnRails
[13:58:57] machinewar: I know Rails caches queries for single requests, but will it cache first parts of queries that are then built on...... user.friends and then user.friends.some_other_query
[13:59:04] machinewar: will that execute user.friends twice
[14:00:00] Scient: yes it will, because its two separate queries
[14:00:55] chipotle: has joined #RubyOnRails
[14:01:36] finnnnnnnnnnn: has joined #RubyOnRails
[14:01:37] machinewar: Scient: okay thanks! and getting a bit more specific, (might be too specific), but what about using pagination with kaminari.... user.friends.page(1) and then user.friends.page(1).num_pages
[14:02:40] machinewar: Scient: or do you know if theres method to check if a query is being read from cache v. going to the db
[14:03:57] herbst: has joined #RubyOnRails
[14:04:31] matthewd: Doesn't the log tell you that?
[14:05:57] chouhoulis: has joined #RubyOnRails
[14:06:27] SteenJobs: has joined #RubyOnRails
[14:08:36] machinewar: matthewd: not sure, possibly
[14:09:50] tweeeaks: it should :)
[14:10:44] zacts: has joined #RubyOnRails
[14:11:36] matthewd: Yeah, if the *query cache* kicks in, the log should mention "CACHE" next to the query it's [not] running
[14:11:58] matthewd: If it's just a loaded relation, then there simply won't be a query to run
[14:12:20] matthewd: machinewar: So I think the answer to your question is to just read the logs, and they should tell you what's happening
[14:12:30] Xentil: has joined #RubyOnRails
[14:13:48] hahuang61: has joined #RubyOnRails
[14:13:50] machinewar: matthewd: correct, thanks!
[14:14:36] matthewd: machinewar: The higher-level answer is: where possible, we avoid doing needless queries... but sometimes you as a developer can know things about your DB structure (or what'll happen 3 lines later in your code) that a generic ORM method cannot, so it can be possible for a rearrangement to reduce the total work, by encoding some of that extra knowledge
[14:15:28] SteenJobs: has joined #RubyOnRails
[14:17:10] flashpoint9: has joined #RubyOnRails
[14:17:13] Xentil2: has joined #RubyOnRails
[14:17:56] VeryBewitching: has joined #RubyOnRails
[14:18:20] flashpoi_: has joined #RubyOnRails
[14:18:38] King_Rex: has joined #RubyOnRails
[14:18:51] kriptonium: has joined #RubyOnRails
[14:20:57] emachnic: has joined #RubyOnRails
[14:22:40] Oliphaunte: has joined #RubyOnRails
[14:24:46] artto: has joined #RubyOnRails
[14:24:54] Xentil: has joined #RubyOnRails
[14:26:53] artto_: has joined #RubyOnRails
[14:27:00] ngw: has joined #RubyOnRails
[14:28:53] deecross: has joined #RubyOnRails
[14:30:45] agent_white: has joined #RubyOnRails
[14:34:27] artto: has joined #RubyOnRails
[14:34:56] emachnic: has joined #RubyOnRails
[14:36:41] prithaj: has joined #RubyOnRails
[14:37:09] rafaelfranca: has joined #RubyOnRails
[14:37:09] rafaelfranca: has joined #RubyOnRails
[14:37:14] Macaveli_: has joined #RubyOnRails
[14:39:07] benlieb: has joined #RubyOnRails
[14:40:35] mostlybadfly: has joined #RubyOnRails
[14:41:04] diegoviola: has joined #RubyOnRails
[14:42:04] GorillaApe: is there a way to write it more compact?
[14:42:05] GorillaApe: method.eql?(@order.payments.last.try(:payment_method).nil? ? @order.available_payment_methods.first : @order.payments.last.payment_method) %>
[14:43:11] naftilos76: has joined #RubyOnRails
[14:43:17] tjbiddle: has joined #RubyOnRails
[14:43:39] matthewd: GorillaApe: Why #eql? ?
[14:44:06] sypheren: has joined #RubyOnRails
[14:44:29] matthewd: Most direct simplification: method == (@order.payments.last.try(:payment_method) || @order.available_payment_methods.first)
[14:44:37] tjbiddle: Hey everyone!
[14:44:38] dminuoso: has joined #RubyOnRails
[14:44:58] matthewd: You should be using #== unless you have a pretty specific reason to use #eql?
[14:45:15] matthewd: Better: method == @order.last_payment_method (and then define that method)
[14:45:35] tjbiddle: Can someone please help me with what I’m doing wrong here? I keep getting a “ActionController::RoutingError (uninitialized constant Api::Account)” error once I start running in production and I have no idea why. I don’t see what I’m doing differently from what’s offered in SO as a solution: https://gist.github.com/thomasbiddle/675296c8270a4ecc8a2971a4c0add17a
[14:45:40] matthewd: Oh, is this in a view? Feels way too much like business logic to be there.
[14:47:59] tjbiddle: Added a comment with the output of rake routes
[14:48:45] nk121: has joined #RubyOnRails
[14:49:03] matthewd: tjbiddle: Backtrace?
[14:49:33] tjbiddle: matthewd: Refresh for new comment
[14:50:19] artto: has joined #RubyOnRails
[14:50:39] benlieb: One of my customers just complained of not being able to add something to our cart. I looked and found an InvalidAuthenticityToken euror in the logs. Then I searched and found 20 other InvalidAuthenticityToken errors on cart adds in the last 7 years of logs. Infrequent but still an obvious problem. I just am not sure what the problem is. What might cause an InvalidAuthenticityToken error?
[14:50:49] banisterfiend: has joined #RubyOnRails
[14:51:09] benlieb: Shouldn't it only be if I change the secret key?
[14:51:51] tjbiddle: benlieb: Hm, yeah - I thought. I wonder if submitting a form while your mid-deploy would cause an issue?
[14:52:02] shock_one: has joined #RubyOnRails
[14:52:26] tjbiddle: Also, good on you for keeping 7 years of logs ha
[14:53:19] benlieb: tjbiddle: yeah, right?
[14:54:11] benlieb: Well this last one happened just after a deploy. But the next most recent one was 16 days ago and I hadn't deployed for several months.
[14:54:26] matthewd: tjbiddle: Half-considered thought... does `Rails.application.config.enable_dependency_loading = true` help?
[14:56:08] matthewd: benlieb: I don't really know that code.. I think the token gets stored in the session
[14:56:22] GorillaApe: @matthewd initially it was == but it returned error
[14:56:46] andywww: has joined #RubyOnRails
[14:56:47] tjbiddle: matthewd: Doesn’t help - but throws a different errors. Says that it’s expecting the controller to define the exact class it *is* defining. Will paste to comment - sec
[14:57:01] flashpoint9: has joined #RubyOnRails
[14:57:26] matthewd: benlieb: So, the token falling out of the session somehow (many other requests [from that client/browser] between opening the form and submitting it, e.g. in a different tab?), or a repeat form submission -- once the token's used, it's used (submit, back, submit again?)
[14:57:46] tjbiddle: matthewd: Comment posted
[14:58:07] upsell5: has joined #RubyOnRails
[14:58:26] andywww: has left #RubyOnRails: ()
[14:58:37] eljimmy: has joined #RubyOnRails
[14:58:40] matthewd: GorillaApe: What is the class we're comparing? Does #eql? actually do what you want?
[14:59:10] GorillaApe: class is payment method
[14:59:33] matthewd: GorillaApe: Is that an AR model?
[14:59:51] dminuoso: GorillaApe: So Ruby has ==, ===, eql? and equal? -- they all have different semantics. If you use something other than == then you need to be sure what you are using.
[15:00:09] matthewd: GorillaApe: What was the error, then? AR::Base#== is certainly supposed to work :/
[15:00:10] GorillaApe: method == (@order.payments.last.try(:payment_method) || @order.available_payment_methods.first) %> worked now though
[15:00:31] GorillaApe: but from byebug it doesnt work
[15:00:42] matthewd: Oh, so the error was something else?
[15:00:53] matthewd: Well it's not going to work if you keep the %> floating around
[15:01:19] GorillaApe: (byebug) method == (@order.payments.last.try(:payment_method) || @order.available_payment_methods.first)
[15:01:20] GorillaApe: *** SyntaxError Exception: (byebug):1: syntax error, unexpected ==
[15:01:29] shock_one: has joined #RubyOnRails
[15:01:35] matthewd: tjbiddle: Okay, ditch that config as it didn't really help... does module Api; module Account; class CompanyController < .. do any better?
[15:01:38] GorillaApe: it works but not with byebug somehow
[15:02:03] matthewd: GorillaApe: Oh... maybe `method` is a byebug command or something?
[15:02:19] GorillaApe: it could be that
[15:02:21] blackmesa: has joined #RubyOnRails
[15:02:37] matthewd: Yeah, it's in the help list
[15:02:55] tjbiddle: matthewd: What the hell!
[15:02:59] tjbiddle: (Yes it worked)
[15:03:03] tjbiddle: Whyyyy is that any different?
[15:03:04] benlieb: matthewd: could you describe what you mean by "token falling out of the session"?
[15:03:17] tjbiddle: I have *all* of my other controllers following the other syntax - and they work fine
[15:03:26] tjbiddle: ACTION throws a fit
[15:03:36] matthewd: tjbiddle: It's definitely different for ruby
[15:03:36] tjbiddle: (Also - thank you)
[15:03:41] tjbiddle: That’s so weird
[15:03:52] tjbiddle: Seriously though - I have like 40 other controllers, all the same setup
[15:03:55] tjbiddle: This was the only one not working
[15:04:01] zacts: has joined #RubyOnRails
[15:04:04] tjbiddle: Well two - the account folder
[15:04:10] tjbiddle: company and billing
[15:04:14] matthewd: ... but normally Rails does magic to autodefine intermediate namespaces when it enters a subdir like this
[15:04:38] tjbiddle: Huh. Well okay. At least it makes me feel better it wasn’t something obvious
[15:04:38] matthewd: (thus my thought that that config setting could be involved)
[15:04:46] benlieb: It seems like if a user logs in in one tab, then opens another tab, logs out, then logs back in, then goes to the first tab and submits the form, that would probably create a InvalidAuthenticityToken error, right?
[15:04:53] tjbiddle: Thanks very much
[15:04:58] tjbiddle: Was pulling hair out over this
[15:05:03] matthewd: e.g., consider `class A::B; end` in irb -- ruby has no hint whether A is a class or a module
[15:05:15] GorillaApe: @matthewd with that it works. i dont know whether there is another way to escape it
[15:05:16] GorillaApe: begin method == (@order.payments.last.try(:payment_method) || @order.available_payment_methods.first) end
[15:05:55] matthewd: tjbiddle: Definitely seems like a bug somewhere... what you had is *supposed* to work
[15:06:00] chipotle: has joined #RubyOnRails
[15:07:39] matthewd: benlieb: Right.
[15:07:44] chipotle: has joined #RubyOnRails
[15:08:24] matthewd: benlieb: Other than something that well-defined (an actual clearing of the session), I'm not sure whether the token can more generally decide to disappear
[15:09:11] aegis3121: has joined #RubyOnRails
[15:09:19] one_zero: has joined #RubyOnRails
[15:09:34] matthewd: benlieb: That's just a vague, haven't-read-the-code, thought of maybe there's a limit to how many tokens we keep... such a limit would seem sensible
[15:09:55] xcesariox: has joined #RubyOnRails
[15:10:03] pawnbox: has joined #RubyOnRails
[15:10:25] banisterfiend: has joined #RubyOnRails
[15:10:26] harfangk: has joined #RubyOnRails
[15:10:30] benlieb: matthewd: I don't think there is, I think it's just basically "authenticating" the form token with the session token and the app secret.
[15:10:35] matthewd: GorillaApe: Parentheses would work too, I expect. No real difference, but maybe slightly easier to type.
[15:11:08] GorillaApe: i tried but it didnt
[15:11:46] matthewd: Ah, byebug must still try to parse that
[15:11:58] matthewd: `_ = method == ...` ? :)
[15:12:08] disgrntld: has joined #RubyOnRails
[15:13:22] zacts|pi: has joined #RubyOnRails
[15:14:33] JakFrist: has joined #RubyOnRails
[15:15:27] emachnic_: has joined #RubyOnRails
[15:16:03] matthewd: benlieb: Ah, right. The literal string in the form changes on every request, but the server-side secret is per-session.
[15:16:44] matthewd: benlieb: Does your log have enough detail that you can see the submitted authenticity token?
[15:16:56] matthewd: e.g., that it's there, and is the right length
[15:17:15] benlieb: matthewd: hm. I think the app secret stays with the app. Each session gets a token that stays with the session, and every form gets a unique auth token. That's my current understanding. Could be wrong
[15:19:03] benlieb: I told the customer to log out and back in, and that fixed the issue, so I think it was probably just stale form tokens. Hard to fix that on my end. But I can see that my code doesn't fail gracefully in this case. There is no clean UI informing the user of the failure.
[15:19:23] benlieb: Just a disabled form and nothing added to the cart.
[15:19:49] tvw: has joined #RubyOnRails
[15:20:15] benlieb: Just looking through the JS now, and it looks like I tried at least to handle the case, but hm...
[15:20:28] matthewd: benlieb: Is that a no on logged parameters?
[15:20:46] benlieb: matthewd: hm, lemme look
[15:21:34] zacts: has joined #RubyOnRails
[15:22:03] benlieb: matthewd: yep got it
[15:22:29] zacts|pi: has joined #RubyOnRails
[15:22:44] benlieb: oddly the log also records the user in question.
[15:23:29] matthewd: benlieb: Interesting. You should then be able to find a previous form submission from the same session, and see whether the tokens match
[15:23:34] benlieb: Wait I guess that would work if they logged back in..
[15:23:55] benlieb: matthewd: no the form token is different on every form
[15:23:59] benlieb: every time
[15:24:01] matthewd: https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/request_forgery_protection.rb#L343-L349
[15:24:49] matthewd: It's encoded differently, to protect against BREACH... but the output of that function should match for all of them (for a given session)
[15:25:35] pawnbox: has joined #RubyOnRails
[15:27:48] antgel: has joined #RubyOnRails
[15:29:14] kitsuneyo: has joined #RubyOnRails
[15:29:36] blackmesa: has joined #RubyOnRails
[15:29:38] roshanavnad_: has joined #RubyOnRails
[15:30:53] AndrewIsHere: has joined #RubyOnRails
[15:33:17] cschneid_: has joined #RubyOnRails
[15:33:42] kitsuneyo: i read that Image is a problematic class name because of image_path helper (http://reservedwords.herokuapp.com/words/image?q[word_or_notes_cont]=image)
[15:33:57] kitsuneyo: what do people use instead of image? i don't like picture or photo much
[15:35:03] The_Phoenix: has joined #RubyOnRails
[15:35:07] kitsuneyo: i guess img could work, but i don't know what the plural would be (imgs)
[15:37:05] banisterfiend: has joined #RubyOnRails
[15:38:12] ecnalyr: has joined #RubyOnRails
[15:39:09] Xentil: has joined #RubyOnRails
[15:39:22] nk121: has joined #RubyOnRails
[15:46:46] wldcordeiro: has joined #RubyOnRails
[15:48:24] adavia: has joined #RubyOnRails
[15:54:05] tjbiddle: Any devise users here? Can’t figure out why my after_sign_out_path_for(x) is being ignored. My sign_in works fine.
[15:54:09] tjbiddle: https://gist.github.com/thomasbiddle/b2b30b92874694d56cf8e773c7b1701b
[15:54:18] shock_one: has joined #RubyOnRails
[15:54:58] kitsuneyo: i use device
[15:55:09] kitsuneyo: i mean devise
[15:55:36] snowy: has joined #RubyOnRails
[15:55:48] deecross_: has joined #RubyOnRails
[15:57:25] kitsuneyo: i don't use after_sign_out_path_for though
[15:57:36] Xentil: has joined #RubyOnRails
[15:58:47] tego101: has joined #RubyOnRails
[15:58:59] darutoko: has joined #RubyOnRails
[15:59:34] AmiMoench: has joined #RubyOnRails
[16:00:13] ecnalyr: has joined #RubyOnRails
[16:01:26] tweeeaks: tjbiddle: any reason that that leading _ woudl affect anything? _resource_or_scope
[16:01:26] utal: has joined #RubyOnRails
[16:02:41] arup_r: has joined #RubyOnRails
[16:02:50] tjbiddle: tweeeaks: No effect
[16:04:00] utal: has joined #RubyOnRails
[16:04:10] dgynn: has joined #RubyOnRails
[16:04:11] arup_r: Hi, I am writing some cookie based solution. I have opened 2 different browsers in my machine, I am creating the announcement in 1 browser, and seeing cookie stored in the browser. But in the other browser, I don't see the cookie. Any idea why? https://gist.github.com/aruprakshit/fe1d28964367dabe3f398de28dbda264
[16:04:48] ekinmur: has joined #RubyOnRails
[16:05:25] fryguy: cookies are browser specific
[16:05:31] utal: has joined #RubyOnRails
[16:07:10] flashpoint9: has joined #RubyOnRails
[16:07:32] oystersauce8: has joined #RubyOnRails
[16:08:42] SteenJobs: anyone know how to include an image inside an email template that works with gmail?
[16:08:51] deecross: has joined #RubyOnRails
[16:08:58] SteenJobs: gmail is attaching some proxy to the url and it’s preventing the file from rendering
[16:09:00] [Butch]: has joined #RubyOnRails
[16:09:02] SteenJobs: (it’s hosted on aws)
[16:09:17] arup_r: fryguy: makes sense. I forgot that for a while
[16:10:07] Guest23954: has joined #RubyOnRails
[16:10:15] The_Phoenix1: has joined #RubyOnRails
[16:11:27] utal: has joined #RubyOnRails
[16:11:50] ekinmur: has joined #RubyOnRails
[16:12:14] akira616: has joined #RubyOnRails
[16:12:24] tego101: has joined #RubyOnRails
[16:13:03] pawnbox: has joined #RubyOnRails
[16:13:29] The_Phoenix: has joined #RubyOnRails
[16:14:18] whathappens: has joined #RubyOnRails
[16:14:32] hahuang61: has joined #RubyOnRails
[16:14:46] Xentil: has joined #RubyOnRails
[16:15:29] zacts: has joined #RubyOnRails
[16:16:13] tweeeaks: tjbiddle: are you overriding the sessions controller? if so check there
[16:16:38] roamingdog: has joined #RubyOnRails
[16:16:55] The_Phoenix1: has joined #RubyOnRails
[16:17:03] alfiemax: has joined #RubyOnRails
[16:17:53] eserror: has joined #RubyOnRails
[16:18:12] chipotle: has joined #RubyOnRails
[16:19:16] manfrin_: has joined #RubyOnRails
[16:20:20] pur3eval: has joined #RubyOnRails
[16:22:34] nettoweb: has joined #RubyOnRails
[16:27:11] Xentil: has joined #RubyOnRails
[16:27:53] Sashimi: has joined #RubyOnRails
[16:30:22] AndrewIsHere: has joined #RubyOnRails
[16:31:23] shinnya: has joined #RubyOnRails
[16:34:43] VeryBewitching: Dragonfly question: If I have a dragonfly_accessor :image, and I want to assign the image from a String, how do I get the validator to deal with the mime type? I'm doing model.image = b64string; model.image.name = 'filename.png'; but the validator, when it runs, doesn't allow it because the mime_type isn't present.
[16:34:48] tego101: has joined #RubyOnRails
[16:35:33] VeryBewitching: Would I have to construct a Rack::Test::UploadedFile?
[16:35:52] tjbiddle: tweeeaks: Nope =\ Already checked for that.
[16:36:26] VeryBewitching: Or Rack::Multipart::UploadedFile rather?
[16:37:06] dionysus69: has joined #RubyOnRails
[16:37:49] JakFrist: has joined #RubyOnRails
[16:39:34] tweeeaks: tjbiddle: logs show any hints?
[16:39:40] pawnbox: has joined #RubyOnRails
[16:40:28] tjbiddle: tweeeaks: Nope - just hits the sessions controller (Devise’s - not implementing my own) and goes to the root path. Tried some debugging messages which were never hit.
[16:41:55] dtzuzu: has joined #RubyOnRails
[16:42:56] matthewd: tjbiddle: That's normally about where I'll just open the gem's code and add debugging in there
[16:43:23] rafaelfranca: has joined #RubyOnRails
[16:43:24] matthewd: First to confirm the original method is getting called, then to work out why it's skipping the overridden one
[16:44:35] ecnalyr: has joined #RubyOnRails
[16:44:51] Xentil: has joined #RubyOnRails
[16:47:10] whathappens: has joined #RubyOnRails
[16:51:22] Xentil: has joined #RubyOnRails
[16:54:16] pawnbox_: has joined #RubyOnRails
[16:55:23] ebbflowgo: has joined #RubyOnRails
[16:56:57] utal: has joined #RubyOnRails
[16:57:52] zacts: has joined #RubyOnRails
[16:58:14] utal: has joined #RubyOnRails
[17:01:33] Xentil: has joined #RubyOnRails
[17:02:32] Hyuk: has joined #RubyOnRails
[17:02:53] whathappens: has joined #RubyOnRails
[17:02:54] rafaelfranca: has joined #RubyOnRails
[17:02:56] adre: has joined #RubyOnRails
[17:03:31] whathapp_: has joined #RubyOnRails
[17:05:20] davidklsn: has joined #RubyOnRails
[17:05:39] Sashimi: has joined #RubyOnRails
[17:06:46] aegis3121: has joined #RubyOnRails
[17:11:04] bonswouar: has joined #RubyOnRails
[17:11:06] blackmesa: has joined #RubyOnRails
[17:12:22] tego101: has joined #RubyOnRails
[17:13:21] daumie: has joined #RubyOnRails
[17:15:46] orolo: has joined #RubyOnRails
[17:16:44] chipotle: has joined #RubyOnRails
[17:22:41] flashpoint9: has joined #RubyOnRails
[17:26:11] BhavyaM: has joined #RubyOnRails
[17:26:26] Sashimi: has joined #RubyOnRails
[17:27:37] deecross: has joined #RubyOnRails
[17:29:26] [Butch]: Silly question: Is there a way to interact with the router? For instance, what if I had a URI and I wanted to ask the router where it would send it (HTTP_VERB controller#action, or something similar)?
[17:30:25] AntiSpamMeta: has joined #RubyOnRails
[17:30:37] JakFrist: has joined #RubyOnRails
[17:31:50] pur3eval: has joined #RubyOnRails
[17:32:52] polishdub: has joined #RubyOnRails
[17:32:57] tjbiddle: Hey all - anyone here built commercial SaaS applications? Checking licenses on my gems and realized puma and a few others are BSD-3-Clause. Not familiar enough with this - do I need to add a credit to this?
[17:33:12] Sashimi: has joined #RubyOnRails
[17:33:13] Ayey_: has joined #RubyOnRails
[17:33:15] tjbiddle: MIT is pretty much do-whatever from what I understand
[17:33:49] Wildfyr: has joined #RubyOnRails
[17:34:09] VeryBewitching: has joined #RubyOnRails
[17:34:20] cschneid_: 1. if it's a business, talk with a lawyer. 2. (I'm not a lawyer) -- most licenses, except notably AGPL only apply when sharing your code or a built binary. Merely running it doesn't invoke sharing clauses
[17:35:01] cschneid_: Having an acknowledgement page would be good though. BSD asks for attribution, just give it. No harm to have "built-with" in your about page
[17:36:09] cschneid_: note that BSD3 explicitly says "redistribution in binary" and "redistrubtion in source". You are doing neither when running a hosted app. Also, I'm still not a lawyer.
[17:36:46] null__: I just moved this app to a new server and one of the image assets isn't loading. all the other assets seem fine, but the png image is not. this is strange
[17:37:01] null__: I clobbered and regenerated them just in case.. but it's still the same
[17:39:22] artto: has joined #RubyOnRails
[17:42:01] null__: actually all image assets are broken -- css assets are fine
[17:42:51] null__: this is probably an httpd issue
[17:43:10] cschneid_: yeah, I'd start by looking at what nginx (or apache) logs say
[17:43:30] cschneid_: in prod, it's unlikely that rails is serving the asset itself. It's a mismatch in permissions, or name, or something
[17:44:00] null__: well it's just throwing a 404 and I'm not logging 404s for most assets
[17:44:24] cschneid_: nginx's error.log for us catches that if I remember right
[17:44:54] null__: everything looked fine when I edited my /etc/hosts to test the switch before it happened
[17:46:56] tfitts: is there a way to get an array of routes or controllers within a controller
[17:47:21] null__: yeah it's not a rails issue. thanks for the assistance, though. they're working on http:// but not https://.
[17:47:51] pur3eval: has joined #RubyOnRails
[17:49:04] Oliphaunte: has joined #RubyOnRails
[17:51:40] eserror: has joined #RubyOnRails
[17:53:44] AndrewIsHere: has joined #RubyOnRails
[17:53:51] mloy: has joined #RubyOnRails
[17:54:12] AndrewIs_: has joined #RubyOnRails
[17:55:00] deecross: has joined #RubyOnRails
[17:56:01] fredolinhares: has joined #RubyOnRails
[17:57:55] blackmesa: has joined #RubyOnRails
[17:58:39] Haaibo: has joined #RubyOnRails
[18:00:23] Sashimi: has joined #RubyOnRails
[18:00:53] SteenJobs: has joined #RubyOnRails
[18:01:00] flashpoint9: has joined #RubyOnRails
[18:02:34] roamingdog: has joined #RubyOnRails
[18:03:15] roamingdog: has joined #RubyOnRails
[18:06:21] dionysus69: has joined #RubyOnRails
[18:06:30] rafaelfranca: has joined #RubyOnRails
[18:06:48] utal: has joined #RubyOnRails
[18:08:19] emachnic: has joined #RubyOnRails
[18:08:29] Uranio: has joined #RubyOnRails
[18:09:04] rogue_koder: has joined #RubyOnRails
[18:13:31] sneakers: has joined #RubyOnRails
[18:15:18] hahuang61: has joined #RubyOnRails
[18:17:02] amperry: has joined #RubyOnRails
[18:17:49] Scriptonaut: has joined #RubyOnRails
[18:18:07] Scriptonaut: can anyone link me to an example showing a migration adding an activerecord :time field?
[18:18:27] Scriptonaut: I want to store time (no day/month/year needed), so I'm wondering the best way to do this
[18:18:50] aegis3121: has joined #RubyOnRails
[18:18:51] Scriptonaut: also, I need to know things, like will it automatically convert my time to UTC?
[18:19:08] Scriptonaut: documentation and examples would help, thanks
[18:19:31] JakFrist: has joined #RubyOnRails
[18:19:40] matthewd: Scriptonaut: Timezones are one of the two main reasons (right along with their friend, DST) that the pure `time` DB type is rarely a good idea
[18:20:02] Scriptonaut: matthewd: what would you suggest, datetime?
[18:20:05] Scriptonaut: or typestamp?
[18:20:38] matthewd: If you really want it though, I'm not sure what would be unusual about it compared to any other type
[18:20:43] sebstrax: has joined #RubyOnRails
[18:21:09] Scriptonaut: I think it would make most sense to store times in UTC
[18:21:27] matthewd: Depending on your DB, datetime and timestamp can be similar or identical
[18:21:51] Scriptonaut: I'm using postgres
[18:22:04] matthewd: I'd need to know what you're actually storing to make a real suggestion
[18:22:05] Scriptonaut: do you know of any documentation or examples I could read?
[18:22:19] Scriptonaut: I'm having trouble finding them for some reason
[18:23:08] weaksauce: has joined #RubyOnRails
[18:23:12] wldcordeiro: has joined #RubyOnRails
[18:27:09] tjbiddle: has joined #RubyOnRails
[18:28:46] roamingd_: has joined #RubyOnRails
[18:28:51] Darmani: has joined #RubyOnRails
[18:29:06] macsteps: has joined #RubyOnRails
[18:33:18] jahbrews1i: has joined #RubyOnRails
[18:33:45] Coldblackice: has joined #RubyOnRails
[18:34:52] Dimik: has joined #RubyOnRails
[18:35:20] jenrzzz: has joined #RubyOnRails
[18:40:15] upsell5: has joined #RubyOnRails
[18:41:03] herpless: has joined #RubyOnRails
[18:41:48] artto: has joined #RubyOnRails
[18:43:15] AndrewIsHere: has joined #RubyOnRails
[18:43:25] amperry: If anyone is up for helping someone who's intermediate with web and db programming but new to Rails, I've got a question involving associations, join tables, and nested forms using the cocoon gem here: https://gist.github.com/amp108/506bfecddd9335faf0f19e95d618d037
[18:43:44] Oliphaunte: has joined #RubyOnRails
[18:45:18] amperry: Short summary on line 27, coincidentally also the line throwing the exception: "Cannot find the right mix of associations and arguments to
[18:45:18] amperry: `link_to_add_association` to get that helper to work."
[18:47:18] arBmind: has joined #RubyOnRails
[18:47:29] Ebok: has joined #RubyOnRails
[18:48:15] matthewd: amperry: Looks like you've bitten off rather a lot at once here
[18:48:47] matthewd: amperry: How much of this has been added since the last time you saw it working?
[18:49:23] petor: has joined #RubyOnRails
[18:50:03] utal: has joined #RubyOnRails
[18:50:04] yfeldblum: has joined #RubyOnRails
[18:50:29] amperry: matthewd: Yeah, that bitten off bit is true. The _form.html.erb code is more or less entirely new.
[18:51:25] amperry: If I comment out the 'link_to_add_association' line, it displays, although I think it has other issues preventing it from updating.
[18:51:39] matthewd: The `has_one` definitions in the model seem like they should be `belongs_to`, for a start
[18:52:17] andywww_: has joined #RubyOnRails
[18:53:46] diegoviola: has joined #RubyOnRails
[18:54:00] deecross: has joined #RubyOnRails
[18:54:32] zacts: has joined #RubyOnRails
[18:55:50] VeryBewitching: Anyone have experience with file uploads in JSON using Dragonfly/Trailblazer/Roar?
[18:55:53] amperry: matthewd: which model was this?
[18:56:09] sypheren: has joined #RubyOnRails
[18:56:51] matthewd: amperry: Rental
[18:57:36] Wildfyr: has left #RubyOnRails: ("Bye")
[18:57:57] douglascorrea: has joined #RubyOnRails
[19:00:37] ekinmur: has joined #RubyOnRails
[19:01:17] pawnbox: has joined #RubyOnRails
[19:01:29] Sashimi: has joined #RubyOnRails
[19:02:39] wldcordeiro: has joined #RubyOnRails
[19:05:00] peterppp: has joined #RubyOnRails
[19:05:42] amperry: matthewd: I think (although I could easily be very, very wrong about this) that the `belongs_to` association is better put in the Lease model, because the table Rental is wrapping (lease_residents) has a 1:1 association between each of Lease and Resident. But that also means that several of my other associations are wrong here, too.
[19:06:05] blackmesa: has joined #RubyOnRails
[19:06:21] matthewd: amperry: belongs_to is the opposite of has_one or has_many
[19:06:33] jstransky: has joined #RubyOnRails
[19:06:44] matthewd: (specifically, it goes on the side of the relationship that has the associated id column)
[19:06:52] peterppp: say I'm creating a website which is used by readers and journalists, they can access the same resources but the way they interact with them is very different. What's the canonic approach here? Do you have two sets of controllers?
[19:07:42] amperry: matthewd: right, so the Lease and the Resident would belong(s)_to Rental, if I hear you correctly.
[19:09:01] emachnic: has joined #RubyOnRails
[19:09:05] matthewd: That doesn't match the lease_residents table you showed
[19:09:42] jhack: has joined #RubyOnRails
[19:10:34] ur5us: has joined #RubyOnRails
[19:10:51] amperry: can something `belongs_to` more than one model?
[19:11:17] jstransky: has joined #RubyOnRails
[19:11:45] amperry: ah, so It'll probably need to belong to both, then, and they'll probably need a HABTM relationship with each other
[19:13:08] conta: has joined #RubyOnRails
[19:13:16] emachnic: has joined #RubyOnRails
[19:13:21] amperry: I'm basing this on an 18-year old VB app that's just a front-end to an Access database, one that's horribly de-normalized at that, so the fun never stops.
[19:13:29] emachnic: has joined #RubyOnRails
[19:14:46] emachnic: has joined #RubyOnRails
[19:16:36] amperry: matthewd: so far, success with putting HABTMs in resident.rb and lease.rb through lease_residents, and making Rental belongs_to them both. (At least, now the form displays... I'm sure there are other errors.) Thanks!
[19:17:45] pwnd_nsfw`: HABTM is for nerds
[19:18:11] Pazician: has joined #RubyOnRails
[19:20:18] amperry: matthewd: Yeah, back to problem of not being able to save when it updates, but I need to look at the actions in the controller and also, according to http://stackoverflow.com/questions/23598982/nested-form-cocoon-children-not-saving, look at how I'm splitting up my divs. But I'll hammer on that myself for a while. Thanks again.
[19:21:23] ecnalyr: has joined #RubyOnRails
[19:21:57] matthewd: No worries! If in doubt, start by proving that the model-level stuff does what you expect when invoked directly from `rails c`, before you mix in the form+controller parts
[19:28:22] rubyonrails293: has joined #RubyOnRails
[19:29:58] frem_: has joined #RubyOnRails
[19:32:57] amperry: matthewd: the only thing I'd expect of a model is that it has attributes matching the columns in the table, but I'm not very fluent with the ruby console.
[19:35:11] GodFather: has joined #RubyOnRails
[19:35:28] Dimik: has joined #RubyOnRails
[19:36:22] amperry: The wall of text I encountered the first time I tried 'obj.methods' in the console was an eye-opener :)
[19:36:53] jenrzzz: has joined #RubyOnRails
[19:36:53] jenrzzz: has joined #RubyOnRails
[19:37:48] Sashimi: has joined #RubyOnRails
[19:39:49] solars: has joined #RubyOnRails
[19:41:58] ecnalyr: has joined #RubyOnRails
[19:45:42] ekinmur: has joined #RubyOnRails
[19:51:55] bool_: has joined #RubyOnRails
[19:53:07] whathappens: has joined #RubyOnRails
[19:53:47] tvw: has joined #RubyOnRails
[19:55:51] ecnalyr: has joined #RubyOnRails
[19:57:45] [Nob]: has joined #RubyOnRails
[20:03:28] |RicharD|: has joined #RubyOnRails
[20:03:46] ekinmur: has joined #RubyOnRails
[20:04:36] akira616: has joined #RubyOnRails
[20:07:08] srinidhi: has joined #RubyOnRails
[20:07:52] blackmesa: has joined #RubyOnRails
[20:09:38] n1lo: has joined #RubyOnRails
[20:11:34] |RicharD|: guys I get an error when I enter rails c
[20:11:44] |RicharD|: how can I track from where the error is generated ?
[20:13:35] finnnnnnnnnnn: has joined #RubyOnRails
[20:16:03] hahuang61: has joined #RubyOnRails
[20:17:34] netzfisch: has joined #RubyOnRails
[20:19:43] douglascorrea: has joined #RubyOnRails
[20:19:49] eserror_: has joined #RubyOnRails
[20:21:33] workmad3: has joined #RubyOnRails
[20:22:34] pur3eval: has joined #RubyOnRails
[20:23:07] ur5us: has joined #RubyOnRails
[20:23:08] tjbiddle: has joined #RubyOnRails
[20:23:09] Scriptonaut: I added a column called: :send_time to one of my records. I took a model, and did: my_model.send_time = Time.now. Then, my_model.save. It saved fine, however it is saving the time like: 2016-07-08 20:21:13 +0000. I thought the activerecord :time data type was time only, without date or anything like that?
[20:23:32] Scriptonaut: the column is of the :time data type, not :datetime or :date, or :timestamp
[20:23:34] Scriptonaut: so this is odd to me
[20:23:43] Scriptonaut: is there some kind of rails/activerecord magic that I am unaware of?
[20:26:32] matthewd: Scriptonaut: There is no ruby time-only type, so I think AR might use Time, with the current date. Maybe?
[20:27:16] ensyde: has joined #RubyOnRails
[20:30:21] ekinmur: has joined #RubyOnRails
[20:30:43] Scriptonaut: matthewd: I thought activerecord :time used time only, no day/month/year/timzeone
[20:31:14] workmad3: Scriptonaut: there's no way to represent that in ruby... but you should check the database, as it should map to a 'time-only' type there
[20:31:57] Scriptonaut: oh weird, when I reload the object, it changes to: 2000-01-01 20:21:13 +0000
[20:31:58] triangles: has joined #RubyOnRails
[20:32:02] macsteps: has joined #RubyOnRails
[20:32:03] Scriptonaut: so, it must not be storing the year
[20:32:10] Jasaka: has joined #RubyOnRails
[20:32:18] Scriptonaut: it stores it in the object, but not the database
[20:32:31] douglascorrea: has joined #RubyOnRails
[20:33:02] workmad3: Scriptonaut: Time.now contains date and time info... and when you do `my_model.send_time = Time.now` it'll store that object in the attribute... and ActiveRecord won't bother reloading that from the database on a `.save`
[20:33:09] Sashimi: has joined #RubyOnRails
[20:33:14] workmad3: Scriptonaut: so until you reload, you'll be getting back the same object that you assigned
[20:33:39] matthewd: Ah, right, yeah. So, the DB has nowhere to store the date, but the ruby object has no choice but to have *some* date on it.
[20:34:12] Scriptonaut: is there a way to compare times in ruby, ignoring the date?
[20:34:26] matthewd: Force the date
[20:34:48] Scriptonaut: so, if I have 2000-01-01 20:21:13 +0000, and I want to check if it is past that time 3 days from now, can I do that?
[20:35:14] workmad3: Scriptonaut: so you want to check if it's later than 20:21:13 on the current day, yeah?
[20:36:14] matthewd: As I mentioned earlier, this is where timezones are going to make things.. complicated
[20:36:28] Scriptonaut: right now, we're locking users into the pacific timezone
[20:36:32] Scriptonaut: then we'll figure timezones out later
[20:36:45] workmad3: "we'll figure timezones out later" <-- famous last words
[20:36:53] Scriptonaut: wasn't my decision though
[20:36:54] matthewd: You're currently making a design decision that will make that much more difficult
[20:37:05] Scriptonaut: higher ups want this done before a deadline
[20:37:18] matthewd: And they've told you to use the DB 'time' type?
[20:37:32] Scriptonaut: me and the other devs told them that if we tailor each of these features to include timezones, it will take quite a bit longer
[20:37:38] Scriptonaut: matthewd: no, that was all me
[20:37:40] Scriptonaut: but I don't have to
[20:37:48] Scriptonaut: I just figured time was the best, since all I wanted was the time
[20:37:56] Scriptonaut: I could use datetime, but what difference will it make?
[20:38:05] Scriptonaut: I'm completely fine using datetime, if need be
[20:38:07] workmad3: Scriptonaut: I'd be tempted to store the exact time you intend to send something at...
[20:38:18] Scriptonaut: workmad3: that's what I want to do
[20:38:29] Scriptonaut: but the way they want it, they want to have a field: Days until due
[20:38:35] Scriptonaut: and then "Send Time"
[20:38:54] Scriptonaut: basically, this model is a template for automated email chains taht will be sent out
[20:38:59] workmad3: Scriptonaut: to me, 'exact time' == 'date and time it should be sent at'
[20:39:02] Scriptonaut: when one of these templates is applied, then the countdown begins
[20:39:05] workmad3: (sorry for needing to clarify)
[20:39:19] Scriptonaut: so, I can't store exact time in the model we're talking about
[20:39:27] Scriptonaut: because time doesn't start until the model is "applied"
[20:39:29] jhack: has joined #RubyOnRails
[20:39:33] djbkd: has joined #RubyOnRails
[20:39:45] Scriptonaut: once it's applied, it's x days at y time from that point taht it is sent
[20:39:46] workmad3: Scriptonaut: you can calculate that when the model is 'applied' for a specific send... it'll make your scheduling logic *much* easier
[20:39:58] aegis3121: has joined #RubyOnRails
[20:40:22] Scriptonaut: yes, that's what I want to do
[20:40:52] matthewd: Then you don't need to do any relative calculations with the disembodied time, and you're fine
[20:41:28] Scriptonaut: Maybe I'm not explaining it right, or understanding you correctly
[20:41:35] SteenJobs: has joined #RubyOnRails
[20:41:45] matthewd: You just set the target datetime to DateTime.current.at_midnight + days_in_future.days + (delivery_time - delivery_time.at_midnight)
[20:42:26] Scriptonaut: matthewd: that doesn't work, because that assumes that I'm sending the email days_in_the_future.days later
[20:42:35] matthewd: Then the only thing you're doing gt/lt comparisons on is an ordinary datetime, vs right now
[20:42:43] matthewd: > when one of these templates is applied, then the countdown begins
[20:43:14] Scriptonaut: Let's say I make an Action model, and I set days until send to 3 days, and send_time to 2:30pm
[20:43:17] SteenJobs: does anyone know how to get remote svg’s to display in an email template in gmail? apparently the image proxy caching causes issues
[20:43:24] Scriptonaut: then a week later, I apply the Action to a Person
[20:43:26] fructose: has joined #RubyOnRails
[20:43:31] fructose: Hi, I'm new to rails and am trying to go through "Getting Started", but running ... bin/rails generate controller Welcome index ... runs endlessly with no output. It worked at one point, but after running into other errors, I ended up starting over. Any ideas on what might be wrong?
[20:43:44] Scriptonaut: Then, I need to send the emails 3 days AFTER I apply the Action to that person, at 2:30pm on that day
[20:43:50] Scriptonaut: so 10 days after I create the Action in the first place
[20:44:43] shinnya: has joined #RubyOnRails
[20:45:00] matthewd: Yeah.. we're now talking about using the pure time on the Action, and doing the above calculation during the 'apply' step
[20:45:19] dc4: has joined #RubyOnRails
[20:45:27] Scriptonaut: oh, ok. So, why would using pure time cause issues doing that?
[20:45:47] matthewd: It won't, if you do it that way
[20:45:56] Scriptonaut: ok, do you recommend not using the pure time? I don't have to
[20:46:08] Scriptonaut: everyone in here was telling me not to use pure time about 5 minutes ago
[20:46:24] matthewd: It will, if you try to calculate "has this [calculated] point passed" dynamically, which is what you originally seemed to be describing
[20:47:12] matthewd: As long as you properly disembody it, and only use it as a convenient single column to hold 3 integers (h, m, s), then you're okay
[20:47:20] matthewd: Just don't treat it like an actual time
[20:48:20] matthewd: Oh, actually, that calculation isn't right either
[20:49:19] Scriptonaut: How do I determine the actual datetime that the message needs to be sent, during the apply process, given that I have a pure time denoting time of day to be send, and I have the number of days later that I need to send it
[20:49:55] ekinmur: has joined #RubyOnRails
[20:50:14] norfumpit: has joined #RubyOnRails
[20:50:51] pawnbox: has joined #RubyOnRails
[20:51:11] blackmesa: has joined #RubyOnRails
[20:51:13] Scriptonaut: I'm almost tempted to store it as a string
[20:52:02] matthewd: Time.current.advance(days: N).change(hour: pure.hour, min: pure.min, sec: pure.sec)
[20:52:05] The_Phoenix: has joined #RubyOnRails
[20:52:14] matthewd: I think that should get it right
[20:52:32] matthewd: Though you'll need to decide what N days means, relative to the current time
[20:53:02] Scriptonaut: matthewd: thanks, I think I'll stick with pure time for now, I'll talk to another dev before this makes it onto the master branch
[20:53:13] Scriptonaut: but ya, that will definitely work, thanks for getting me there
[20:53:27] matthewd: e.g., if your pure time is 6am, and it's currently 8pm, and N=1... is it tomorrow morning (10 hours from now), or the day after (at least 1 day from now)
[20:53:28] fructose: has joined #RubyOnRails
[20:54:14] matthewd: The important edge cases are the days around/on DST changes (which is where my previous +/- calculation went wrong)
[20:54:43] whathappens: has joined #RubyOnRails
[20:54:54] Scriptonaut: matthewd: I think it would go to 10 hours later in that case
[20:54:57] Scriptonaut: just 1 day on the calendar
[20:55:14] fructose: I'm new and trying: bin/rails generate controller Welcome index ... but it runs endlessly without output. It worked at one point, but I completely deleted the application and started again after other errors. How do I get to the bottom of this problem?
[20:55:15] norfumpit: has joined #RubyOnRails
[20:55:20] matthewd: Okay; that's what the above does.
[20:56:16] matthewd: fructose: !gist a session that starts with 'rails new', and ends where it gets stuck?
[20:56:16] helpa: fructose: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[20:56:30] meoblast001: has joined #RubyOnRails
[20:56:30] kevr: has joined #RubyOnRails
[20:57:02] shock_one: has joined #RubyOnRails
[20:57:43] fructose: matthewd: http://guides.rubyonrails.org/getting_started.html step 4.2
[20:57:51] pramsky: has joined #RubyOnRails
[20:59:35] Ebok: has joined #RubyOnRails
[21:02:20] ur5us: has joined #RubyOnRails
[21:06:57] jenrzzz: has joined #RubyOnRails
[21:07:05] ecnalyr: has joined #RubyOnRails
[21:10:10] diegoviola: has joined #RubyOnRails
[21:10:31] brianpWins: has joined #RubyOnRails
[21:11:50] arup_r: has joined #RubyOnRails
[21:18:41] SteenJobs: any of you use paperclip-av-transcoder gem before and know how to keep the aspect ratio when generating a thumbnail image from the uploaded video?
[21:20:58] Rodya_: has joined #RubyOnRails
[21:21:43] whathappens: has joined #RubyOnRails
[21:28:30] pawnbox: has joined #RubyOnRails
[21:28:47] macsteps: has joined #RubyOnRails
[21:33:33] petor: has joined #RubyOnRails
[21:34:24] Oliphaunte: has joined #RubyOnRails
[21:35:13] roamingdog: has joined #RubyOnRails
[21:37:46] Coldblackice: has joined #RubyOnRails
[21:37:53] Ebok: has joined #RubyOnRails
[21:38:01] arBmind1: has joined #RubyOnRails
[21:39:03] Rodya_: has joined #RubyOnRails
[21:39:28] jhack: In rails, t.decimal includes negatives as well right?
[21:42:12] rodfersou: has joined #RubyOnRails
[21:43:49] d5sx43: has joined #RubyOnRails
[21:45:31] roamingdog: has joined #RubyOnRails
[21:46:01] Darmani: Hey guys, I'm trying to add all the total from all the shirts into the cart view.
[21:46:10] Darmani: http://pastie.org/10902361#4
[21:46:10] banisterfiend: has joined #RubyOnRails
[21:46:18] Darmani: I'm probably not doing it right.
[21:46:47] hahuang61: has joined #RubyOnRails
[21:48:24] Darmani: Actually this might be a more detailed version
[21:48:25] Darmani: https://gist.github.com/mfifth/958a3ce6bd2ae94012bf9831faa8a177
[21:48:54] Ayey_: has joined #RubyOnRails
[21:50:00] Scriptonaut: has left #RubyOnRails: ()
[21:50:24] Darmani: The problem is that I have to multiply the price by the quantity if there's more than one shirt being ordered.
[21:50:30] Darmani: I'm not sure how to do that.
[21:52:01] jheathco1: has joined #RubyOnRails
[21:53:09] AmiMoench: has joined #RubyOnRails
[21:59:25] utal: has joined #RubyOnRails
[22:09:25] emachnic: has joined #RubyOnRails
[22:16:19] rafaelfranca: has joined #RubyOnRails
[22:16:19] rafaelfranca: has joined #RubyOnRails
[22:22:05] Polysics: has joined #RubyOnRails
[22:22:20] Polysics: hello! is there anyone using shoulda-matchers with Rails 5?
[22:22:34] Polysics: I think I must be missing something very obvious because the matchers are simply not being loaded
[22:22:46] jheathco: has joined #RubyOnRails
[22:24:36] rafaelfranca: has joined #RubyOnRails
[22:26:39] roamingdog: Darmani: isn't the quantity a matter of adding up how many of a certain variant there is in the order?
[22:27:03] cd-rum: has joined #RubyOnRails
[22:28:39] srgupta: has joined #RubyOnRails
[22:30:45] Z00t: has joined #RubyOnRails
[22:32:52] dc4: has joined #RubyOnRails
[22:34:10] ensyde: has joined #RubyOnRails
[22:41:07] ur5us: has joined #RubyOnRails
[22:42:18] ecnalyr: has joined #RubyOnRails
[22:43:11] roamingdog: has joined #RubyOnRails
[22:45:12] nettoweb: has joined #RubyOnRails
[22:47:00] rafaelfranca: has joined #RubyOnRails
[22:48:16] oystersauce8: has joined #RubyOnRails
[22:48:41] djbkd: has joined #RubyOnRails
[22:49:10] alfiemax: has joined #RubyOnRails
[22:51:25] Ayey_: has joined #RubyOnRails
[22:53:53] ma489: has joined #RubyOnRails
[22:54:36] Polysics: has something changed in the way Rails 5 autoloads modules or something?
[22:57:09] utal: has left #RubyOnRails: ("Am leaving")
[22:59:27] whathappens: has joined #RubyOnRails
[23:02:13] ma489: has left #RubyOnRails: ("Ex-Chat")
[23:03:59] pawnbox: has joined #RubyOnRails
[23:05:06] Darmani: roamingdog: nooooooooo
[23:05:13] Darmani: I was gone when you pinged me :[
[23:05:31] whathappens: has joined #RubyOnRails
[23:05:48] workmad3: has joined #RubyOnRails
[23:06:58] dalbuschat: has joined #RubyOnRails
[23:08:30] tjohnson: has joined #RubyOnRails
[23:19:01] utal: has joined #RubyOnRails
[23:21:55] jstransky: has joined #RubyOnRails
[23:24:34] gthank: has joined #RubyOnRails
[23:24:34] gthank: has joined #RubyOnRails
[23:28:10] clouder|grr: has joined #RubyOnRails
[23:29:03] ElFerna: has joined #RubyOnRails
[23:31:18] kevr: has joined #RubyOnRails
[23:33:02] Rodya_: has joined #RubyOnRails
[23:47:31] hahuang61: has joined #RubyOnRails
[23:49:24] ur5us: has joined #RubyOnRails
[23:50:08] Darmani: Guys if I have a online shirt website and I'm trying to get the total for a given order, how do I account for the price and the quantity?
[23:50:10] Darmani: https://gist.github.com/mfifth/958a3ce6bd2ae94012bf9831faa8a177
[23:50:58] Darmani: They are both columns within my variant class but I don't know how to add them all neatly.
[23:52:08] nickjj: Darmani, what's wrong with what you're doing?
[23:52:08] Ayey_: has joined #RubyOnRails
[23:52:23] akira616: has joined #RubyOnRails
[23:52:52] Darmani: nickjj: Well that's what I thought too but something is wrong because the math doesn't add up :[
[23:53:10] nickjj: Darmani, pretty sure you need to change line 10's right @total to be variant.price not @total
[23:53:26] nickjj: and make the total tally it all
[23:53:41] nickjj: so: @total += variant.quantity * variant.price
[23:54:05] roamingdog: has joined #RubyOnRails
[23:54:44] Darmani: nickjj: Well let's say I have 3 shirts, they are all priced at 24.99
[23:54:49] dr_summer: has joined #RubyOnRails
[23:54:51] nickjj: because that's what the total is right , it's an accumulation of each variant's quantity*price?
[23:55:22] Darmani: nickjj: yeah that's true but the math doesn't add up with that one either. I get 124.99
[23:55:35] nickjj: if you bought a red shirt for 25 and a blue shirt for 25 and a green shirt for 25 you would expect it to 75
[23:55:58] Darmani: nickjj: that's correct
[23:55:59] Darmani: https://gist.github.com/mfifth/958a3ce6bd2ae94012bf9831faa8a177#file-orders_controller-rb-L5
[23:56:10] nickjj: so you'd end up with total being 25*1 + 25*1 + 25*1
[23:56:17] nickjj: which is what i wrote before
[23:56:41] Darmani: Well what I have here is 25*2 + 25*1
[23:57:04] Darmani: Which you would think would come out to 75 but I get 124.99 for some reason...
[23:57:34] nickjj: look what you're doing on line 7
[23:57:56] nickjj: @total isn't starting at 0, it's going to be whatever @variants.sum(:price) returns
[23:58:09] Darmani: nickjj: :O
[23:58:12] Darmani: I forgot to change that.
[23:58:51] Darmani: nickjj: thanks man ^^
[23:58:54] Markhor1991: has joined #RubyOnRails
[23:58:54] nickjj: which makes sense if you have 2 variants , that would add 50 which is what 75+50 is
[23:59:31] Darmani: nickjj: yeah that makes sense.