« Back to channel list

#RubyOnRails - 07 April 2017

« Back 1 day Forward 1 day »
[00:01:10] marcdel: has joined #RubyOnRails
[00:01:21] gusrub: has joined #RubyOnRails
[00:02:10] uks: has joined #RubyOnRails
[00:05:01] Rodya_: has joined #RubyOnRails
[00:06:11] Radar: GOOD MORNING
[00:16:01] knight33: has joined #RubyOnRails
[00:16:07] fmcgeough: has joined #RubyOnRails
[00:18:42] alfie: has joined #RubyOnRails
[00:18:48] amperry: has joined #RubyOnRails
[00:21:10] amperry: hi folks, I'm trying to redirect to a page with a flash notice, but "redirect_to action: 'log_payment', notice: 'payment successfully recorded', status: 302" doesn't load up the flash[:notice] (which is what I thought 'notice:' was supposed to do, but I'm apparently wrong), and "redirect_to action: 'log_payment', flash[:notice] = 'payment successfully recorded', status: 302" gives me a syntax error. How do I do this?
[00:23:16] amperry: and 'flash[:notice] => "blah blah"' doesn't work, either.
[00:24:24] amperry: ah, splitting it out to two statements works, ne'ermind.
[00:30:31] Guest96: has joined #RubyOnRails
[00:34:39] Radar: amperry: no need for the status part of that. redirects are 302s by default
[00:35:38] amperry: Radar: I just read (somewhere) that they were 301, but I'll take your word over random web search result :)
[00:36:02] Radar: amperry: I'm fairly certain they're 302s but I'm willing to be proven wrong
[00:38:28] amperry: ah, this is for the 'redirect' helper in routes.
[00:38:30] quazimodo: has joined #RubyOnRails
[00:39:57] gusrub: has joined #RubyOnRails
[00:42:30] jgt1: has joined #RubyOnRails
[00:46:59] chouhoulis: has joined #RubyOnRails
[00:50:18] armyriad: has joined #RubyOnRails
[00:50:45] sypheren: has joined #RubyOnRails
[00:51:44] hipertracker: has left #RubyOnRails: ()
[00:51:55] Pumukel: has joined #RubyOnRails
[00:55:37] lethan: has joined #RubyOnRails
[00:56:59] sevenseacat: has joined #RubyOnRails
[01:05:46] juggler: has joined #RubyOnRails
[01:06:42] chouhoulis: has joined #RubyOnRails
[01:08:31] jusa: has joined #RubyOnRails
[01:18:10] alfie: has joined #RubyOnRails
[01:21:50] rogue_koder: has joined #RubyOnRails
[01:22:20] crystalneth: has joined #RubyOnRails
[01:23:33] markh: has joined #RubyOnRails
[01:33:48] gusrub: has joined #RubyOnRails
[01:42:28] knight33: has joined #RubyOnRails
[01:43:52] sunya7a: in my migration i have t.references :user, foreign_key: true. I want user_id to be unique. I tried adding unique: true to the end of that line but it does not create a unique index, and attempting to add a unique index fails saying there's already an index on user_id
[01:44:32] sunya7a: attempting to add a unique index *separately* in another migration fails...
[01:45:27] sunya7a: heya radar...it's always so weird to see your good mornings so late at night (for me)
[01:45:48] hndk: has joined #RubyOnRails
[01:46:50] MasterAsia: Does rails wipe the database between test runs?
[01:46:57] MasterAsia: Or do I explicitly need database_cleaner
[01:48:12] Radar: masterasia: yes it does by default
[01:48:21] sunya7a: masterasia: i think it recreates fixtures at least.
[01:48:49] MasterAsia: I'm getting a strange error where it isn't wiping it
[01:48:51] MasterAsia: trying to debug
[01:49:49] sevenseacat: by default tests run inside transactions, that get rolled back at the end of each test
[01:53:16] sunya7a: alright...so it seems it's a name collision. Since i used t.references :user, it created user_id column as foreign key with index...only it's not unique index and putting unique: true doesn't work. when I try to add the unique index separately i get the name collision. I want to customize name with name: 'my_unique_index' ... is there a common naming convention for this? naming things is hard =/
[01:53:27] Rodya_: has joined #RubyOnRails
[01:53:54] Pumukel: has joined #RubyOnRails
[01:53:56] sevenseacat: indexes can be named whatever you like.
[01:55:04] sunya7a: sevenseacat: i know...what's a common name...i don't see any of my other index named with unique...in the schema it's always a separate thing like name: "index_organizations_on_name", unique: true
[01:56:23] sunya7a: sevenseacat: unless there's a way to define unique true during table creation...i tried this and it doesn't add the uniquness: t.references :user, foreign_key: true, unique: true
[01:56:28] sunya7a: sevenseacat: is that line incorrect?
[01:58:02] MasterAsia: I figured out why my test db was inconsistent. I had dropped into a debugger session and ctrl+c out of it
[01:58:11] MasterAsia: therefore rails didnt get the chance to rollback
[02:01:10] xall: has joined #RubyOnRails
[02:03:42] Rodya_: has joined #RubyOnRails
[02:04:09] sevenseacat: attempting to test that line but the dummy app I created is hanging while trying to run rails commands... interesting
[02:04:14] universa1: has joined #RubyOnRails
[02:04:54] libastral: has joined #RubyOnRails
[02:05:45] sevenseacat: ah spring, I still hate you
[02:08:05] mr-spoon: has joined #RubyOnRails
[02:09:43] sevenseacat: sunya7a: I think you'll have to add the unique index yourself separately.
[02:10:39] sunya7a: sevenseacat: ;; not liking that...i did and looking at the schema file i ended up with 2 indices defined...
[02:11:09] jeyraof^mbpr: has joined #RubyOnRails
[02:11:36] sunya7a: sevenseacat: one defined automatically because using references put foreign_key on user_id...and then another index on the same column for the uniqueness...i presume this is an unneccessary performance hit
[02:11:59] tercenya: has joined #RubyOnRails
[02:12:01] sunya7a: sevenseacat: better to leave uniqueness constraint in the model? what do you think
[02:12:33] nahtnam: has joined #RubyOnRails
[02:12:41] sevenseacat: you can always drop the index auto-added by Rails and leave just your unique one
[02:13:07] sevenseacat: you're going to need the uniqueness constraint in the model anyway
[02:13:42] sunya7a: sevenseacat: oh dropping the rails generated one is a nice idea...didn't think of that...ty
[02:14:56] sevenseacat: unless things have changed recently in Rails, it won't gracefully handle any error raised by the db if the unique index constraint gets violated
[02:19:32] sunya7a: sevenseacat: hah....can't drop it...: needed in a foreign key constraint
[02:19:36] Jayson_Virissimo: has joined #RubyOnRails
[02:19:47] sevenseacat: eh? i did it in my test db
[02:20:06] sunya7a: sevenseacat: so drop fk constraint...drop index, make new one, and readd fk constraint?
[02:20:24] sevenseacat: nah, just dropped the index added by Rails
[02:21:03] Jameser: has joined #RubyOnRails
[02:21:08] sevenseacat: https://gist.github.com/sevenseacat/30e832d8db50212af26b476673578def
[02:21:13] sunya7a: sevenseacat: in your test app was it defined as a fk?
[02:22:52] sevenseacat: maybe it works a little differently at the db level if you're not using psql
[02:23:21] sunya7a: i think so...mysql might be stricter in this case
[02:23:34] sevenseacat: stricter isnt the word I'd use, but maybe
[02:23:54] sunya7a: it's ok...i think it's not worth the trouble. uniquness validation in model should be good...
[02:27:06] wethu: has joined #RubyOnRails
[02:28:05] rogue_koder: has joined #RubyOnRails
[02:30:16] spicerack: has joined #RubyOnRails
[02:30:40] gusrub: has joined #RubyOnRails
[02:30:47] Rodya_: has joined #RubyOnRails
[02:31:35] sunya7a: sevenseacat: =( did it anyway...i guess it's how i want it now...thanks for the help!
[02:36:58] naprimer: has joined #RubyOnRails
[02:42:30] Technodrome: is there any gems for filling your models with dummy data?
[02:43:23] mr-spoon: has joined #RubyOnRails
[02:43:35] sevenseacat: people typically use libraries like factory girl and faker for setting up dummy data
[02:46:10] itsautomatisch: has joined #RubyOnRails
[03:05:39] irishfromua: has joined #RubyOnRails
[03:06:24] mr-spoon: has joined #RubyOnRails
[03:07:12] naprimer: has joined #RubyOnRails
[03:10:43] xall: has joined #RubyOnRails
[03:11:32] irishfromua: has joined #RubyOnRails
[03:15:46] pickle_: has joined #RubyOnRails
[03:17:35] irishfromua: has joined #RubyOnRails
[03:20:39] pickle_: has joined #RubyOnRails
[03:24:00] spicerack: has joined #RubyOnRails
[03:34:13] xall: has joined #RubyOnRails
[03:35:05] pickle_: has joined #RubyOnRails
[03:35:58] pickle_: has joined #RubyOnRails
[03:39:40] arBmind1: has joined #RubyOnRails
[03:44:18] markh: has left #RubyOnRails: ("Leaving")
[03:57:53] Pumukel: has joined #RubyOnRails
[03:59:29] alexggordon: has joined #RubyOnRails
[04:01:02] gusrub: has joined #RubyOnRails
[04:12:30] duderonomy: has joined #RubyOnRails
[04:20:32] Rodya_: has joined #RubyOnRails
[04:24:49] irishfromua: has joined #RubyOnRails
[04:28:31] bawsky: has joined #RubyOnRails
[04:39:04] djbkd: has joined #RubyOnRails
[04:41:49] Guest96: has joined #RubyOnRails
[04:46:24] cschneid_: has joined #RubyOnRails
[04:50:12] knight33: has joined #RubyOnRails
[04:54:22] ovaltine: has joined #RubyOnRails
[04:55:22] jane_booty_doe: has joined #RubyOnRails
[04:58:37] xixi: has joined #RubyOnRails
[04:59:44] Pumukel: has joined #RubyOnRails
[05:00:43] alexggordon: has joined #RubyOnRails
[05:03:02] Pumukel: has joined #RubyOnRails
[05:04:59] Pumukel: has joined #RubyOnRails
[05:06:00] Pumukel: has joined #RubyOnRails
[05:06:12] Pumukel: has joined #RubyOnRails
[05:11:03] mrgreenfur: has joined #RubyOnRails
[05:18:00] psethi: has joined #RubyOnRails
[05:19:45] webdestroya: has joined #RubyOnRails
[05:20:20] nya: has joined #RubyOnRails
[05:21:27] Rodya_: has joined #RubyOnRails
[05:30:53] harfangk: has joined #RubyOnRails
[05:38:47] jaequery: has joined #RubyOnRails
[05:42:22] mrgreenfur: has joined #RubyOnRails
[05:43:08] jgt1: has joined #RubyOnRails
[05:51:23] alexggordon: has joined #RubyOnRails
[05:52:24] FastJack: has joined #RubyOnRails
[06:00:37] Rodya_: has joined #RubyOnRails
[06:09:58] pLaTo0n: has joined #RubyOnRails
[06:10:44] ReBa_: has joined #RubyOnRails
[06:13:01] mrgreenfur: has joined #RubyOnRails
[06:13:12] DoctorMonocular: has joined #RubyOnRails
[06:14:05] User458764: has joined #RubyOnRails
[06:20:20] nya: has joined #RubyOnRails
[06:22:58] harfangk: has joined #RubyOnRails
[06:26:53] dminuoso: Hiya Radar, are you around?
[06:28:16] AzaToth: has joined #RubyOnRails
[06:34:46] binarycodess: has joined #RubyOnRails
[06:36:57] darutoko: has joined #RubyOnRails
[06:39:32] binarycodess: has joined #RubyOnRails
[06:44:20] mrgreenfur: has joined #RubyOnRails
[06:45:39] kernelPaniq: has joined #RubyOnRails
[06:48:21] jusa: has joined #RubyOnRails
[06:51:28] sevenseacat: seems like a no
[06:59:21] dminuoso: I think his wife forces him to go to bed at adequate times, it is the only explanation I have.
[07:01:16] sevenseacat: its 5pm there, so i hope not.
[07:07:20] patarr: has joined #RubyOnRails
[07:08:44] brianpWins: has joined #RubyOnRails
[07:10:01] brianpWins: Is there a way to choose filterable paramaters in a PORO? I have a form object that deals with password, and if someone prints the object to the logger it’ll print with the plain text password. I’d like the PORO to know to filter that attribute. Much like the ActiveRecord log filter.
[07:13:16] ReBa_: I have a weird difference in getting a variable: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2
[07:13:46] ReBa_: If I do self.inspect, I get the correct hash for my columns variable. If I do self.columns.inspect, I get an array in stead of a hash
[07:14:09] ReBa_: Although it's exactly the same object
[07:15:57] sevenseacat: ReBa_: do you have a field on your model named columns?
[07:16:26] ReBa_: It stores the order of an excel template
[07:16:43] ReBa_: order of columns in an excel*
[07:17:48] sevenseacat: so what type of field is it?
[07:18:11] zero1one0: has joined #RubyOnRails
[07:19:05] ReBa_: I've updated the gist (https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2) - the :columns field is a text field that is hashed
[07:19:58] sevenseacat: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-inspections_export-rb-L45 ?
[07:21:57] Rodya_: has joined #RubyOnRails
[07:23:23] ReBa_: sevenseacat: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-export_template-rb it's a saveable template to reuse in future exports
[07:24:11] defsdoor: has joined #RubyOnRails
[07:26:49] sevenseacat: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-export_template-rb-L47-L51 looks like you're turning the hashes into arrays
[07:26:57] djbkd: has joined #RubyOnRails
[07:26:59] Radar: dminuoso: What's up?
[07:27:16] sevenseacat: ReBa_: this is some really gnarly code btw
[07:27:19] Radar: I was at work doing some pairing
[07:27:47] Radar: I hope you're paying sevenseacat to look through all that code.
[07:28:22] ReBa_: sevenseacat: Why is that?
[07:28:39] sevenseacat: ReBa_: why are you turning them into arrays or why is it gnarly?
[07:29:05] mark_66: has joined #RubyOnRails
[07:29:24] ReBa_: (I don't know what gnarly means) => I'm searching and I find "extreme", "groteque, yet awesome", ...
[07:29:44] ReBa_: They sometimes come in as an array and sometimes as a hash
[07:29:55] ReBa_: So I'm trying to be sure it's always the same type of information I get
[07:30:09] sevenseacat: its very complicated and confusing, with lots of unrelated resposibilities for activerecord models
[07:30:21] sevenseacat: right, so you're assigning them to be arrays, and then they're printing as arrays when you inspect them
[07:31:17] ReBa_: The outcome is a hash
[07:31:36] ReBa_: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-self-inspect-L19 Like you can see here
[07:32:14] sevenseacat: thats getting the raw value from the InspectionExport model, not the delegated value from the ExportTemplate model
[07:32:28] matthewd: brianpWins: You can override #inspect, but that's about it
[07:32:43] sevenseacat: you've overridden the getter for self.columns so it will do different things when you call it
[07:32:58] ReBa_: So in fact, it's better to start renaming it
[07:33:05] ReBa_: to for example: export_columns
[07:33:17] dminuoso: Radar: I was looking for your insights on how you tackled authn/authz in your react app.
[07:33:48] ReBa_: I'm trying to understand your remark "raw value - not delegated value"
[07:33:50] Radar: dminuoso: We only render react components on authn/authz views. Rails renders our components after it handles the auth.
[07:34:42] sevenseacat: ReBa_: when you inspect the object, you get it's attributes as stored on that model. when you call self.columns, it's no longer getting the attribute as stored on the Report, but it's calling the getter method which then calls the columns method on the template
[07:35:08] dminuoso: Radar: I see, so do you transport any role information into the react components?
[07:35:10] sevenseacat: which looks like an array, but I really cannot tell what the ExportTemplate.column_defaults method is going to return
[07:35:18] dminuoso: Radar: I mean it sounds like you dont have a real SPA running
[07:35:22] sevenseacat: or what its doing at all
[07:35:37] Radar: dminuoso: No role information is transported in the react components.
[07:36:00] Radar: dminuoso: It's very much not SPA-like at all :D
[07:36:23] Radar: dminuoso: I wouldn't consider this app "best practices" at all. It would be more akin to "hey look React is shiny let's bolt it onto this monolith"
[07:36:55] dminuoso: Radar: Heh. Yeah that's exactly how my initial approach went, but it was too tightly coupled with too many issues.
[07:37:08] Radar: dminuoso: We're looking at making a more clear distinction between backend + frontend over the next few months. Having the two so tightly coupled is leading to some problems.
[07:37:33] ReBa_: sevenseacat: In fact, it returns the hash (https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-export_template-rb-L27) or it gets params which have different :removed and :added columns
[07:37:55] ReBa_: It then checks if they should be included at all (if not in the original :added hash, it shouldn't be added at all)
[07:38:01] sevenseacat: thats not what it returns.
[07:38:07] sevenseacat: it does a lot of modifications to that data.
[07:38:24] dminuoso: Radar: The sad thing is, Im not sure I want to let go of these superfast to prototype simple_form CRUD management of data.
[07:39:08] Radar: dminuoso: yeah I understand that. We've talked about having multiple frontends to serve different parts of our application
[07:39:12] sevenseacat: ReBa_: I suspect that ExportTemplate record has a columns value of a hash with removed and added both being arrays.
[07:39:19] ReBa_: sevenseacat: I'm trying to follow, but as I'm getting sometimes a hash, sometimes an array, your remark will be correct
[07:39:25] sevenseacat: why that is so, is for you to work out.
[07:39:27] Radar: Possibly something like example.com/admin which routed to the rails app, and example.com which routed to the React app which then talked to APIs.
[07:39:39] ReBa_: sevenseacat: I understand what you're pointing out
[07:39:40] sevenseacat: but that explains why self.columns.inspect is printing out arrays.
[07:39:48] sevenseacat: because the ExportTemplate has arrays.
[07:39:58] ReBa_: and the InspectionsExport has a hash
[07:40:08] sevenseacat: that has is irrelevant when you call self.columns
[07:40:30] sevenseacat: because the columns method is calling columns on the template.
[07:40:32] ReBa_: but because it is linked to the export_template, it's returning a "wrong" value
[07:40:33] dminuoso: Radar: Yeah.. pretty much what I have been thinking about. The real PITA is that Im committed to ant.design react wise, so I would have to port the entire thing to rails generators.
[07:40:57] dminuoso: (I mean admittedly it's an awesome frontend specification)
[07:41:11] ReBa_: sevenseacat: Thank you for this damn interesting/helpfull insight
[07:41:26] dminuoso: Radar: Or I would have to live with the app following two completely separate design philosophies for different parts.
[07:41:27] ReBa_: sevenseacat: Would you rename the "columns" variable to export_columns?
[07:41:37] Radar: dminuoso: yup. Hard problems are hard :D
[07:41:40] ReBa_: For the sake of understandable code and avoiding conflicts
[07:41:41] sevenseacat: ReBa_: I don't know enough about what you're doing to say.
[07:42:16] dminuoso: Radar: But you know what, it makes me feel rather relaxed to see that you are experiencing all the same difficulties.
[07:42:31] ReBa_: The user can create a custom excel file with columns in a custom order. He can also delete some columns he doesn't like.
[07:43:06] sevenseacat: ReBa_: so why do you care about the original columns in the template when you call columns on a report?
[07:43:10] ReBa_: So that "columns" field saves the order of the columns, and only renders the :added items
[07:43:13] sevenseacat: given they've been modified
[07:43:59] ReBa_: sevenseacat: You mean this: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-export_template-rb-L27
[07:44:18] sevenseacat: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-inspections_export-rb-L43-L45
[07:44:51] ReBa_: Because they can change the order of an export_template
[07:45:14] ReBa_: And if an export template is used, future re-exports with the same filters will be used with the new columns order
[07:45:16] dminuoso: Radar: Are you using Turbolinks? I reckon you should be, otherwise the constant switching in and out of the react app ought to be painfully slow.
[07:45:25] Radar: dminuoso: No we're not using it. And yeah it is very slow :(
[07:45:41] ReBa_: A user can choose to save a template or not, that's why I have an columns field in my InspectionsExport
[07:45:49] sevenseacat: ReBa_: why does your record have both then? it has columns of its own, and it also has an export template
[07:45:49] dminuoso: Oh man, Radar. We are not the same person, are we?
[07:45:54] Radar: dminuoso: Good thinking that it might lead to some performance improvements. Might be worth looking into it.
[07:45:58] Radar: dminuoso: Not that I am aware of.
[07:46:21] Radar: I've had such bad experiences previously with turbolinks weirdness that I've sworn it off.
[07:46:30] sevenseacat: https://gist.github.com/RemiBa/c36996631769c9d90600fa3eb91499c2#file-self-inspect-L19-L36
[07:46:31] ReBa_: sevenseacat: Would you use nil if an export_template is used?
[07:46:39] Radar: But we've also got some performance issues with each page taking multiple seconds to load that maybe turbolinks _might_ be the answer?
[07:46:49] Radar: But then again, maybe not loading 200kb of JS might also be the answer? :D
[07:46:52] dminuoso: In particular introducing React lead to some really hairy problems. Im not sure whether they were easy to solve, but removing turbolinks entirely was easier.
[07:47:15] sevenseacat: I don't know where that column data came from, given you're not using it anywhere
[07:47:17] Radar: I think a better approach for us would be to split each page's JS / CSS up into different "components" that we can then load.
[07:47:28] sevenseacat: or why you're storing it
[07:47:30] dminuoso: Radar: Webpack supports chunking.. :-)
[07:47:36] Radar: Currently we load all the JS for all the reports in our app all at once. Pretty confident that parsing all that JS / CSS isn't instant.
[07:47:42] Radar: I'm not on the frontend team sooooo /shrug
[07:47:53] Radar: Oh hey look it's my stop on the train now. I'll be headed home now. ttyl :)
[07:47:56] ReBa_: Because it could be that a user doesn't link an export template
[07:48:09] sevenseacat: ReBa_: but that record does have a template.
[07:48:15] sevenseacat: so why does it also have column data?
[07:48:56] ReBa_: sevenseacat: Owkay, if I'm following correct, you would just leave the columns data nil if an export_template is linked
[07:49:12] ReBa_: And if there isn't any relation, fill in the columns data
[07:49:19] sevenseacat: that would make sense to me
[07:49:36] ReBa_: Owkay. I get your point
[07:49:57] ReBa_: And I will do it like you see it, because it's logical
[07:51:01] ReBa_: sevenseacat: Would you only make it nil on before_save?
[07:51:30] ReBa_: Now it's initialized in the "default_values" method
[07:52:10] ReBa_: Or don't you mean that I just shouldn't save it in the database
[07:58:25] DaniG2k: has joined #RubyOnRails
[07:58:55] arBmind: has joined #RubyOnRails
[07:59:44] blackmesa: has joined #RubyOnRails
[08:02:41] peterpp: has joined #RubyOnRails
[08:03:10] peterpp: Hi, does it make sense to use Rails for a web app with websockets?
[08:04:26] dminuoso: peterpp: Sure. Since Rails 5 we even a websockets implementation out of the box called ActionCable
[08:05:09] peterpp: oh, I saw that there's a gem but I had no idea Rails 5 supports it out of the box
[08:05:33] havenwood: peterpp: http://guides.rubyonrails.org/action_cable_overview.html
[08:07:23] dminuoso: This is what Ill be implementing next. Using ActionCable server side, and redux-saga client side to interact with those websockets. :-)
[08:10:05] jeyraof^mbpr: has joined #RubyOnRails
[08:14:22] dionysus69: has joined #RubyOnRails
[08:15:42] peterpp: I'm going to make this app for a client and they asked me to suggest a language/framework but they seem biased against rails because everybody's using node now
[08:16:39] peterpp: well, that's their perspective
[08:17:12] DaniG2k: I hope node perishes
[08:17:15] peterpp: they read stories about linkedin switching to nodejs etc.
[08:17:21] havenwood: peterpp: I was just reading an article about node: https://medium.com/@richardeng/the-javascript-phenomenon-is-a-mass-psychosis-57adebb09359
[08:17:36] DaniG2k: reactjs also drives me nuts
[08:17:36] dminuoso: peterpp: Everybody is biased in here.
[08:17:46] dminuoso: peterpp: Im a big fan of react powered apps.
[08:17:54] DaniG2k: you can't even do anything useful with react without using other frameworks with it
[08:17:56] dminuoso: apeiros is forced to love angularjs
[08:18:04] dminuoso: DaniG2k: huh?
[08:18:12] havenwood: peterpp: What is it you're making?
[08:18:26] dminuoso: DaniG2k: That is not a design problem, react is purposefully just a library to solve a dedicated problem. Very much like ActionView in Rails.
[08:18:44] DaniG2k: dminuoso: am I wrong? You can't make a fully fledged app with react alone you also need something like flux and redux to go with it
[08:18:57] dminuoso: DaniG2k: Ever tried making a full fledged app with ActionView?
[08:19:05] DaniG2k: no but that's my point
[08:19:09] dminuoso: Suddenly you need Rack to handle requests, and ActionController to do magic.
[08:19:10] DaniG2k: Rails includes everything
[08:19:18] DaniG2k: node isn't a rails replacement
[08:19:26] dminuoso: DaniG2k: The proper term is "react is not opinionated"
[08:19:31] peterpp: havenwood, the idea is kind of simple but the client thinks it has a lot of potential, so I'm reluctant to talk about it
[08:19:33] dminuoso: It doesnt force 17 libraries on you
[08:19:37] dminuoso: But you need 17 libraries either way.
[08:20:15] dminuoso: DaniG2k: Also node is just a language framework.
[08:20:23] dminuoso: node is like ruby.
[08:20:27] xall: has joined #RubyOnRails
[08:20:52] havenwood: peterpp: If you need lots of Websockets, consider Phoenix framework in Elixir lang.
[08:21:20] havenwood: peterpp: http://www.phoenixframework.org/docs/channels
[08:21:25] zpe: has joined #RubyOnRails
[08:21:48] marr: has joined #RubyOnRails
[08:22:17] sevenseacat: linkedin's most recent website is horrible
[08:22:26] sevenseacat: I wouldn't look at that as a shining beacon of awesome tech
[08:22:28] havenwood: peterpp: http://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections
[08:22:31] peterpp: havenwood, I used function languages before but I'm afraid it would take me quite a while to become productive with Elixir
[08:23:20] peterpp: functional
[08:23:20] sevenseacat: its going to take you quite a while to get productive in any new framework/language
[08:23:57] havenwood: peterpp: It's quite a pleasant lang to learn. I'd highly recommend it.
[08:25:29] pankaj_: has joined #RubyOnRails
[08:25:58] peterpp: havenwood, have you been using phoenix in production?
[08:26:27] pankaj_: Hello everyone. I am trying to add image in my layout but it is giving folowing error: Asset was not declared to be precompiled in production.
[08:26:28] pankaj_: Add `Rails.application.config.assets.precompile += %w( image )` to `config/initializers/assets.rb` and restart your server
[08:26:57] havenwood: peterpp: i have, but lately i've been working back in Ruby-land
[08:27:49] dminuoso: Ruby is like a a spider with fairy wings.
[08:27:57] dminuoso: I'm still busy trying to figure out how that analogy works though.
[08:28:55] DrYockel: has joined #RubyOnRails
[08:30:29] havenwood: dminuoso: Are you sure you're not thinking Perl6? That sounds an awful lot like Camelia: https://upload.wikimedia.org/wikipedia/commons/8/85/Camelia.svg
[08:30:59] havenwood: https://farm9.static.flickr.com/8432/28947786492_80056225f3_b.jpg
[08:33:02] jeyraof^mbpr: has joined #RubyOnRails
[08:35:18] jsrn__: has joined #RubyOnRails
[08:39:33] crystalneth: has joined #RubyOnRails
[08:42:16] dminuoso: havenwood: Wait a second. Perl 6 has been released?
[08:45:12] crystalneth: has joined #RubyOnRails
[08:56:24] lxsameer: has joined #RubyOnRails
[09:05:07] koneko: has joined #RubyOnRails
[09:08:14] patarr: has joined #RubyOnRails
[09:13:06] DrYockel: has joined #RubyOnRails
[09:19:09] centrx: has joined #RubyOnRails
[09:19:09] centrx: has joined #RubyOnRails
[09:19:15] DrYockel: has joined #RubyOnRails
[09:19:42] DrYockel: has joined #RubyOnRails
[09:20:56] tvw: has joined #RubyOnRails
[09:25:34] Guest96: has joined #RubyOnRails
[09:36:25] dminuoso: ACTION pokes matthewd 
[09:36:30] dminuoso: https://github.com/rails/rails/blob/0c5552a3dd28e35cce64462765cc41c5355db0f1/actionpack/lib/abstract_controller/rendering.rb#L138-L145
[09:36:33] dminuoso: This is madness.
[09:36:56] dminuoso: Im gonna stop using instance variables to share data between my controllers and views now!
[09:36:57] universa1: dminuoso: this is spart... ähh dhh :D
[09:37:27] dminuoso: Good thing Im using AMS now.
[09:37:38] Andr3as: morning everyone..
[09:37:45] dminuoso: ACTION pokes Andr3as with universa1 
[09:38:17] universa1: dminuoso: hmm, as in active model serializers? i sometimes find actual views simpler
[09:38:25] universa1: *json views
[09:39:04] matthewd: Pfft. Perfectly cromulent implementation for a perfectly cromulent API.
[09:39:08] Andr3as: i have a hash that could look like this https://gist.github.com/awunder/68d25c9623dee8ee63be7c3f96071cf8
[09:39:19] dminuoso: universa1: Yeah. Im not entirely committed yet though, but getting JSON:API style for free would be awesome since it would greatly simplify my normalizr schemas.
[09:39:31] universa1: dminuoso: :-)
[09:39:34] Andr3as: however, in certain scenarios i get a "<NoMethodError: undefined method `[]' for nil:NilClass>" error
[09:39:41] matthewd: Andr3as: Use dig
[09:40:04] universa1: Andr3as: and where is the code?
[09:40:16] universa1: because @likes["Action"]will not raise the error.
[09:40:23] dminuoso: universa1: Performance is going to be an issue though, because AMS is a little slower than jbuilder for long and nested things, but then again with jbuilder you can't use partials in those cases because oh well reasons.
[09:40:25] Andr3as: hey matthewd
[09:40:42] Andr3as: it will, when the hash looks like this: {"Achievement"=>{3=>8}}
[09:41:07] rgr: has joined #RubyOnRails
[09:41:09] universa1: Andr3as: no, try {}[:foo]
[09:41:22] universa1: dminuoso: mhm... if your content is cacheable the rendering performance is irrelevant ;)
[09:41:39] dminuoso: universa1: Well if I built in prefetchers perhaps.
[09:41:58] dminuoso: The problem with caching is that it forces a rain of websockets onto my app to invalidate records.
[09:42:28] universa1: hmm.. how is caching a rendered view on the server side related to client side?
[09:42:39] dminuoso: Not caching the views but the data.
[09:42:42] universa1: dminuoso: the server should be able to decide if the content of the view changed or not
[09:42:52] dminuoso: universa1: I have a client-side SPA. ;-)
[09:43:26] universa1: dminuoso: well, cached or not, your client needs to check. but if the content on the server did not change, you can send the cached stuff
[09:43:56] dminuoso: universa1: I dont want the client to check ever. Right now I already have a caching layer through redux with normalizer that works extremely well.
[09:43:56] Andr3as: matthewd: dig looks like the way to go here
[09:44:24] dminuoso: universa1: Now if I could force cache coherency by not snooping but rather broadcasting changes through websockets that would be amazing.
[09:44:35] Andr3as: universa1: thanks to you too...
[09:45:29] dminuoso: I guess I could actually do this, if I provide a channel "modifications" that will broadcast messages like { post: [ 1 ] }
[09:45:36] universa1: dminuoso: still not udnerstanding the problem tbh: so client a request resource 1; server generates "view" and caches it
[09:45:54] universa1: dminuoso: now client b comes along and also requests resource 1; send cached "view"
[09:46:06] enricostn: has joined #RubyOnRails
[09:46:17] enricostn: has left #RubyOnRails: ()
[09:46:31] universa1: dminuoso: client b sends changes to server; invalidate cache and on next request view is newly generated ;)
[09:46:33] dminuoso: universa1: I do the caching client side.
[09:46:41] enricostn: has joined #RubyOnRails
[09:46:58] dminuoso: This is generally preferrable since it cuts down requests that my app knows it doesnt have to do in the first place.
[09:47:06] universa1: dminuoso: okay, but this doesn't help with many clients requesting the same resource?!
[09:47:13] universa1: no clue if that actually happens for your app
[09:47:20] dminuoso: universa1: That's not my use case. I have only dozens of users at the most.
[09:47:33] dminuoso: I just want top performance for those few.
[09:48:16] universa1: dminuoso: :-) if you worry about rendering performance differences, then server-side caching might be a more fruitful avenue to go to ;)
[09:48:39] enricostn: has left #RubyOnRails: ()
[09:48:42] universa1: dminuoso: but tbh i don't know how well and easy it works with ams.
[09:49:40] dminuoso: universa1: That's the beauty. With AMS I can just provide deeply nested resources with almost no shallow endpoints. Through normalizer I then slowly replicate the database partially with every request I get.
[09:52:51] alexggordon: has joined #RubyOnRails
[09:54:13] universa1: dminuoso: https://github.com/rails-api/active_model_serializers/issues/1045 ;)
[09:55:10] dminuoso: universa1: Interesting.
[09:56:02] dminuoso: universa1: Yeah I kind of do Russian Doll caching on a per-entity (i.e. model) basis already in my redux store.
[09:56:13] dminuoso: but for AMS this would be awesome.
[09:56:20] blackmesa: has joined #RubyOnRails
[09:56:35] mikecmpbll: has joined #RubyOnRails
[09:56:40] universa1: dminuoso: yep :-) so back to jbuilder / rabl *cough* :D
[09:57:15] dminuoso: universa1: jbuilder is downright horrible when you start using partials.
[09:57:22] universa1: dminuoso: :-)
[10:01:48] dminuoso: universa1: Though I think I can live with AMS. A notable portion of the time is spent on the database (and that's already tweaked to the maximum) and partially on the network for some users. Both have working caching layers already.
[10:04:27] centrx: AWS is better than AMS
[10:04:38] universa1: AZS is even better :D
[10:05:16] centrx: universa99: yea
[10:06:26] patarr: has joined #RubyOnRails
[10:06:26] universa1: i was just increasing the middle letter ;)
[10:08:53] pankaj_: has joined #RubyOnRails
[10:11:00] nya: has joined #RubyOnRails
[10:11:30] greengriminal: has joined #RubyOnRails
[10:14:13] howlinbash: has joined #RubyOnRails
[10:17:53] centrx: The first ever locomotive-hauled railway in the world was the Stockton to Darlington route. It opened in September 1825, and George Stephenson's revolutionary 'Locomotion 1' pulled the train.
[10:17:55] srinidhi: has joined #RubyOnRails
[10:23:11] futilegames: has joined #RubyOnRails
[10:31:56] centrx: Riding the Rails During the Great Depression -- http://www.livinghistoryfarm.org/farminginthe30s/water_07.html
[10:33:48] AnoHito: has joined #RubyOnRails
[10:43:24] alexggordon: has joined #RubyOnRails
[10:47:51] IRCFrEAK: has joined #RubyOnRails
[10:47:54] IRCFrEAK: has left #RubyOnRails: ()
[10:51:07] Fernando-Basso: has joined #RubyOnRails
[10:59:11] pankaj_: has joined #RubyOnRails
[11:05:03] pickle_: has joined #RubyOnRails
[11:05:17] egray: has joined #RubyOnRails
[11:09:03] User458764: has joined #RubyOnRails
[11:21:17] Guest96: has joined #RubyOnRails
[11:21:21] Ergo: has joined #RubyOnRails
[11:23:31] njero: has joined #RubyOnRails
[11:28:32] blackmesa: has joined #RubyOnRails
[11:32:23] zpe: has joined #RubyOnRails
[11:32:52] alexggordon: has joined #RubyOnRails
[11:37:04] conta: has joined #RubyOnRails
[11:37:28] ldnunes: has joined #RubyOnRails
[11:44:44] aajjbb: has joined #RubyOnRails
[11:52:40] User458764: has joined #RubyOnRails
[11:54:53] AnoHito: has joined #RubyOnRails
[11:57:01] knight33: has joined #RubyOnRails
[11:59:49] GodFather_: has joined #RubyOnRails
[12:03:11] HoierM: has joined #RubyOnRails
[12:04:19] King_Rex: has joined #RubyOnRails
[12:16:13] ayonkhan: has joined #RubyOnRails
[12:18:58] amritoit: has joined #RubyOnRails
[12:24:16] soahccc: How is it possible for backticks to return nil? I thought it would always return a string (or maybe false if it fails) but nil?
[12:31:54] jarr0dsz: has joined #RubyOnRails
[12:31:58] jarr0dsz: hi everyone is there an easy way to add an associated table to a collection?
[12:32:08] jarr0dsz: like @customers << @customers.customer_profiles somehow
[12:32:28] jarr0dsz: i need a custom json object and have a user_id in the collection but need to add some fields from the user_profile table
[12:33:16] rnelson`: has joined #RubyOnRails
[12:34:12] blackmesa: has joined #RubyOnRails
[12:34:50] soahccc: jarr0dsz: How do you cast your objects to json? with as_json you can pull in any associated records or anything you like really
[12:35:11] jarr0dsz: yes i do @collection.to_json
[12:35:27] jarr0dsz: but need to add several fields from associated model cannot figure out how to do this ;0
[12:35:43] jarr0dsz: i mean i do render :json => @requests
[12:37:09] jarr0dsz: something like https://gist.github.com/anonymous/70a02021854304d169062d6a62082081
[12:37:13] greengriminal: has joined #RubyOnRails
[12:37:40] jarr0dsz: now how would i add data for each object in this collection? currently its having id,name,code for example how to add a 'name' field that gets it data from another table?
[12:39:00] soahccc: jarr0dsz: as_json != to_json http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/
[12:39:09] CGibsonmm: has joined #RubyOnRails
[12:40:15] CGibsonmm: is anyone familiar with semantic-ui? and how I can change variables in my rails app?
[12:40:16] mrgreenfur: has joined #RubyOnRails
[12:40:43] soahccc: "Anytime to_json is called on an object, as_json is invoked to create the data structure, and then that hash is encoded as a JSON string"... TL;DR: you can define exactly anything in your hash by creating/overwriting your model's as_json method
[12:43:54] jarr0dsz: im still not sure how to tackle this...
[12:43:58] jarr0dsz: since im having a collection
[12:44:05] fmcgeough: has joined #RubyOnRails
[12:44:20] jarr0dsz: and for each single item in the collection i need to append data from associated model, must be an elegant way to do this?
[12:44:27] pulkit4tech: has joined #RubyOnRails
[12:44:34] pupsicle: has joined #RubyOnRails
[12:46:40] soahccc: jarr0dsz: eager load the associated record maybe? The thing is if you to @collection.to_json it will do each(&:to_json) which will invoke as_json on the object. If you eager loaded the associated record you don't get n+1 query if you use it that method
[12:46:42] workmad3: soahccc: or override `serializable_hash` I believe
[12:46:53] jarr0dsz: it seems that jbuilder has a better way to do it
[12:48:00] workmad3: but if you want non-trivial customisations, it's generally better to use something like ActiveModel::Serializers or go all out to something like jbuilder
[12:57:58] soahccc: Well I think I figured out my backtick issue. Backticks behave really weird if you just read the docs... "Returns the standard output of running cmd in a subshell. The built-in syntax %x{...} uses this method. Sets $? to the process status."
[12:58:13] soahccc: But it may also raise and or return nil
[13:02:53] GodFather_: has joined #RubyOnRails
[13:03:23] soahccc: Okay, how do you get the result to be nil? I tried everything and I only get nil within pry (I assume it handles backticks differently?)... https://gist.github.com/2called-chaos/01666124288628d618fc146ce20ed89f
[13:09:52] am55: has joined #RubyOnRails
[13:14:52] blackmesa: has joined #RubyOnRails
[13:24:11] jarr0dsz: has joined #RubyOnRails
[13:26:04] patarr: has joined #RubyOnRails
[13:32:35] nya: has joined #RubyOnRails
[13:32:48] User458764: has joined #RubyOnRails
[13:42:25] DLSteve: has joined #RubyOnRails
[13:46:34] patarr: has joined #RubyOnRails
[13:53:03] buckrockwell: has joined #RubyOnRails
[14:00:20] SteenJobs: has joined #RubyOnRails
[14:01:00] Pumukel: has joined #RubyOnRails
[14:03:30] patarr: has joined #RubyOnRails
[14:08:59] b3l914n: has joined #RubyOnRails
[14:09:11] pickle_: has joined #RubyOnRails
[14:12:48] max_v: has joined #RubyOnRails
[14:17:01] workmad3: has joined #RubyOnRails
[14:17:37] User458764: has joined #RubyOnRails
[14:18:03] b3l914n: \join #learnprogramming
[14:18:17] NoGodDamnIdea: has joined #RubyOnRails
[14:18:17] NoGodDamnIdea: has joined #RubyOnRails
[14:19:05] rnelson`: has joined #RubyOnRails
[14:20:01] geekb4ck_: has joined #RubyOnRails
[14:27:27] mephistophocles: has joined #RubyOnRails
[14:30:18] buckrockwell: has joined #RubyOnRails
[14:31:00] Toledo: has joined #RubyOnRails
[14:33:50] narval: has joined #RubyOnRails
[14:37:35] ldnunes: has joined #RubyOnRails
[14:37:55] rakm: has joined #RubyOnRails
[14:39:44] CGibsonmm: help translating this line to haml <nav class="top-bar" data-topbar role="navigation">
[14:39:49] patarr: has joined #RubyOnRails
[14:42:53] pickle_: has joined #RubyOnRails
[14:45:15] joelwallis: has joined #RubyOnRails
[14:46:39] planigan: has joined #RubyOnRails
[14:49:06] [Butch]: has joined #RubyOnRails
[14:50:14] shinnya: has joined #RubyOnRails
[14:54:48] jgpawletko: has joined #RubyOnRails
[14:55:12] cpruitt: has joined #RubyOnRails
[14:55:42] r3vDev: has joined #RubyOnRails
[14:56:58] arBmind1: has joined #RubyOnRails
[15:01:31] greengriminal: has joined #RubyOnRails
[15:02:05] hahuang61: has joined #RubyOnRails
[15:02:40] mochiyoda_: has joined #RubyOnRails
[15:03:32] jusa: has joined #RubyOnRails
[15:06:50] cschneid_: has joined #RubyOnRails
[15:07:04] kristofferR: has joined #RubyOnRails
[15:08:23] xpl0iter: has joined #RubyOnRails
[15:08:57] dionysus69: has joined #RubyOnRails
[15:12:47] srinidhi: has joined #RubyOnRails
[15:17:10] howlinbash: has joined #RubyOnRails
[15:21:44] rakm: has joined #RubyOnRails
[15:22:48] arBmind: has joined #RubyOnRails
[15:26:36] Pumukel: has joined #RubyOnRails
[15:27:40] Pumukel: has joined #RubyOnRails
[15:28:10] jarr0dsz: has joined #RubyOnRails
[15:30:57] timh: has joined #RubyOnRails
[15:33:46] danguita: has joined #RubyOnRails
[15:34:47] timharding: has joined #RubyOnRails
[15:36:58] Toledo: has left #RubyOnRails: ("http://quassel-irc.org - Chat comfortably. Anywhere.")
[15:37:01] Meow-J: has joined #RubyOnRails
[15:38:32] nya: has joined #RubyOnRails
[15:39:06] meoblast001: has joined #RubyOnRails
[15:48:39] rakm: has joined #RubyOnRails
[15:48:57] pickle_: has joined #RubyOnRails
[16:00:47] SteenJobs: has joined #RubyOnRails
[16:01:06] dminuoso: Given a model that represents a "sales ticket", similar to that of a bug tracker issue, I want it to have a has_many :events where each event is basically an event very much like in gitlab.
[16:01:37] rnelson`: has joined #RubyOnRails
[16:01:42] dminuoso: Now the thing is an "event" is just something generic with a title and a body, but I want it to carry some additional information such as a "Rating" (where a sales rep can rate how well a visit went).
[16:02:07] dminuoso: Would you jam this "rating" into an additional column or rather inside a JSON serialized string in say a "additional_payload" column
[16:02:14] agent_white: has joined #RubyOnRails
[16:02:51] gusrub: has joined #RubyOnRails
[16:03:49] dminuoso: I mean adding the "rating" ties this directly to the model, which means I can't reuse it for other things.
[16:07:32] tdy: has joined #RubyOnRails
[16:08:34] gusrub: has joined #RubyOnRails
[16:09:36] tbuehlmann: dminuoso: (additional_)payload it is
[16:10:24] matthewd: dminuoso: "ties this directly to the model".. how is it not part of the model?
[16:10:42] dminuoso: matthewd: Not every event represents an actual visit.
[16:10:53] dminuoso: It's kind of polymorphic. ;-)
[16:11:05] matthewd: *cough*STI*cough*
[16:11:17] tbuehlmann: even then the question stays, right?
[16:12:28] matthewd: I don't see the value in trying to hide data in a JSON blob
[16:12:46] matthewd: If some rows can have the value and some can't, you're going to have to address that where-ever it's stored
[16:13:56] dminuoso: matthewd: Honest question though, why the "*cough*" ?
[16:14:27] matthewd: I haven't really been bitten by STI, so still tend to be a fan. But I know it's not a popular opinion.
[16:15:06] rnelson`: has left #RubyOnRails: ("ERC (IRC client for Emacs 24.5.1)")
[16:16:08] tbuehlmann: don't know the english term for columns that are empty depending on the model/type.. well, I favor having one payload column for various additional attributes rather than having n probably empty columns
[16:16:19] dminuoso: matthewd: Well in a way I think its exactly what I want. An event could be a "comment", a "visit" or an "update"
[16:16:19] tbuehlmann: you could also make that an association
[16:16:29] dminuoso: matthewd: and a visit definitely has 2 extra columns so..
[16:16:53] marr: has joined #RubyOnRails
[16:17:21] nya: has joined #RubyOnRails
[16:17:34] crystalneth: has joined #RubyOnRails
[16:17:42] tbuehlmann: meaning: make that model polymorphic and have an associated key/value like setting, whatever you need
[16:18:33] tbuehlmann: or instead of simple key/value or setting model, an entity–attribute–value model
[16:18:39] tbuehlmann: but that gets out of hand real quick
[16:22:28] agent_white: Mornin' folks
[16:23:38] dminuoso: tbuehlmann: by polymorphic you mean STI right? ;-)
[16:25:26] tbuehlmann: actually, not even polymorphic, but well
[16:25:59] dminuoso: "yes. well, no"
[16:26:15] tbuehlmann: too lazy to explain right now, sorry, will keep quiet :D
[16:26:56] tbuehlmann: you got this! :thumbsup:
[16:27:19] jmarchello: has joined #RubyOnRails
[16:27:43] dminuoso: tbuehlmann: And here I was, hoping for someone to gist me some code I could copy and paste and commit.
[16:27:59] dminuoso: Next thing you tell me is that I even have to come up with my own sensible commit message.
[16:28:03] dminuoso: What has this world come to.
[16:28:23] jmarchello: What are people using these days for token authentication?
[16:28:44] jmarchello: looking for key + secret key model similar to AWS
[16:28:58] CGibsonmm: has joined #RubyOnRails
[16:28:59] dminuoso: jmarchello: token and authentication dont work together.
[16:29:06] dminuoso: A token never. ever. authenticates.
[16:29:12] dminuoso: By definition.
[16:29:55] jmarchello: dminuoso: sorry, token authorization?
[16:31:03] dminuoso: jmarchello: Do you care about obtaining that token, or just an exchange format?
[16:32:29] jmarchello: I'm building an api that will interact with other apps. So I want to gen a key and give it to the consumer to send with each request
[16:33:02] dminuoso: jmarchello: So you care about the exchange of tokens?
[16:34:10] jmarchello: dminuoso: I'm not quite following…
[16:34:49] dminuoso: jmarchello: "giving a token to a customer" is an entirely different problem from "what does that token look like"
[16:35:10] FastJack: has joined #RubyOnRails
[16:35:46] jmarchello: dminuoso: right now this is just an MVP. So as long as I can generate a key, I'll get it to the consumer outside of the application.
[16:36:26] jmarchello: I'm mainly concerned with generating the key, and verifying it on each incoming request.
[16:37:50] dminuoso: jmarchello: So you just care about the format then. JWT is the most common solution.
[16:38:03] dminuoso: It's completely flexible to cover all conceivable needs.
[16:38:42] tbuehlmann: JWT more common than sending a "random" string? phew, not sure about that :)
[16:38:58] jmarchello: dminuoso: ok, are there any well-supported gems out there that help with JWT management?
[16:39:06] dminuoso: tbuehlmann makes a fair point heh.
[16:39:19] dminuoso: jmarchello: Do you need fine grained control, or is it just supposed to be a generic "this user has access" ?
[16:39:26] jmarchello: haha "common" and "best practice" don't always match up
[16:39:37] jmarchello: dminuoso: this user has access
[16:39:42] dminuoso: jmarchello: Well JWT are a complex beast that might be overkill if all you need is just a shared secret.
[16:40:42] kiltzman: has joined #RubyOnRails
[16:41:06] havenwood: an aside, but here's a simple plaintext JWT implementation, with no security at all (nothing after the last dot): https://gist.github.com/havenwood/3b98192d6122a4c9b1a4
[16:41:15] jmarchello: dminuoso: I would like each consumer to have their own key
[16:41:35] max_v: has joined #RubyOnRails
[16:41:37] kiltzman: has joined #RubyOnRails
[16:41:43] dminuoso: jmarchello: No problem, have a table with two columns: customer:string secret:string
[16:41:44] havenwood: Not much at all to JWTs if you don't pick an alg.
[16:42:14] bawsky: has joined #RubyOnRails
[16:42:18] kiltzman: has joined #RubyOnRails
[16:42:20] dminuoso: jmarchello: What JWTs allow you is basically hand them a JSON object that is either digitinally signed or encrypted to prevent tampering or reading respectively.
[16:42:29] dminuoso: So you can hand them complex information that you can trust if they pass it back.
[16:42:38] dminuoso: *digitically
[16:42:46] joelwall_: has joined #RubyOnRails
[16:43:08] jmarchello: so JWTs are more for passing a payload than simple authorization?
[16:44:03] havenwood: jmarchello: see: jwt.io
[16:44:23] havenwood: jmarchello: you sign, then verify your token
[16:44:24] kiltzman: has joined #RubyOnRails
[16:44:47] dminuoso: jmarchello: Right. You could have it be something like (simplified and changed for sake of discussion) { name: "Google Inc", roles: ["gambling", "admin", "sales"] }
[16:44:54] kiltzman: has joined #RubyOnRails
[16:45:05] dminuoso: And if they pass it to an API, that API can take that token, verify it and trust its contents implicitly.
[16:45:24] kiltzman: has joined #RubyOnRails
[16:45:35] jmarchello: havenwood: thanks
[16:45:58] kiltzman: has joined #RubyOnRails
[16:46:30] jmarchello: dminuoso: thanks for your help, I'm going to read up on JWTs
[16:47:31] dminuoso: jmarchello: The real benefits to them lie in designing stateless APIs. For rails it means you dont have to have something like warden that does table lookups for "Users" each time a request comes in, because it already has all the relevant information.
[16:52:20] jgpawletko: has joined #RubyOnRails
[16:52:43] dionysus69: has joined #RubyOnRails
[16:54:37] rgr_: has joined #RubyOnRails
[16:55:29] jmarchello: dminuoso: I see
[16:57:27] byteflame: has joined #RubyOnRails
[16:57:43] crystalneth: has joined #RubyOnRails
[16:59:01] byteflame: I've been googling for a couple of days, is there a way to do `update([1,2,3], [{position: 1}, {position: 2}, {position: 3}]) in one SQL query as to avoid unique constraint violations?
[16:59:05] jhfisc: has joined #RubyOnRails
[17:02:58] binarycodess: has joined #RubyOnRails
[17:03:08] hahuang61: has joined #RubyOnRails
[17:04:06] fugee: has joined #RubyOnRails
[17:04:26] ResidentBiscuit: has joined #RubyOnRails
[17:05:27] fugee: i added tables to the database and some existing tables i added columns i'm starting with an empty database how can i export the data from the old database structure and import it into the new, again, data only
[17:05:44] handicraftsman: has joined #RubyOnRails
[17:05:44] handicraftsman: has joined #RubyOnRails
[17:06:14] fugee: i easily get the structure from db:schema:load how am i gonna migrate the data
[17:06:28] fugee: mysqldump has me pulling my hair out
[17:06:45] jusa: has joined #RubyOnRails
[17:07:02] naprimer: has joined #RubyOnRails
[17:08:14] binarycodess: has joined #RubyOnRails
[17:13:08] matthewd: byteflame: In general, no. Your best option is probably to do it in a transaction, and disable the constraint.
[17:14:19] nahtnam: has joined #RubyOnRails
[17:14:22] matthewd: .. or just defer it, actually.
[17:14:38] cnk: has joined #RubyOnRails
[17:17:43] dminuoso: matthewd: That reminds me, there's is this race condition in the postgres adapter that has been around for years..
[17:17:51] dminuoso: I even made a pull request that was completely and utterly ignored back then.
[17:18:40] nya: has joined #RubyOnRails
[17:18:45] gusrub: has joined #RubyOnRails
[17:19:28] djbkd: has joined #RubyOnRails
[17:21:10] matthewd: dminuoso: Sounds about right. Got a link?
[17:24:23] ldnunes: has joined #RubyOnRails
[17:24:33] jaequery: has joined #RubyOnRails
[17:24:43] SteenJobs: has joined #RubyOnRails
[17:28:01] dminuoso: matthewd: Mmm good question. Where was Rails hosted around 2009-2010?
[17:28:25] [Butch]: has joined #RubyOnRails
[17:30:00] matthewd: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/overview I think?
[17:30:38] dminuoso: matthewd: https://activereload-lighthouse.s3.amazonaws.com/assets/89d92d162624fc4e4060d3977bed163e8fa19e67/disable_ri_fix.diff?AWSAccessKeyId=AKIAJ4QBZRZBVMOUBNZA&Expires=1807162221&Signature=iVVhaOJYCBp4V%2Befbhdh%2BGhgiVU%3D
[17:31:02] gusrub: has joined #RubyOnRails
[17:31:13] adam12: Woah, lighthouse is still around.
[17:31:18] dminuoso: I even used heredocs! :-)
[17:31:58] adam12: Wow, so is Tender.
[17:33:35] matthewd: Yeah, that looks pretty ripe for ignoring
[17:33:56] dminuoso: Curious, why?
[17:34:22] dminuoso: I mean I know that AR has always been a big fan of compromising ACID..
[17:35:54] matthewd: Opens with "I suggest to remove [feature]", takes three paragraphs to state how sure you are before getting around to a reason... then the reason is "it makes no sense", followed by later noting you don't actually know why it's currently there
[17:36:00] planigan: has joined #RubyOnRails
[17:36:22] pupsicle: has joined #RubyOnRails
[17:37:21] dminuoso: Ah well, I was pretty young and had fairly no clue.
[17:37:38] CGibsonmm: While adding user_name to rails 5 app, and following devise git hub to permit additional params, i entered code directly. but and still reciving unpermited_param error before the db rollback
[17:37:59] pLaTo0n: has joined #RubyOnRails
[17:40:45] ldnunes: has joined #RubyOnRails
[17:40:53] matthewd: Yeah, 8 years is a long time -- and I'm being honest because I know you're a reasonable person
[17:41:34] danguita: has joined #RubyOnRails
[17:43:10] matthewd: I didn't know you 8 years ago, so I don't know whether you were less reasonable at the time ;), or whether this is just a misleading impression... but if I saw an issue like that today, it would trip my "I don't want to deal with this right now" meter
[17:44:11] matthewd: dminuoso: The answer, btw, is "fixtures". No-one should be using that method on a real database.
[17:46:11] dminuoso: matthewd: Yeah. In the third (oh boy..) ticket I created regarding this, I speculated about this..
[17:46:51] dminuoso: Today I support the position that someone who uses a method like "disable_referential_integrity" does not deserve any handholding.
[17:48:25] mrgreenfur: has joined #RubyOnRails
[17:48:27] dminuoso: matthewd: Back then I suffered a lot from the Dunning-Kruger effect, feeling superior to all these idiots around me (in retrospect most of them *were* idiots, I just wasn't really competent myself)
[17:49:07] hndk: has joined #RubyOnRails
[17:50:54] rubyonrailed: has joined #RubyOnRails
[17:51:45] mjolnird: has joined #RubyOnRails
[17:52:08] duderonomy: has joined #RubyOnRails
[17:52:41] matthewd: I suspect that's a pretty common phase.. over-extrapolating about "other people", before learning the lesson that while there will always be plenty of idiots around, it behooves one to treat each new person as maybe-not-an-idiot until they have a chance to demonstrate otherwise
[17:53:33] binarycodess: has joined #RubyOnRails
[18:04:17] tercenya: has joined #RubyOnRails
[18:04:31] gusrub: has joined #RubyOnRails
[18:06:01] hotpancakes: has joined #RubyOnRails
[18:07:49] hotpanca_: has joined #RubyOnRails
[18:10:03] jonatasdaniel_: has joined #RubyOnRails
[18:11:44] mices: has joined #RubyOnRails
[18:13:23] mices: how do i set mysql2 default storage engine options so that when i run db:schema:dump it creates all tables innodb engine, id columns are all int(11), id column is set to be primary key, id column is set to autoincrement please
[18:14:02] jonatasdaniel_: Hi guys. Has someone used DDD with Rails? How to you model your domain?
[18:14:11] DoctorMonocular: has joined #RubyOnRails
[18:17:52] SteenJobs_: has joined #RubyOnRails
[18:21:34] hotpancakes: has joined #RubyOnRails
[18:22:32] hotpancakes: has joined #RubyOnRails
[18:24:26] CGibsonmm: has joined #RubyOnRails
[18:25:37] User458764: has joined #RubyOnRails
[18:27:11] mices: can i put something like this in database.yml int(11) auto_increment PRIMARY KEY
[18:27:27] hotpancakes: has joined #RubyOnRails
[18:28:35] arBmind: has joined #RubyOnRails
[18:32:55] King_Rex: has joined #RubyOnRails
[18:34:40] binarycodess: has joined #RubyOnRails
[18:35:00] hotpancakes: has joined #RubyOnRails
[18:35:02] kristofferR: has joined #RubyOnRails
[18:39:10] jhfisc: has joined #RubyOnRails
[18:40:14] sung: has joined #RubyOnRails
[18:40:14] sung: has joined #RubyOnRails
[18:41:20] greengriminal: has joined #RubyOnRails
[18:41:32] hotpancakes: has joined #RubyOnRails
[18:41:38] hotpancakes: has joined #RubyOnRails
[18:45:09] peterpp: has joined #RubyOnRails
[18:49:36] blackmesa: has joined #RubyOnRails
[18:51:30] CGibsonmm: has joined #RubyOnRails
[19:00:59] hotpancakes: has joined #RubyOnRails
[19:01:32] srinidhi: has joined #RubyOnRails
[19:01:39] breedmaster: has joined #RubyOnRails
[19:01:54] tildes: has joined #RubyOnRails
[19:02:04] jaequery: has joined #RubyOnRails
[19:03:56] hahuang61: has joined #RubyOnRails
[19:05:39] workmad3: has joined #RubyOnRails
[19:07:12] blackmesa: has joined #RubyOnRails
[19:08:42] buckrockwell: has joined #RubyOnRails
[19:12:43] hotpanca_: has joined #RubyOnRails
[19:12:55] my123: has joined #RubyOnRails
[19:14:03] matthewd: my123: !gist the command you're running and its output for me?
[19:14:03] helpa: my123: http://gist.github.com - Put your codes online with pretty syntax highlighting and the ability to embed it into other pages.
[19:16:54] my123: matthewd, https://gist.github.com/anonymous/4bfa63d034273778937f4632ad052f3d
[19:17:06] my123: hmmm, even running just "rails" fails...
[19:18:24] cnk: Hmmm so how did you install ruby and rails?
[19:18:45] my123: cnk, yes, I installed Ruby for Windows and the devenv
[19:18:55] my123: then did gem install rails
[19:19:00] matthewd: my123: You've lost the bundle exec
[19:19:27] byteflame: has joined #RubyOnRails
[19:19:50] my123: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/rubygems_integration.rb:408:in `block in replace_bin_path': can't find executable rails (Gem::Exception)
[19:20:29] blackmesa: has joined #RubyOnRails
[19:20:45] matthewd: my123: Now I'm confused, because neither of those match the output you originally reported in #ruby
[19:21:48] my123: matthewd, I get that output when trying to run the app outright...
[19:21:54] binarycodess: has joined #RubyOnRails
[19:22:44] matthewd: ... using what command?
[19:24:50] my123: rake secret in this case, which afails with that, and then bundle exec puma -C config/puma.rb, which fails with the same error
[19:28:46] my123: hmmm, overriding with the railties from a Linux install makes Could not find nio4r-2.0.0 in any of the sources shown instead
[19:28:48] matthewd: my123: Have you run bundle install?
[19:28:57] my123: matthewd, yes
[19:29:09] dminuoso: matthewd: By the way: STI opened a can of worms the more I thought about it. Ill just stick with a singular "event" model with rating/was_present columns.
[19:29:14] my123: the same commands work fine on the Linux side of the same Windows machine...
[19:30:33] dminuoso: In the end I need the polymorphic behavior in the frontend, but I can't treat them as separate "models" -> so I ended up thinking what possible value STI added and realized it was literally none..
[19:31:46] mikecmpbll: has joined #RubyOnRails
[19:31:47] matthewd: ¯\_(ツ)_/¯ .. if you're going to have some sort of "type" column, ISTM you might as well use that to key a couple of subclass-overridden methods -- but you could also do that with something like classy_enum, I guess
[19:32:16] matthewd: my123: Wait, which same error?
[19:32:18] CGibsonmm: has joined #RubyOnRails
[19:32:36] matthewd: `bundle exec puma -C config/puma.rb` fails with "can't find executable rails"?!
[19:33:31] dminuoso: matthewd: Possibly mmm. Perhaps Ill just try the STI and then decide if there's any issues.
[19:33:48] dminuoso: Ah well, Ill just do it and gather some actual experience rather than just echoing what I hear here from time to time.
[19:34:53] SteenJobs: has joined #RubyOnRails
[19:34:59] my123: ACTION is trying something...
[19:36:27] DoctorMonocular: has joined #RubyOnRails
[19:40:36] CGibsonmm: has joined #RubyOnRails
[19:41:01] jaegerca: has joined #RubyOnRails
[19:41:12] tercenya: has joined #RubyOnRails
[19:41:59] jaegerca: So I am configuring resque with chef, and I am wondering whether it's better to have 1 process with 4 workers each, or 4 processes with 1 worker each. Anyone have any pros and cons?
[19:43:36] jaegerca: I assume 4 processes would obviously take more memory - but what would be the advantage of going that route at all? I guess if one process dies and I have only one worker then only one worker dies.
[19:44:52] my123: hmmm, seems that all the symlinks are broken
[19:45:14] matthewd: What symlinks?
[19:46:02] fattuna: has joined #RubyOnRails
[19:46:32] matthewd: jaegerca: Don't resque workers run in separate processes anyway?
[19:47:11] jaegerca: matthewd: Well, I am someone confused about that! I was under the impression that they do.
[19:47:25] tercenya: has joined #RubyOnRails
[19:47:53] jaegerca: matthewd: I am using this to generate the basics of my chef stack json: http://opsworks-ruby.rzegocki.pl/configuration-builder You can see at the very bottom a section for delayed jobs.
[19:48:59] jaegerca: And it gives me the option of running x processes and x workers. Though - configuring 4 processes and 4 workers I would have expected 16 total, I only ended up with 6(!?)
[19:49:40] mjolnird: has joined #RubyOnRails
[19:50:42] matthewd: Hmm.. that's about 3 layers of abstraction above anything I know about, sorry
[19:52:07] hotpancakes: has joined #RubyOnRails
[19:52:46] sypheren: has joined #RubyOnRails
[19:53:57] jgt1: has joined #RubyOnRails
[19:55:44] workmad3: has joined #RubyOnRails
[19:56:33] nicolasb: has joined #RubyOnRails
[20:01:35] mathzol: has joined #RubyOnRails
[20:05:09] blackmesa: has joined #RubyOnRails
[20:06:28] hotpancakes: has joined #RubyOnRails
[20:06:53] S1kx: has joined #RubyOnRails
[20:09:49] Exagone313: has joined #RubyOnRails
[20:09:54] jenrzzz: has joined #RubyOnRails
[20:10:28] jgt1: has joined #RubyOnRails
[20:12:07] daveande: has joined #RubyOnRails
[20:19:00] Exagone313: Hi, I have a question regarding rails' implementation of session cookies. I'm not using it myself, it's about a project I'm discussing on (Mastodon). Are those cookies created on every page even when not needed, or only on-demand in the program? The situation here is, at least in France but maybe in whole Europe, you have to ask permission _before_ setting a cookie, except when if it's a session cookie (= logged-in), or if it's to keep track of
[20:19:00] Exagone313: user-input or if it's security-related (like for CSRF protection on current page's form) + 4 other categories. When simply visiting a website, it does not seem to fall in any of these accepted categories. Is it possible, actually, with rails, to do not create a cookie in this situation? (I don't want to try rails to know.) Thanks for your help.
[20:22:04] dps: has joined #RubyOnRails
[20:22:24] kristofferR: has joined #RubyOnRails
[20:26:19] hotpancakes: has joined #RubyOnRails
[20:26:44] fp-: has joined #RubyOnRails
[20:27:16] fp-: hey guys... anyone here using multitenancy have advice on how to allow the user to edit the settings for the tenant
[20:27:23] fp-: do you just do a tenants_controller
[20:28:17] hotpanca_: has joined #RubyOnRails
[20:29:57] fryguy: Exagone313: sessions are created on demand
[20:31:36] jgt1: has joined #RubyOnRails
[20:31:38] Exagone313: fryguy: do you have a link I can provide on the issue?
[20:32:37] Exagone313: what I mean is, there is a way to check if a session exists without creating a cookie?
[20:34:17] lxsameer: has joined #RubyOnRails
[20:34:29] fryguy: if you are using cookie-based sessions, and you don't have the cookie, then you don't have the session
[20:36:34] Exagone313: Oh, seems odd, I wonder why this program explicitly set a cookie when not needed then. thanks for your replies
[20:38:10] FastJack: has joined #RubyOnRails
[20:38:55] matthewd: Probably for CSRF
[20:40:55] Exagone313: the problem is it does even when no form is on the page
[20:41:21] Exagone313: so there are pages where it does not enter in any of allowed categories
[20:42:02] Exagone313: I don't want to bother you with this
[20:43:48] meoblast001: has joined #RubyOnRails
[20:44:23] hotpancakes: has joined #RubyOnRails
[20:44:24] Technodrome: i wonder what percentage of rails dev's truly understand the underpinnings of how rails works
[20:45:25] matthewd: Technodrome: Depends on your definition of underpinnings, I guess
[20:45:55] Technodrome: like, have went understnad and saw the whole request process, understand when all the action* are loaded and how the custom application code fits in
[20:45:57] matthewd: Actual details: hopefully relatively few, because that's arguably the point
[20:48:12] kiltzman: has joined #RubyOnRails
[20:48:28] matthewd: Higher level "how things fit together" (but not *how* they fit together).. hopefully more, though even that shouldn't be necessary to achieve some level of useful productivity
[20:53:55] SteenJobs: has joined #RubyOnRails
[20:57:36] GodFather: has joined #RubyOnRails
[20:57:39] Technodrome: matthewd yeah i meant from a lower level
[20:59:41] NoGodDamnIdea: has joined #RubyOnRails
[20:59:41] NoGodDamnIdea: has joined #RubyOnRails
[21:04:51] hahuang61: has joined #RubyOnRails
[21:21:58] Technodrome: matthewd i really wonder if knowing much lower level things helps in a full rails understanding though
[21:23:05] howlinbash: has joined #RubyOnRails
[21:29:06] hotpanca_: has joined #RubyOnRails
[21:31:10] jenrzzz_: has joined #RubyOnRails
[21:32:35] superlou: has joined #RubyOnRails
[21:39:30] jusa: has joined #RubyOnRails
[21:40:31] matthewd: Technodrome: I think it does help.. it just shouldn't be necessary
[21:40:57] Technodrome: matthewd yeah, you can build a rails app without hardly even understanding ruby
[21:41:09] Technodrome: its more about the DSL of the web, and just doing simple business logic and returning what you need
[21:52:02] [Butch]: has joined #RubyOnRails
[21:57:06] peterhil: has joined #RubyOnRails
[22:00:45] b3l914n: has joined #RubyOnRails
[22:07:14] _3dwardsharp: has joined #RubyOnRails
[22:09:08] srinidhi: has joined #RubyOnRails
[22:11:58] jmarchello: has joined #RubyOnRails
[22:14:04] jmarchello: has left #RubyOnRails: ()
[22:15:20] tvw: has joined #RubyOnRails
[22:15:51] cseder: has joined #RubyOnRails
[22:16:27] Axsuul: If i were to test my rspec support helpers, what folder should I put them in?
[22:16:55] mrgreenfur: has joined #RubyOnRails
[22:19:12] tvw: has joined #RubyOnRails
[22:23:03] jenrzzz: has joined #RubyOnRails
[22:26:00] Darmani: has joined #RubyOnRails
[22:26:37] Darmani: Hi everyone! This transaction fails and gives no error for some reason. I'm trying to create an object with a dropzone form.
[22:26:39] Darmani: https://gist.github.com/mfifth/60602fa513777f7cdc61816b3b803a01
[22:28:10] arBmind: has joined #RubyOnRails
[22:33:28] cseder: Hi! I have a question that is off topic, but I use Sublime as default editor, set in .zshrc, but when I use git with e.g. git commit -a, Sublime pops up, waiting for me to write a commit message, than, when I save the file and quit Sublime, the commit gets discarded
[22:34:56] cnk: use SourceTree or git commit -m "your commit message here"
[22:35:11] breedmaster: has joined #RubyOnRails
[22:35:16] cseder: Sure, but isn't it supposed to work?
[22:37:06] cnk: Sorry, no idea. I have EDITOR set to emacs -nw
[22:46:00] ludicocr: has joined #RubyOnRails
[22:47:16] rubyonrailed: has joined #RubyOnRails
[22:49:59] jhfisc: has joined #RubyOnRails
[22:55:23] rakm: has joined #RubyOnRails
[22:59:33] Suslov: has joined #RubyOnRails
[23:00:06] unreal: has joined #RubyOnRails
[23:05:35] ludicocr: has joined #RubyOnRails
[23:05:56] hahuang61: has joined #RubyOnRails
[23:08:25] srinidhi: has joined #RubyOnRails
[23:11:04] fugee: has joined #RubyOnRails
[23:12:50] cam27: has joined #RubyOnRails
[23:15:19] SteenJobs: has joined #RubyOnRails
[23:16:55] hotpancakes: has joined #RubyOnRails
[23:16:57] snickers: has joined #RubyOnRails
[23:23:33] fugee: has joined #RubyOnRails
[23:27:47] gusrub: has joined #RubyOnRails
[23:31:21] am55: has joined #RubyOnRails
[23:31:43] FastJack_: has joined #RubyOnRails
[23:34:16] cschneid_: has joined #RubyOnRails
[23:37:40] hotpancakes: has joined #RubyOnRails
[23:40:18] FastJack_: has joined #RubyOnRails
[23:41:03] jhfisc: has joined #RubyOnRails
[23:48:43] planigan: has joined #RubyOnRails
[23:49:05] djbkd: has joined #RubyOnRails
[23:49:44] hotpanca_: has joined #RubyOnRails
[23:50:54] levifig: has joined #RubyOnRails