« Back to channel list

#RubyOnRails - 26 March 2017

« Back 1 day Forward 1 day »
[00:00:19] sabayonuser: has joined #RubyOnRails
[00:04:33] psethi: has joined #RubyOnRails
[00:08:41] psethi: has joined #RubyOnRails
[00:18:37] Rodya_: has joined #RubyOnRails
[00:27:06] Rodya__: has joined #RubyOnRails
[00:27:54] moep: has joined #RubyOnRails
[00:41:46] psethi: has joined #RubyOnRails
[00:48:04] Cohedrin: has joined #RubyOnRails
[00:49:01] sypheren: has joined #RubyOnRails
[00:52:19] Jameser: has joined #RubyOnRails
[00:52:39] nahtnam: has joined #RubyOnRails
[00:57:16] tomasm-: has joined #RubyOnRails
[00:59:46] blackmesa: has joined #RubyOnRails
[01:00:34] lightheaded: has joined #RubyOnRails
[01:07:37] patarr: has joined #RubyOnRails
[01:08:31] Jameser: has joined #RubyOnRails
[01:18:57] Jameser: has joined #RubyOnRails
[01:19:57] arBmind: has joined #RubyOnRails
[01:22:23] Jameser: has joined #RubyOnRails
[01:31:56] byteflame: has joined #RubyOnRails
[01:32:02] Technodrome: has joined #RubyOnRails
[01:40:36] bronson: has joined #RubyOnRails
[01:47:24] Rodya_: has joined #RubyOnRails
[01:47:56] Pumukel: has joined #RubyOnRails
[01:51:11] doodlehaus: has joined #RubyOnRails
[02:00:41] Limix: has joined #RubyOnRails
[02:00:51] ajruiz_: has joined #RubyOnRails
[02:01:19] lightheaded: has joined #RubyOnRails
[02:05:33] navo: has joined #RubyOnRails
[02:11:52] keerthana: has joined #RubyOnRails
[02:17:10] brent__: has joined #RubyOnRails
[02:20:54] gambl0re: has joined #RubyOnRails
[02:30:00] shinnya: has joined #RubyOnRails
[02:42:36] Technodrome: has joined #RubyOnRails
[02:46:26] keerthana: has joined #RubyOnRails
[02:56:46] djbkd: has joined #RubyOnRails
[02:57:29] pwnd_nsfw`: has joined #RubyOnRails
[03:02:16] lightheaded: has joined #RubyOnRails
[03:08:33] patarr: has joined #RubyOnRails
[03:11:26] desnudopenguino: has left #RubyOnRails: ()
[03:15:05] Technodrome: has joined #RubyOnRails
[03:15:24] agent_white: has joined #RubyOnRails
[03:20:15] SteenJobs: has joined #RubyOnRails
[03:22:36] irishfromua: has joined #RubyOnRails
[03:26:26] irishfromua: has joined #RubyOnRails
[03:29:08] gusrub: has joined #RubyOnRails
[03:42:24] ajruiz_: has joined #RubyOnRails
[03:43:21] akshat: has joined #RubyOnRails
[03:43:59] psethi: has joined #RubyOnRails
[03:46:25] Technodrome: has joined #RubyOnRails
[03:55:06] psethi: msg NickServ IDENTIFY techsethi sethitech
[03:59:30] Trynemjoel: has joined #RubyOnRails
[03:59:42] psethi: Hi Folks, I have an HTML view, where I am trying to include a javascript file (with extension .js.erb), expecting it to be pre-processed through erb processor, hence able to include ruby code, but am getting route not found error. Here is my GIST: https://gist.github.com/techsethi/f6e91a1639dd44612ef8941866b82f16 Can someone point me, if this can be accomplished or not & how. Thanks in advance.
[04:02:52] lightheaded: has joined #RubyOnRails
[04:17:14] fryguy: first of all, always reference javascript_tags using the appropriate helpers, so that the asset pipeline can help you. second, remember that the asset pipeline is going to probably not do what you want here, and ruin performance of your app. 3rd, don't include the .erb extension in the client code, just .js
[04:29:33] psethi: fryguy: ok. i c
[04:32:47] roamingdog: has joined #RubyOnRails
[04:32:54] SteenJobs: has joined #RubyOnRails
[04:44:19] adavia: has joined #RubyOnRails
[04:50:43] gambl0re: has joined #RubyOnRails
[04:56:25] roamingdog: has joined #RubyOnRails
[04:56:44] Pumukel: has joined #RubyOnRails
[04:57:10] roamingdog: has joined #RubyOnRails
[04:58:00] roamingdog: has joined #RubyOnRails
[04:58:02] Technodrome: has joined #RubyOnRails
[04:58:49] roamingdog: has joined #RubyOnRails
[04:59:34] roamingdog: has joined #RubyOnRails
[05:00:24] roamingdog: has joined #RubyOnRails
[05:03:42] lightheaded: has joined #RubyOnRails
[05:09:15] patarr: has joined #RubyOnRails
[05:15:03] spicerack: has joined #RubyOnRails
[05:21:30] Robtop__: has joined #RubyOnRails
[05:23:54] JDeen: Hi... I am building a directory... i have 2 states for an organization. confimred and unconfirmed. The validations for 'unconfirmed' is few relatively to what is for 'confirmed'. How is it best to have the model? Is it good to model it with some thing like 'AASM' or to use STI and have the validations in separate classes?
[05:24:24] JDeen: or will there be a better way to do it?
[05:27:58] JDeen: why i am thinking of STI and have few classes like `ConfirmedOrganization` and `Organization` (or similar) is to limit logic in a model.
[05:28:19] JDeen: where as if i use some thing like AASM i will have to use conditionals
[05:28:37] JDeen: any opinion is highly appreciated
[05:39:06] Limix: has joined #RubyOnRails
[05:47:20] akshat: has joined #RubyOnRails
[06:04:39] lightheaded: has joined #RubyOnRails
[06:11:50] SteenJobs: has joined #RubyOnRails
[06:14:28] ajruiz_: Hello everybody, I have a question, its hard migrate from Rails 4.2 to the last version?
[06:20:01] mjolnird: has joined #RubyOnRails
[06:24:43] psethi: has joined #RubyOnRails
[06:35:17] nahtnam: has joined #RubyOnRails
[06:35:48] hahuang65: has joined #RubyOnRails
[06:39:25] psethi: has joined #RubyOnRails
[06:40:31] marcdel: has joined #RubyOnRails
[06:41:34] pulkit4tech: has joined #RubyOnRails
[06:46:47] adavia: has joined #RubyOnRails
[06:48:21] Andr3as: good morning everyone... i've an understanding issue here... i have a form as a modal which should add an entry to a model and after that it should update the view via js / jquery.. in this case its anew row in a table.. i've got the create part and am now stuck on the "update the view with a new row part"... here is my gist: https://gist.github.com/awunder/434ab40a7edc86d6cdc23a3ab3595971 - the issue is, i thought i could use the same
[06:48:21] Andr3as: partial which i use to render the table rows, but just call it on a single object (the newly created one). however, it throws me the error (in the gist).. if i would use @actions instead it works, but obviously renders all actions again, which is not what someone would want...
[06:48:45] Jameser: has joined #RubyOnRails
[06:49:36] Andr3as: any hint is appreciated
[06:50:21] marcdel: has joined #RubyOnRails
[06:54:13] xibalba: has joined #RubyOnRails
[06:56:13] nyaa: has joined #RubyOnRails
[07:01:42] roamingdog: has joined #RubyOnRails
[07:03:25] bento: has joined #RubyOnRails
[07:03:41] Andr3as: i got it sorted
[07:04:11] Andr3as: fwiw: the render call was the culprit.. needed to be changed to
[07:04:11] Andr3as: $('#actions').prepend("<%= j (render 'domains/domain_action', action: @action, added: ' id=new_action') %>");
[07:05:23] lightheaded: has joined #RubyOnRails
[07:05:48] pwnd_nsfw`: has joined #RubyOnRails
[07:10:09] patarr: has joined #RubyOnRails
[07:10:49] Jameser: has joined #RubyOnRails
[07:13:08] marcdel_: has joined #RubyOnRails
[07:17:56] AzaToth: has joined #RubyOnRails
[07:19:40] doodlehaus: has joined #RubyOnRails
[07:19:55] bronson: has joined #RubyOnRails
[07:20:58] SteenJobs: has joined #RubyOnRails
[07:29:23] brent__: has joined #RubyOnRails
[07:38:56] darutoko: has joined #RubyOnRails
[07:42:04] psethi: has joined #RubyOnRails
[07:43:55] psethi_: has joined #RubyOnRails
[07:48:01] WinterBluFox: has joined #RubyOnRails
[07:51:31] Jameser: has joined #RubyOnRails
[07:52:53] lightheaded: has joined #RubyOnRails
[07:55:12] Qchmqs: has joined #RubyOnRails
[07:55:24] pLaTo0n: has joined #RubyOnRails
[07:59:05] Pumukel: has joined #RubyOnRails
[08:03:29] irishfromua: has joined #RubyOnRails
[08:08:33] patarr: has joined #RubyOnRails
[08:09:02] Jameser: has joined #RubyOnRails
[08:10:04] mbertul: has joined #RubyOnRails
[08:15:23] robnester: has joined #RubyOnRails
[08:38:13] pLaTo0n: has joined #RubyOnRails
[08:54:25] igniting: has joined #RubyOnRails
[09:00:28] srinidhi: has joined #RubyOnRails
[09:00:33] Pumukel: has joined #RubyOnRails
[09:03:26] defsdoor: has joined #RubyOnRails
[09:14:10] bungoman: has joined #RubyOnRails
[09:19:33] dionysus69: has joined #RubyOnRails
[09:22:00] spicerack: has joined #RubyOnRails
[09:22:04] bronson: has joined #RubyOnRails
[09:22:45] spicerack: has joined #RubyOnRails
[09:23:37] spicerack: has joined #RubyOnRails
[09:24:22] spicerack: has joined #RubyOnRails
[09:25:12] spicerack: has joined #RubyOnRails
[09:37:17] Jameser: has joined #RubyOnRails
[09:38:31] pulkit4tech: has joined #RubyOnRails
[09:45:12] brent__: has joined #RubyOnRails
[09:46:47] handicraftsman: has joined #RubyOnRails
[09:46:47] handicraftsman: has joined #RubyOnRails
[09:51:56] antgel: has joined #RubyOnRails
[09:57:12] blackmesa: has joined #RubyOnRails
[10:07:12] Technodrome: has joined #RubyOnRails
[10:14:18] banisterfiend: has joined #RubyOnRails
[10:15:49] Jasaka: has joined #RubyOnRails
[10:19:05] doublemalt_: has joined #RubyOnRails
[10:20:09] newcoder: has joined #RubyOnRails
[10:20:32] newcoder: Hi, are rubyonrails community/people good and friendly?
[10:25:47] nyaa: has joined #RubyOnRails
[10:34:34] blackmesa: has joined #RubyOnRails
[10:40:33] yottanami1: has joined #RubyOnRails
[10:40:41] Jasaka: has joined #RubyOnRails
[10:41:56] yottanami1: I have a datetime column in db how can I make a query to fetch all items in a specific date? (without considering time)
[10:42:47] Andr3as: http://stackoverflow.com/questions/5943872/find-records-with-datetime-that-match-todays-date-ruby-on-rails
[10:42:50] yottanami1: for example I have created_at: "2017-03-25 19:59:11" and I need something like MyModel.where(start_time: Date.parse('2017-04-05')) but it does not return that model
[10:43:18] newcoder: has left #RubyOnRails: ()
[10:44:33] xibalba: has joined #RubyOnRails
[10:49:01] User458764: has joined #RubyOnRails
[10:49:13] DrYockel: has joined #RubyOnRails
[11:01:39] Pumukel: has joined #RubyOnRails
[11:05:48] blackmesa: has joined #RubyOnRails
[11:10:38] mikecmpbll: has joined #RubyOnRails
[11:12:58] Jameser: has joined #RubyOnRails
[11:22:54] bronson: has joined #RubyOnRails
[11:25:19] srinidhi: has joined #RubyOnRails
[11:27:41] NoGodDamnIdea: has joined #RubyOnRails
[11:33:00] _3dwardsharp: has joined #RubyOnRails
[11:46:09] brent__: has joined #RubyOnRails
[11:57:23] Or1on: has joined #RubyOnRails
[12:00:15] blackmesa: has joined #RubyOnRails
[12:03:17] Pumukel: has joined #RubyOnRails
[12:07:06] blackmesa: has joined #RubyOnRails
[12:11:46] banisterfiend: has joined #RubyOnRails
[12:14:44] roamingdog: has joined #RubyOnRails
[12:24:43] ferr1: has joined #RubyOnRails
[12:25:25] Or1on: has joined #RubyOnRails
[12:28:20] netzfisch: has joined #RubyOnRails
[12:29:36] arBmind: has joined #RubyOnRails
[12:31:42] Jameser: has joined #RubyOnRails
[12:43:03] netzfisch: has joined #RubyOnRails
[12:45:11] dionysus69: has joined #RubyOnRails
[12:49:03] doublemalt_: has joined #RubyOnRails
[13:15:08] User458764: has joined #RubyOnRails
[13:15:49] roamingdog: has joined #RubyOnRails
[13:24:08] bronson: has joined #RubyOnRails
[13:29:04] pulkit4tech: has joined #RubyOnRails
[13:31:18] keerthana: has joined #RubyOnRails
[13:41:12] psethi: has joined #RubyOnRails
[13:44:19] rogue_koder: has joined #RubyOnRails
[13:45:15] handicraftsman: has joined #RubyOnRails
[13:45:21] Pumukel: has joined #RubyOnRails
[13:48:30] Fernando-Basso: has joined #RubyOnRails
[13:48:36] psethi: has joined #RubyOnRails
[13:53:19] hfp_work: has joined #RubyOnRails
[13:54:41] DaveTaboola: has joined #RubyOnRails
[13:58:14] Technodrome: has joined #RubyOnRails
[13:59:52] blackmesa: has joined #RubyOnRails
[14:00:03] Apho: has joined #RubyOnRails
[14:01:42] flegent: has joined #RubyOnRails
[14:01:56] brent__: has joined #RubyOnRails
[14:15:09] DLSteve: has joined #RubyOnRails
[14:20:33] byteflame: has joined #RubyOnRails
[14:22:50] akshat: has joined #RubyOnRails
[14:25:06] Apho: Anyone know how i can make a rails form that allows me to add fields to the form and then save it. E.g. clicking a button "Add interest" would create some additional input fields?
[14:25:14] jhack: has joined #RubyOnRails
[14:25:14] jhack: has joined #RubyOnRails
[14:28:02] mooser: has joined #RubyOnRails
[14:30:00] brent__: has joined #RubyOnRails
[14:30:44] zeddan: has joined #RubyOnRails
[14:33:39] blackmesa: has joined #RubyOnRails
[14:42:31] mbertul: has joined #RubyOnRails
[14:44:06] kernelPaniq: has joined #RubyOnRails
[14:45:49] robnester: has joined #RubyOnRails
[14:46:35] pankaj: has joined #RubyOnRails
[14:47:57] Qchmqs: Apho: I know you asked a while ago
[14:48:07] Qchmqs: but that can't be achieved using ruby, so rails is irrelevant
[14:48:13] Qchmqs: it's a client side javascript thing
[14:48:34] Qchmqs: html wise you can use array inputs
[14:49:10] Qchmqs: <input name='tag[]' />
[14:54:52] Apho: Qchmqs: thanks for your reply. I found a gem that supports exactly this https://github.com/nathanvda/cocoon
[14:55:13] Qchmqs: if it exists, there is a gem for it, and an emacs command for it
[14:56:30] librestreamer: has joined #RubyOnRails
[15:06:27] Jon30: has joined #RubyOnRails
[15:07:50] Jon30: Hello. How come lib/*.rb files are not auto loaded in production, but loading fine in development? I have config.autoload_paths << "#{Rails.root}/lib" in application.rb
[15:10:14] greengriminal: has joined #RubyOnRails
[15:12:02] segy: has joined #RubyOnRails
[15:12:14] marcdel: has joined #RubyOnRails
[15:14:08] zeddan: has joined #RubyOnRails
[15:19:58] Jon30: I have liquid_filters.rb in my lib folder: https://gist.github.com/slavajacobson/93c0012ad81a8aebcb590e2151f6e24f
[15:20:55] Jon30: and I am trying to call render html: template.render({'page' => @page}, :filters => [LiquidFilters]).html_safe from the MainController
[15:21:16] Jon30: can't figure out why would it work in dev but not in production...
[15:22:03] dionysus69: has joined #RubyOnRails
[15:23:05] marcdel: has joined #RubyOnRails
[15:24:44] bronson: has joined #RubyOnRails
[15:35:25] tbuehlmann: Jon30: try eager_load_paths instead of autoload_paths
[15:38:21] flegent: has joined #RubyOnRails
[15:40:01] byteflame: has joined #RubyOnRails
[15:44:11] Jon30: will try. also it's Rails 5.0.1
[15:51:30] mikecmpbll: has joined #RubyOnRails
[15:53:10] Jon30: tbuehlmann: that did the trick. tahnk you!
[15:53:50] testmad: has joined #RubyOnRails
[15:54:48] mooser: has joined #RubyOnRails
[15:54:59] froyo1: has joined #RubyOnRails
[15:56:44] froyo1: So I have a Posts controller, and in the index action I have this line: render :js => "post_removed();"
[15:57:02] froyo1: where post_removed is a function in the index.js.erb file
[15:57:17] froyo1: but for some reason the function is not executing
[15:57:27] froyo1: i do have remote: true specified in the link
[15:58:11] tbuehlmann: froyo1: can you gist the controller, the view and the request log?
[16:02:45] testmad: I'm havnig trouble wrapping my head around migrations and adding references. In this case, I need to create a table for surveys where each survey has one owner from my users table. Would this be correct? 'rails g model Survey name:string published:boolean user:references:index'
[16:03:43] froyo1: https://gist.github.com/anonymous/cafc7418a44aa9ee33e84311af10e7c9
[16:04:35] froyo1: sorry, i said index action just to generalize the problem
[16:04:44] froyo1: ^ THAT is the actual code
[16:04:49] Pumukel: has joined #RubyOnRails
[16:06:04] tbuehlmann: froyo1: the request log as well, please
[16:07:40] froyo1: hmm not sure which that is...
[16:07:42] froyo1: https://gist.github.com/anonymous/e3ced8a047e700721b4c40560ec29060
[16:07:47] froyo1: is this the request log?
[16:08:57] tbuehlmann: yeah. so, when you send that request from the browser, you get a response. can you check the response body in your browser's development tools?
[16:11:14] froyo1: is it the one in the XHR tab under Network?
[16:13:36] dionysus69: has joined #RubyOnRails
[16:14:30] froyo1: The response is just "post_removed();"
[16:14:44] tbuehlmann: okay, great. what does the javascript console say?
[16:15:59] froyo1: the console is blank
[16:17:01] psethi: has joined #RubyOnRails
[16:18:03] nertzy: has joined #RubyOnRails
[16:18:13] tbuehlmann: okay, can you try this? https://gist.github.com/tbuehlmann/0c83748d920c802e06f2b9e4f12498f6#file-posts_controller-rb-L10-L12
[16:20:43] Technodrome: has joined #RubyOnRails
[16:21:40] froyo1: not working :/
[16:22:07] froyo1: it's funny because i have the same setup for another action named add_to_collection, which works just fine
[16:22:43] tbuehlmann: I think I can't help without actually playing with the code
[16:22:56] jhack: has joined #RubyOnRails
[16:23:19] shinnya: has joined #RubyOnRails
[16:23:44] froyo1: Is the response fine? Is it supposed to be just "post_removed();"?
[16:24:24] SteenJobs: has joined #RubyOnRails
[16:24:29] tbuehlmann: sure, that's what you tell it
[16:29:40] froyo1: i deleted the function from the .js.erb, yet i see nothing in the javascript conosle
[16:31:30] roamingdog: has joined #RubyOnRails
[16:33:13] ajruiz_: has joined #RubyOnRails
[16:38:34] blackmesa: has joined #RubyOnRails
[16:43:57] tenderlove: has joined #RubyOnRails
[16:58:23] psethi: has joined #RubyOnRails
[17:04:19] User458764: has joined #RubyOnRails
[17:06:42] Pumukel: has joined #RubyOnRails
[17:06:53] Or1on: has joined #RubyOnRails
[17:08:30] pankaj: has joined #RubyOnRails
[17:09:04] SteenJobs: has joined #RubyOnRails
[17:09:41] mnms_: has joined #RubyOnRails
[17:11:02] fernandomm: has joined #RubyOnRails
[17:11:11] mnms_: Hi :) Does .joins can load associated data to not execute subqueries?
[17:14:17] Cohedrin: has joined #RubyOnRails
[17:19:13] Fernando-Basso: has joined #RubyOnRails
[17:21:01] ace05: has joined #RubyOnRails
[17:22:04] matthewd: mnms_: .includes will avoid N+1 queries
[17:23:27] mnms_: matthewd: it should execute two queries?
[17:25:39] bronson: has joined #RubyOnRails
[17:30:04] marcules: has joined #RubyOnRails
[17:30:45] SteenJobs: has joined #RubyOnRails
[17:31:02] NoGodDamnIdea: has joined #RubyOnRails
[17:31:02] NoGodDamnIdea: has joined #RubyOnRails
[17:32:20] Technodrome: has joined #RubyOnRails
[17:39:28] hive-mind: has joined #RubyOnRails
[17:40:31] gambl0re: has joined #RubyOnRails
[17:41:42] greengriminal: has joined #RubyOnRails
[17:42:17] marcdel: has joined #RubyOnRails
[17:42:32] byteflame: has joined #RubyOnRails
[17:52:45] lxsameer: has joined #RubyOnRails
[17:56:02] cseder: has joined #RubyOnRails
[17:59:44] Aherin: has joined #RubyOnRails
[18:00:12] User458764: has joined #RubyOnRails
[18:05:03] sypheren: has joined #RubyOnRails
[18:05:29] Technodrome: has joined #RubyOnRails
[18:07:04] srinidhi: has joined #RubyOnRails
[18:07:27] Rodya_: has joined #RubyOnRails
[18:10:47] ImmoveableOne: has joined #RubyOnRails
[18:12:08] d3d1rty: has joined #RubyOnRails
[18:13:01] ImmoveableOne: I am having a tough time writing tests for this (http://stackoverflow.com/questions/43029149/how-do-i-test-a-controller-action-in-rails-that-reads-a-csv-from-a-remote-source)
[18:13:56] dannyh: has joined #RubyOnRails
[18:25:39] Rodya_: has joined #RubyOnRails
[18:40:21] Rodya_: has joined #RubyOnRails
[18:43:44] tbuehlmann: ImmoveableOne: what does "But this doesn't work" mean exactly?
[18:45:32] mooser: has joined #RubyOnRails
[18:46:05] Omnilord: has joined #RubyOnRails
[18:47:45] handicraftsman: has joined #RubyOnRails
[18:48:40] goldpank: has joined #RubyOnRails
[18:52:52] User458764: has joined #RubyOnRails
[18:57:47] flegent: has joined #RubyOnRails
[19:05:51] mooser: has joined #RubyOnRails
[19:08:11] jfelchner: has joined #RubyOnRails
[19:10:07] Pumukel: has joined #RubyOnRails
[19:14:29] zeddan: has joined #RubyOnRails
[19:21:45] SteenJobs: has joined #RubyOnRails
[19:26:35] bronson: has joined #RubyOnRails
[19:28:48] Tempesta: has joined #RubyOnRails
[19:30:50] Tempesta: has joined #RubyOnRails
[19:38:40] am55: has joined #RubyOnRails
[19:41:07] am55: i'm using the deep_cloneable gem, which I gather is like ameoba. It seems when saving parent and child objects using this gem, first the parent is saved, then rails gets a callback from the db with the id of the new record. then child object transactions are performed, and therefore they can be written with reference to new parent record
[19:42:04] am55: now I'm trying to do this all in one transaction with the activerecord-import gem
[19:42:05] pankaj: has joined #RubyOnRails
[19:42:57] am55: so in place of saving parent, I am adding parent (and deep_cloned objects...) to an array, and when it's all done I save the array
[19:43:42] am55: but this doesn't have desired effect, because the new parent id is never available when building the array
[19:44:59] am55: I don't know exactly what to call this problem. How to batch a large transaction when data within that transaction is needed to build the records to save?
[19:45:15] Jasaka: has joined #RubyOnRails
[19:47:14] roamingdog: has joined #RubyOnRails
[19:49:26] am55: because the child records need db autonumber from parent
[19:51:35] chouhoulis: has joined #RubyOnRails
[19:52:25] am55: has joined #RubyOnRails
[19:55:02] Rodya_: has joined #RubyOnRails
[20:02:11] pankaj: has joined #RubyOnRails
[20:06:00] apotry: has joined #RubyOnRails
[20:08:24] futilegames: has joined #RubyOnRails
[20:12:37] meoblast001: has joined #RubyOnRails
[20:19:19] eclm: has joined #RubyOnRails
[20:23:49] adavia: has joined #RubyOnRails
[20:26:25] armyriad: has joined #RubyOnRails
[20:29:52] eclm: has joined #RubyOnRails
[20:34:08] zeddan: has joined #RubyOnRails
[20:39:13] diggitydane: has left #RubyOnRails: ("Leaving")
[20:42:47] pwnd_nsfw: has joined #RubyOnRails
[20:43:17] zeddan: has joined #RubyOnRails
[20:45:02] armando: has joined #RubyOnRails
[20:50:31] matthewd: am55: You might be able to use the actual parent AR instance in place of the parent id, depending on how those libraries work
[20:51:49] am55: I think I'm doing that in my working one-at-a-time method
[20:52:42] am55: the deep_cloneable gem apparently uses after_save callback
[20:53:01] blackmesa: has joined #RubyOnRails
[20:53:34] am55: but there is no ar callback when saving the batch in one transaction, until it's done
[20:54:58] ejnahc_: has joined #RubyOnRails
[20:55:33] silverdust: has joined #RubyOnRails
[20:55:35] Olipro_: has joined #RubyOnRails
[20:55:40] am55: matthewd https://gist.github.com/anonymous/f78e4dc307b086d4b66b882d3b5826f6
[20:56:01] am55: that's working for saving parent and children one at a time
[20:57:20] matthewd: Line 14 isn't doing anything
[20:57:27] am55: matthewd batch attempt https://gist.github.com/anonymous/54c5e22b8651043cae8cc435d4c113d5
[21:01:13] spectra: has joined #RubyOnRails
[21:02:17] am55: oh thanks for mentioning that. so when I output batch instead of saving it, batch is a one-dimensional array of periods without services. I tried explicitly adding periods and services to the batch, but I think it will fail because like I said I don't have a parent_id for the child record. but I don't get an error in console.
[21:04:06] matthewd: Could you do the parents in one batch, then the children in a second one?
[21:04:36] SteenJobs: has joined #RubyOnRails
[21:04:52] am55: yeah I don't see why not. but I haven't yet thought about keeping track of all of that.
[21:06:01] am55: I would need to save all copies of parents, then map the new parents to the old, then search old for children, then copy old children to new parents...
[21:07:14] bronson: has joined #RubyOnRails
[21:08:02] am55: it felt messy to think of it that way so I was trying to avoid it
[21:08:42] matthewd: I don't see why you'd have a problem setting up relationships between unsaved records
[21:09:33] matthewd: If the issue is specific to the batch library you're using, then it's just in the final step that things are going awry, and this seems the simplest way of working around that
[21:11:40] pankaj: has joined #RubyOnRails
[21:12:50] am55: I think I identified the problem. old_parent has two old_children. new_parent = old_parent, but doesn't have an ID until saved, and therefore new_children can't have new_parent.ID until after_save. No?
[21:13:22] jpleau: has joined #RubyOnRails
[21:13:53] matthewd: They can't have the id, but that doesn't prevent them from having the relationship
[21:14:23] am55: how can they relate?
[21:14:27] Pumukel: has joined #RubyOnRails
[21:15:58] inkshark: has joined #RubyOnRails
[21:16:44] matthewd: I don't know how to answer that
[21:18:07] am55: wait, you said line 14 doesn't do anything? line 14 is making the relationship by inserting the id
[21:18:40] matthewd: No, it's not
[21:20:13] armando: has joined #RubyOnRails
[21:25:13] am55: oh you're right. that helps. i started doing that as part of the batch attempt and lost track of it.
[21:25:49] am55: can you say anything more about creating these new relationships before saving?
[21:26:21] am55: right now the relationship is an ar has_many/belongs_to association
[21:26:50] am55: are you suggesting an alternative to that?
[21:27:17] matthewd: a = Author.new name: "Bob"; b = Book.new title: "Hello world", author: a; a.save!; b.save!
[21:27:29] matthewd: Unless I'm entirely confused, that should work just fine
[21:28:29] inkshark: has joined #RubyOnRails
[21:30:12] am55: well i'm not naming these records. they have ids. so a period #123 has services #456, #457. When I copy period #123 and save it, it gets the next available number-say #700, and then I make copies of 123's services and tag them with #700. the new services get the next available numbers like 1001, 1002
[21:31:20] keerthana: has joined #RubyOnRails
[21:33:58] inkshark: has joined #RubyOnRails
[21:36:32] matthewd: We appear to have substantially differing understandings of how Active Record associations work
[21:38:10] am55: I think I'm just not being successful at brevity.
[21:39:06] am55: period.id 123, service.id 456, service.id 457
[21:39:13] am55: that's three records from two tables
[21:39:41] bronson: has joined #RubyOnRails
[21:39:48] am55: that's the source. period is the parent and service.id 456 has period.id 123 and same for service.id 457
[21:40:27] User458764: has joined #RubyOnRails
[21:40:33] matthewd: I understand what you're trying to do. We're disagreeing on whether it will work.
[21:40:40] am55: now I copy period.id 123, and it is saved and issued the next autonumber for the periods table--700
[21:41:49] am55: and when I save the copies of services, they get period.id 700. this works using the deep_cloneable gem because it handles the after_save callback and uses it to save the services after saving the new period
[21:42:24] am55: I'm lost about how to handle this in a batch except like you said, to save all the periods, then all the services
[21:43:09] am55: however, the batch gem (activerecord-import) is supposed to be able to recurse. I guess it would work for your author-book example because you are naming with the application. but in my case I'm naming with the db
[21:43:59] am55: well in your example you were manually setting author
[21:44:30] matthewd: Right.. but why don't / wouldn't you do that?
[21:45:25] am55: for the same reason invoice numbers are incremented numbers and not names
[21:45:44] armando: has joined #RubyOnRails
[21:46:26] br0d1n: has joined #RubyOnRails
[21:46:38] am55: like a blog post with comments. comments relate to post_id, not post_name
[21:47:06] am55: I'm only saying this in case I'm missing something
[21:48:12] codelahoma: has joined #RubyOnRails
[21:48:19] br0d1n: has left #RubyOnRails: ()
[21:48:28] br0d1n: has joined #RubyOnRails
[21:54:19] jpleau: hi. I have a file 'test.xlsx' that I want the user to download, but the downloaded filename has to be different everytime. (It's a template, it's just to prevent the users from having to rename the file themselves). How can I send the 'test.xlsx' file to be downloaded as 'foo.xlsx' ?
[21:55:48] matthewd: am55: In my example, the two records are related by an author_id column in the books table
[21:55:53] psethi: has joined #RubyOnRails
[21:56:32] matthewd: jpleau: How are you currently sending the file?
[21:56:35] am55: but in my example, the author_id is not the same as new author_id
[21:57:16] jpleau: matthewd: I'm not currently sending the file. It's stored on the server somewhere.
[21:57:52] matthewd: am55: You're clearly very sure it can't work, so you should probably go with whatever solution you're comfortable with
[21:58:30] matthewd: jpleau: Okay, then have you tried to find a way of sending the file?
[21:58:57] SteenJobs: has joined #RubyOnRails
[21:59:14] gambl0re: has joined #RubyOnRails
[22:00:05] jpleau: Not really. Let me do that first
[22:00:55] Radar: GOOD MORNING
[22:00:57] am55: a better analogy is that i'm copying a blog post and its comments to make a new identical post and new identical comments. how to save new post and new comments in one transcation, when new comments need newpost.id for the relation
[22:01:57] am55: i'm guess the answer is that it must be 2 transactions, like you said at first
[22:03:26] mooser: has joined #RubyOnRails
[22:04:16] jpleau: matthewd: Yeah ok I found it, I wasn't aware there was a send_file method.
[22:07:45] matthewd: am55: Yes, I still understand what you are trying to do. But also yes, go with what you think will work.
[22:11:04] mnms_: has joined #RubyOnRails
[22:11:27] zeddan: has joined #RubyOnRails
[22:17:42] Ebok: has joined #RubyOnRails
[22:23:39] armando: has joined #RubyOnRails
[22:33:30] inkshark: has joined #RubyOnRails
[22:40:56] matcouto: has joined #RubyOnRails
[22:41:26] bronson: has joined #RubyOnRails
[22:45:14] blackmesa: has joined #RubyOnRails
[22:49:25] armando: has joined #RubyOnRails
[22:49:54] jottr: has joined #RubyOnRails
[23:00:29] fmartingr: has joined #RubyOnRails
[23:01:07] codelahoma: has joined #RubyOnRails
[23:11:34] User458764: has joined #RubyOnRails
[23:18:42] roamingdog: has joined #RubyOnRails
[23:22:27] quazimodo: has joined #RubyOnRails
[23:31:49] User458764: has joined #RubyOnRails
[23:37:10] Kallis: has joined #RubyOnRails
[23:37:21] Jasaka|NA: has joined #RubyOnRails
[23:39:42] mchelen2: has left #RubyOnRails: ()
[23:42:11] bronson: has joined #RubyOnRails
[23:53:24] Rodya_: has joined #RubyOnRails