« Back to channel list

#RubyOnRails - 09 March 2017

« Back 1 day Forward 1 day »
[00:00:32] Derperperd: has joined #RubyOnRails
[00:02:15] benlieb: has joined #RubyOnRails
[00:06:54] cschneid_: has joined #RubyOnRails
[00:11:56] duderono_: has joined #RubyOnRails
[00:26:48] sid_fules: has joined #RubyOnRails
[00:26:54] pur3eval: has joined #RubyOnRails
[00:27:58] srinidhi: has joined #RubyOnRails
[00:30:04] hahuang65: has joined #RubyOnRails
[00:31:17] nacsurte: has joined #RubyOnRails
[00:35:18] Derperperd: has joined #RubyOnRails
[00:35:43] roadrunneratwast: has joined #RubyOnRails
[00:37:18] sam`: epochwolf: not much
[00:37:39] sam`: epochwolf: but i somewhat expected this to be abstracted away for me by mongoid-history
[00:37:59] sam`: epochwolf: (i should point out that i'm not at all a ruby and ror person, i'm just trying to troubleshoot something)
[00:38:14] banisterfiend: has joined #RubyOnRails
[00:39:34] jhack: has joined #RubyOnRails
[00:40:20] anicma: has joined #RubyOnRails
[00:44:21] jhack: Anyone know how I can fix this issue? https://gist.github.com/jhack32/8cc9d738857622b2c3419c2972e35419
[00:45:40] anicma: hi everyone! I came to this channel because I need help about developing an app! Is this channel the right one to ask about rails coding?
[00:46:11] SteenJobs: has joined #RubyOnRails
[00:47:31] envint: has joined #RubyOnRails
[00:48:35] brent__: has joined #RubyOnRails
[00:50:36] cschneid_: has joined #RubyOnRails
[00:53:31] havenwood: anicma: Yup, this is the place.
[00:53:46] choke: has joined #RubyOnRails
[00:54:02] havenwood: anicma: Or the #ruby channel for Ruby-related questions.
[00:54:38] havenwood: anicma: Welcome!
[00:55:06] Nicmavr: has joined #RubyOnRails
[00:55:50] Guest83939: has joined #RubyOnRails
[00:56:25] havenwood: jhack: This would be a good opportunity to upgrade from Ruby 2.3.1 to 2.3.3!
[00:56:40] jhack: Yeah.. but, its a client project :|
[00:56:44] jhack: and requires 2.3.1
[00:56:57] havenwood: jhack: It looks like the dynamic link to OpenSSL is broken. 2.3.3 is entirely compatible with 2.3.1.
[00:57:18] havenwood: jhack: You could also reinstall Ruby 2.3.1.
[00:57:26] jhack: I’ve tried that, and it didn’t seem to work
[00:57:28] havenwood: jhack: Just update ruby-build first, in case.
[00:57:32] sid_fules: has joined #RubyOnRails
[00:57:42] jhack: oh.., that I haven’t done. I just did rbenv install 2.3.1
[00:57:55] havenwood: jhack: Unfortunately, ruby-build ships its own OpenSSL on a per-Ruby basis.
[00:58:04] havenwood: You have to update ruby-build to get a new OpenSSL.
[00:58:14] jhack: Is that through rbenv upgrade ruby-build ?
[00:58:41] havenwood: nope, it's a standalone tool
[00:58:48] havenwood: jhack: what OS/distro?
[00:58:56] jhack: El capitan
[00:59:04] havenwood: jhack: brew upgrade ruby-build
[00:59:26] jhack: interesting
[00:59:53] havenwood: jhack: Or you can use ruby-install and put Ruby where rbenv wants it: brew install ruby-install && ruby-install --latest --install-dir ~/.rbenv/versions/2.3.1 ruby 2.3.1
[00:59:55] jhack: so it just updated, and ill run the rbenv install again on ruby
[01:00:13] havenwood: jhack: That ^ will use the latest brew package OpenSSL.
[01:00:14] someish: has joined #RubyOnRails
[01:00:18] havenwood: jhack: Good luck!
[01:00:31] jhack: havenwood: Thanks!
[01:00:55] anicma: Yeah!! Thank you very much guys!! Well this is my question, I know rails controls id which very helpful in some cases! The point is I need to create a custom ID that the user configures the format of the ID eg. YYYY-ABCD-######### where YYYY is the current year, ABCD, Sufix, number, or anything, and #### is an unique serial!! I've been thinking how I can resolve that but no Idea how! Thanks guys
[01:02:38] havenwood: anicma: The FriendlyId gem is one option to look at: https://github.com/norman/friendly_id#readme
[01:04:22] xaviergmail_: has joined #RubyOnRails
[01:05:46] havenwood: anicma: You can also make your primary keys uuids quite easily in Rails 5, if you are okay with a straight-up UUID.
[01:05:55] havenwood: anicma: That would be much less fuss.
[01:06:22] havenwood: anicma: What's your db?
[01:06:23] anicma: UUIDS is an excellent option,
[01:07:51] anicma: In this time i'm using SQLite, but the app is going to use postgres or oracle in the future
[01:11:47] mrgreenfur: has joined #RubyOnRails
[01:11:52] anicma: havenwood: I'm using rails 4, I've been out from rail for 1 year, and rails keep upgrading very fast! :) which is good but I need to check the new version!
[01:11:57] timdotrb: has joined #RubyOnRails
[01:12:05] havenwood: anicma: Postgres can do uuids with little fuss, I think you need the activeuuid gem with SQLite, and I imagine Oracle database has something along those lines.
[01:12:42] jhack: havenwood: hmm, doesn’t look like both options I’ve tried work
[01:13:17] Trynemjoel: has joined #RubyOnRails
[01:13:22] SteenJobs: has joined #RubyOnRails
[01:13:31] havenwood: jhack: FriendlyId would let you get them just like you want them. Maybe compare that to pure uuid option.
[01:13:41] nhanpc: has joined #RubyOnRails
[01:13:46] havenwood: jhack: oops, got convos confused
[01:14:20] anicma: havewood: I think is a great idea to use UUID because is a document management system which is going to generate many docs however one of the requirements is what I said before!
[01:14:30] havenwood: jhack: You tried installing with ruby-install for rbenv? Show the new error?
[01:14:41] jhack: It’s the same error
[01:14:53] jhack: I’ve tried the command you’ve given me as well
[01:16:00] mrgreenfur: Anyone have any advice for DRYing controllers? I have a dashboard controlelr that sets a lot of variables that I need to duplicate into another controller; concerns don’t work so good for setting instance variables unfortunately
[01:16:26] pawnbox: has joined #RubyOnRails
[01:16:41] anicma: havenwood: Thank you very much for your help I will check FriendlyId, where can I check the differences between rails 4 and 5?
[01:17:34] havenwood: anicma: http://weblog.rubyonrails.org/2016/6/30/Rails-5-0-final/
[01:18:00] havenwood: anicma: http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-4-2-to-rails-5-0
[01:19:02] anicma: havenwood: thanks a lot for your help!! :)
[01:19:03] jordan87: has joined #RubyOnRails
[01:19:53] jhack: havenwood: should i uninstall 2.3.1 and then install 2.3.1 again?
[01:20:03] jhack: I just did an overwrite instead of uninstalling it previously
[01:20:45] havenwood: jhack: Maybe `rm -rf ~/.rbenv` and install from scratch. Switch to chruby while you're at it. ;-)
[01:21:03] havenwood: jhack: I think it's a good idea to install fresh.
[01:21:30] Scriptonaut: has joined #RubyOnRails
[01:21:30] havenwood: jhack: And update/upgrade all your brew packages, especially OpenSSL.
[01:21:39] havenwood: (before building ruby)
[01:21:44] jenrzzz: has joined #RubyOnRails
[01:21:44] jenrzzz: has joined #RubyOnRails
[01:23:21] Scriptonaut: has left #RubyOnRails: ()
[01:24:15] alex88: has joined #RubyOnRails
[01:24:42] mrgreenfur: Oh nevermind, normal ruby modules work great :)
[01:28:18] sid_fules: has joined #RubyOnRails
[01:29:30] fourcolors: has joined #RubyOnRails
[01:35:06] mikeiniowa: has joined #RubyOnRails
[01:37:38] safetypin: has joined #RubyOnRails
[01:41:30] hotpancakes: has joined #RubyOnRails
[01:42:47] gusrub: has joined #RubyOnRails
[01:43:51] fourcolors: has joined #RubyOnRails
[01:46:08] pawnbox: has joined #RubyOnRails
[01:49:22] pwnd_nsfw`: has joined #RubyOnRails
[01:52:26] planigan: has joined #RubyOnRails
[01:54:43] Jameser: has joined #RubyOnRails
[01:56:57] safetypin: has joined #RubyOnRails
[01:58:18] jhack: has joined #RubyOnRails
[01:58:29] nyaa: has joined #RubyOnRails
[01:59:03] sid_fules: has joined #RubyOnRails
[01:59:23] nyaa: has joined #RubyOnRails
[01:59:29] safetypin: has joined #RubyOnRails
[02:00:22] harfangk: has joined #RubyOnRails
[02:01:55] fourcolors: has joined #RubyOnRails
[02:02:30] pickle_: has joined #RubyOnRails
[02:09:19] brent__: has joined #RubyOnRails
[02:11:47] pickle_: has left #RubyOnRails: ()
[02:15:39] pur3eval: has joined #RubyOnRails
[02:20:21] AndrewIsHere: has joined #RubyOnRails
[02:21:24] eforbes: has joined #RubyOnRails
[02:21:24] Flakeparadigm: has joined #RubyOnRails
[02:24:16] superlou: has joined #RubyOnRails
[02:25:22] Suslov: has joined #RubyOnRails
[02:28:00] dps: has joined #RubyOnRails
[02:28:01] froglegs: has joined #RubyOnRails
[02:29:47] sid_fules: has joined #RubyOnRails
[02:30:06] eclecticjohny: has joined #RubyOnRails
[02:35:18] pickle_: has joined #RubyOnRails
[02:40:58] benlieb: has joined #RubyOnRails
[02:42:38] brent__: has joined #RubyOnRails
[02:42:42] fourcolors: has joined #RubyOnRails
[02:45:37] nyanz: has joined #RubyOnRails
[02:47:06] jdm: has joined #RubyOnRails
[02:51:55] pabloh: has joined #RubyOnRails
[02:52:11] SteenJobs: has joined #RubyOnRails
[02:55:19] pickle_: has left #RubyOnRails: ()
[02:55:50] itsautomatisch: has joined #RubyOnRails
[02:57:25] fourcolors: has joined #RubyOnRails
[02:58:38] marcdel: has joined #RubyOnRails
[03:04:37] libastral: has joined #RubyOnRails
[03:06:08] nOwz: has joined #RubyOnRails
[03:07:39] fourcolors: has joined #RubyOnRails
[03:11:03] LBRapid: has joined #RubyOnRails
[03:12:30] fourcolors: has joined #RubyOnRails
[03:13:22] Suslov: has joined #RubyOnRails
[03:15:15] pickle_: has joined #RubyOnRails
[03:15:34] Tempesta: has joined #RubyOnRails
[03:15:56] sid_fules: has joined #RubyOnRails
[03:17:46] irishfromua: has joined #RubyOnRails
[03:21:09] duderonomy: has joined #RubyOnRails
[03:25:11] fourcolors: has joined #RubyOnRails
[03:25:16] marcdel: has joined #RubyOnRails
[03:25:32] pawnbox: has joined #RubyOnRails
[03:30:56] pwnd_nsfw`: has joined #RubyOnRails
[03:32:06] pickle_: has joined #RubyOnRails
[03:32:58] brendan-: has joined #RubyOnRails
[03:33:47] Suslov: has joined #RubyOnRails
[03:34:53] froglegs: has joined #RubyOnRails
[03:35:40] Suslo: has joined #RubyOnRails
[03:39:40] k_lashnikov: has joined #RubyOnRails
[03:41:13] k_lashnikov: has left #RubyOnRails: ()
[03:43:23] pickle_: has joined #RubyOnRails
[03:44:05] fourcolors: has joined #RubyOnRails
[03:45:22] jeyraof^mbpr: has joined #RubyOnRails
[03:46:40] sid_fules: has joined #RubyOnRails
[03:48:01] ResidentBiscuit: has joined #RubyOnRails
[03:52:12] bga57: has joined #RubyOnRails
[03:52:14] Derperperd: has joined #RubyOnRails
[03:52:37] djbkd: has joined #RubyOnRails
[03:53:52] nyaa: has joined #RubyOnRails
[03:55:33] pawnbox: has joined #RubyOnRails
[04:01:54] pickle_: has joined #RubyOnRails
[04:04:23] pur3eval: has joined #RubyOnRails
[04:05:12] pulkit4tech: has joined #RubyOnRails
[04:06:39] skang: has joined #RubyOnRails
[04:11:14] jenrzzz: has joined #RubyOnRails
[04:16:52] pickle_: has joined #RubyOnRails
[04:17:02] djbkd: has joined #RubyOnRails
[04:17:23] sid_fules: has joined #RubyOnRails
[04:18:01] pur3eval: has joined #RubyOnRails
[04:28:25] Jameser`: has joined #RubyOnRails
[04:29:03] ResidentBiscuit: has joined #RubyOnRails
[04:29:46] _3dwardsharp: has joined #RubyOnRails
[04:31:24] pickle_: has left #RubyOnRails: ()
[04:31:56] Suslov: has joined #RubyOnRails
[04:34:10] pickle__: has joined #RubyOnRails
[04:42:25] pawnbox: has joined #RubyOnRails
[04:48:10] sid_fules: has joined #RubyOnRails
[04:50:22] froglegs: has joined #RubyOnRails
[04:59:20] pwnd_nsfw: has joined #RubyOnRails
[04:59:43] fourcolors: has joined #RubyOnRails
[05:04:48] boog: has joined #RubyOnRails
[05:07:00] nOwz: has joined #RubyOnRails
[05:09:48] weaksauce: has joined #RubyOnRails
[05:12:01] tvw: has joined #RubyOnRails
[05:13:48] DTZOZU: has joined #RubyOnRails
[05:14:25] pawnbox_: has joined #RubyOnRails
[05:14:38] hotpancakes: has joined #RubyOnRails
[05:18:58] sid_fules: has joined #RubyOnRails
[05:19:56] itsgokul: has joined #RubyOnRails
[05:20:23] djbkd: has joined #RubyOnRails
[05:23:12] chatter29: has joined #RubyOnRails
[05:23:22] chatter29: has left #RubyOnRails: ()
[05:29:30] jenrzzz: has joined #RubyOnRails
[05:29:31] jenrzzz: has joined #RubyOnRails
[05:47:01] hotpanca_: has joined #RubyOnRails
[05:48:03] echosystm: has joined #RubyOnRails
[05:48:17] echosystm: i need to add a command to my rails project that i can run from command line
[05:48:24] fragamus: has joined #RubyOnRails
[05:48:28] echosystm: it's a kind of background job that needs to run at all times
[05:48:43] echosystm: but it needs full access to the rails environment (models etc)
[05:48:47] echosystm: whats the best way to do this?
[05:49:06] echosystm: note that i don't want to use resque or sidekiq or anything like that
[05:49:09] matthewd: echosystm: require 'config/environment'
[05:49:31] echosystm: matthewd: where do i put the actual script?
[05:49:43] sid_fules: has joined #RubyOnRails
[05:49:56] echosystm: and also how do it generate binstubs or something like htat?
[05:49:59] matthewd: Where-ever you like
[05:53:31] echosystm: how do i run it matthewd ?
[05:55:22] aperkins81: echosystm, another method could be rake tasks .. we stick ours in lib/tasks .. then you go RAILS_ENV=production bundle exec rake name_of_task .. http://www.stuartellis.name/articles/rake/
[05:55:36] dminuoso: aperkins81: You shouldn't want a permanent thing running like that.
[05:55:49] dminuoso: echosystm: Do it the same way you handle starting your puma/unicorn
[05:55:49] aperkins81: binstubs better?
[05:57:40] matthewd: You can just write it as a bin file, or you can even run in through `rails runner`, which will load the environment for you
[05:58:22] fourcolors: has joined #RubyOnRails
[05:59:16] boog: has joined #RubyOnRails
[05:59:59] boog: has joined #RubyOnRails
[06:01:31] noobcake: has joined #RubyOnRails
[06:02:25] quazimodo: has joined #RubyOnRails
[06:05:01] pawnbox: has joined #RubyOnRails
[06:12:13] eforbes: has joined #RubyOnRails
[06:15:44] zero1one0: has joined #RubyOnRails
[06:16:06] pawnbox: has joined #RubyOnRails
[06:16:15] fourcolors: has joined #RubyOnRails
[06:17:16] jenrzzz: has joined #RubyOnRails
[06:20:05] tildes: has joined #RubyOnRails
[06:20:12] echosystm: thanks matthewd forgot about rails runner!
[06:20:20] Cohedrin: has joined #RubyOnRails
[06:27:04] Omnilord: has joined #RubyOnRails
[06:30:42] pLaTo0n: has joined #RubyOnRails
[06:34:58] hahuang65: has joined #RubyOnRails
[06:35:01] itsgokul: has joined #RubyOnRails
[06:35:09] havenwood: has joined #RubyOnRails
[06:35:09] havenwood: has joined #RubyOnRails
[06:35:38] quazimodo: has joined #RubyOnRails
[06:36:02] xall: has joined #RubyOnRails
[06:36:48] aaronm04: has joined #RubyOnRails
[07:02:01] hotpancakes: has joined #RubyOnRails
[07:02:25] Suslov: has joined #RubyOnRails
[07:03:34] deweysdecimal: has joined #RubyOnRails
[07:05:54] deweysdecimal: has joined #RubyOnRails
[07:07:12] am55: has joined #RubyOnRails
[07:07:12] am55: has joined #RubyOnRails
[07:07:32] nOwz: has joined #RubyOnRails
[07:07:51] pawnbox: has joined #RubyOnRails
[07:09:40] naftilos76: has joined #RubyOnRails
[07:17:57] tildes: has joined #RubyOnRails
[07:18:59] DaniG2k: has joined #RubyOnRails
[07:20:49] djbkd: has joined #RubyOnRails
[07:24:23] gbailey: has joined #RubyOnRails
[07:26:42] nOwz: has joined #RubyOnRails
[07:26:56] Voxxit: has joined #RubyOnRails
[07:27:34] _3dwardsharp: has joined #RubyOnRails
[07:29:25] xall: has joined #RubyOnRails
[07:33:34] xall: has joined #RubyOnRails
[07:35:03] conta: has joined #RubyOnRails
[07:39:57] patarr: has joined #RubyOnRails
[07:40:59] conta: has joined #RubyOnRails
[07:44:32] knight_: has joined #RubyOnRails
[07:45:02] pulkit4tech: has joined #RubyOnRails
[07:45:26] ekem: has joined #RubyOnRails
[07:47:20] artto: has joined #RubyOnRails
[07:49:52] tofutoon: has left #RubyOnRails: ()
[07:57:38] AzaToth: has joined #RubyOnRails
[08:02:04] aganov: has joined #RubyOnRails
[08:02:42] okdas: has joined #RubyOnRails
[08:02:42] okdas: has joined #RubyOnRails
[08:07:05] artto: has joined #RubyOnRails
[08:08:22] xall: has joined #RubyOnRails
[08:09:23] hotpancakes: has joined #RubyOnRails
[08:10:12] jlebrech_: has joined #RubyOnRails
[08:12:33] dionysus69: has joined #RubyOnRails
[08:14:37] Suslov: has joined #RubyOnRails
[08:14:58] zpe: has joined #RubyOnRails
[08:15:34] arBmind: has joined #RubyOnRails
[08:19:16] okdas: has joined #RubyOnRails
[08:19:17] okdas: has joined #RubyOnRails
[08:20:42] KnownSyntax: has joined #RubyOnRails
[08:22:47] xall: has joined #RubyOnRails
[08:23:10] mrbubbles: has joined #RubyOnRails
[08:23:35] mrbubbles: has joined #RubyOnRails
[08:25:23] xcesariox: has joined #RubyOnRails
[08:26:08] bruce_lee: has joined #RubyOnRails
[08:31:30] mark_66: has joined #RubyOnRails
[08:34:28] tildes: has joined #RubyOnRails
[08:34:33] antgel: has joined #RubyOnRails
[08:35:09] pwnd_nsfw`: has joined #RubyOnRails
[08:38:56] nettoweb: has joined #RubyOnRails
[08:40:03] fourcolors: has joined #RubyOnRails
[08:44:11] kaejr: has joined #RubyOnRails
[08:44:28] kaejr: Is there a way where I can validate parameters with a form_tag?
[08:46:35] vasilakisFiL: has joined #RubyOnRails
[08:47:24] xcesariox: has joined #RubyOnRails
[08:47:26] vasilakisFiL: I had seen a tool that was like travis CI but would allow you to add whatever backend you wanted to run the tests (like EC2 instances).. is there any chance anyone knows what I am talking about ? I have been googling all day but I can't find it
[08:48:16] xall: has joined #RubyOnRails
[08:50:40] pawnbox: has joined #RubyOnRails
[08:51:14] okdas: has joined #RubyOnRails
[08:51:14] okdas: has joined #RubyOnRails
[09:05:52] irishfromua: has joined #RubyOnRails
[09:07:51] fourcolors: has joined #RubyOnRails
[09:08:53] mikecmpbll: has joined #RubyOnRails
[09:10:50] jsrn_: has joined #RubyOnRails
[09:13:31] fourcolors: has joined #RubyOnRails
[09:14:44] arBmind: has joined #RubyOnRails
[09:15:28] Violentr: has joined #RubyOnRails
[09:17:13] pawnbox: has joined #RubyOnRails
[09:19:03] fourcolors: has joined #RubyOnRails
[09:21:20] hotpancakes: has joined #RubyOnRails
[09:22:46] zpe: has joined #RubyOnRails
[09:24:28] tdy: has joined #RubyOnRails
[09:26:01] fourcolors: has joined #RubyOnRails
[09:26:09] zpe: has joined #RubyOnRails
[09:27:55] lxsameer: has joined #RubyOnRails
[09:28:14] Fridtjof: has joined #RubyOnRails
[09:28:48] artto: has joined #RubyOnRails
[09:29:30] ResidentBiscuit: has joined #RubyOnRails
[09:33:03] tedwing: has joined #RubyOnRails
[09:34:36] nettoweb: has joined #RubyOnRails
[09:35:29] someish: has joined #RubyOnRails
[09:35:44] igunublue[m]: has joined #RubyOnRails
[09:39:10] nOwz: has joined #RubyOnRails
[09:40:50] zpe: has joined #RubyOnRails
[09:40:57] patarr: has joined #RubyOnRails
[09:43:37] artto_: has joined #RubyOnRails
[09:45:53] asjern: has joined #RubyOnRails
[09:45:55] asjern: I want to add validation on a form tag like so: <% if params[:email][:address].empty? %><div class="row"><p>Email field is required!</p></div><% end %> but I get undefined method `[]' for nil:NilClass, which is kind of obvious because I haven't submitted the form yet. Any tips on how to fix this? I'm kinda blank right now :/
[09:49:39] Terens: has joined #RubyOnRails
[09:50:22] asjern: any tips?
[09:55:42] tbuehlmann: asjern: do you have an actual object in your form or do you have a bunch of text_field_tags?
[09:55:52] pawnbox: has joined #RubyOnRails
[09:56:18] Sigyn: has joined #RubyOnRails
[09:57:11] asjern: @tbueh1mann text_field and email_field
[10:00:03] zpe: has joined #RubyOnRails
[10:00:35] tbuehlmann: and you're not creating an active record model with this, right?
[10:01:16] zpe: has joined #RubyOnRails
[10:02:03] aganov: has joined #RubyOnRails
[10:04:23] asjern: @tbuehlmann no
[10:05:05] fourcolors: has joined #RubyOnRails
[10:05:49] tbuehlmann: several options here: have a form object or custom (tableless) model for the form which has the attributes and validations you need. you could then display validation errors when errors are present. that's what I'd do
[10:06:19] pawnbox: has joined #RubyOnRails
[10:06:21] dminuoso: To FixedDataTable or not to FixedDataTable, that is the question.
[10:06:24] tbuehlmann: you can also just check `if params[:email] && params[:email][:address].empty?`
[10:06:47] dminuoso: Would you folks ransack API endpoints?
[10:06:59] dminuoso: Or handcode each possible parameter for searching?
[10:07:00] asjern: I currently have your second option yes, but how can I say "fill in email" or fill in "name" because then I just check if params are not empty
[10:07:58] dminuoso: I'm thinking to ransack but with partial whitelisting on the possible (so that I restrict the attribute names but not the matchers)
[10:08:06] dminuoso: .. parameters
[10:08:19] dminuoso: in effect allowing city_name_*
[10:08:21] dminuoso: for example
[10:08:44] tbuehlmann: asjern: I don't understand. if you have that if condition, what's missing?
[10:08:47] sid_fules: has joined #RubyOnRails
[10:09:57] asjern: Because I want to explicitly say; Your first name is required. And if I check with `params[:email][:address]` etc. I can't say your email is required right?
[10:10:10] asjern: I can only just return a notice which is saying fill in all fields
[10:11:00] asjern: Or am I able to do something like notice: "Please fill in field #{params[:name]}"?
[10:12:16] pawnbox: has joined #RubyOnRails
[10:12:27] tbuehlmann: I find that tedious, you should consider having a custom model or form object
[10:13:16] asjern: Allright, thanks ^^
[10:13:31] marr: has joined #RubyOnRails
[10:15:26] quazimodo: has joined #RubyOnRails
[10:18:43] artto: has joined #RubyOnRails
[10:19:52] Cork: can t.remove in change_table be reversable?
[10:20:12] Cork: or must one use def up/def down?
[10:23:10] SanguineAnomaly: has joined #RubyOnRails
[10:24:52] dminuoso: 11:10 < asjern> Or am I able to do something like notice: "Please fill in field #{params[:name]}"?
[10:24:56] dminuoso: You kind of can actually.
[10:27:41] workmad3: has joined #RubyOnRails
[10:30:15] fnewq: has joined #RubyOnRails
[10:30:37] fnewq: Is it possible to see which condition failed? (if VALID_EMAIL_REGEX == 0 && !required_fields.empty?) I want to return custom messages for each
[10:30:54] artto: has joined #RubyOnRails
[10:31:00] Cork: fnewq: then you need separate if cases
[10:31:09] conta: has joined #RubyOnRails
[10:34:11] dminuoso: fnewq: use the errors interface.
[10:35:08] fnewq: @dminuoso, errors interface?
[10:35:16] dminuoso: jsrn_: if(VALID_EMAIL_REGEX == 0); errors.add(:email, :invalid) end if(required_fields.empty); errors.add(:form, :needs_more); end;
[10:35:26] dminuoso: fnewq: http://api.rubyonrails.org/classes/ActiveModel/Errors.html
[10:35:41] dminuoso: fnewq: And try to split it into multiple validators.
[10:40:31] SimpleIRC_VLBcT: has joined #RubyOnRails
[10:49:45] zpe: has joined #RubyOnRails
[10:54:20] jenrzzz: has joined #RubyOnRails
[10:54:20] jenrzzz: has joined #RubyOnRails
[10:57:26] dangerousdave: has joined #RubyOnRails
[10:58:44] ariedler: has joined #RubyOnRails
[10:59:27] Terens: has joined #RubyOnRails
[11:02:24] solars: has joined #RubyOnRails
[11:02:48] rakesh_verma: has joined #RubyOnRails
[11:04:02] rakesh_verma: I need to store data coming from an API in a JSON file at local for faster searching and hence need to use that file as database. How can I add a local file as database in RoR. I can add that as host in database.yml but what would be adapter?
[11:04:15] solars: hi, I've got a controller streaming csv which suddenly stops at around 411k lines, although the result contains 1,3million - does anyone have an idea why? https://gist.github.com/solars/c5706f9e0e2ed31386c68fd737bbc139
[11:08:55] cschneid_: has joined #RubyOnRails
[11:14:23] pawnbox: has joined #RubyOnRails
[11:16:26] quazimodo: has joined #RubyOnRails
[11:16:49] gregf_: has joined #RubyOnRails
[11:17:46] ferr1: has joined #RubyOnRails
[11:22:32] Derperperd: has joined #RubyOnRails
[11:23:31] dminuoso: Let's say you have a react routed application, how would you produce a link from a static rails view into the react application?
[11:23:57] tvw: has joined #RubyOnRails
[11:23:59] dminuoso: Im thinking a custom helper that generates a special <a> tag but with an event handler that calls .stopPropagation() and uses browserHistory.push(linkTarget) instead.
[11:25:45] pawnbox: has joined #RubyOnRails
[11:25:56] hotpancakes: has joined #RubyOnRails
[11:30:13] srinidhi: has joined #RubyOnRails
[11:30:24] ResidentBiscuit: has joined #RubyOnRails
[11:36:37] ldnunes: has joined #RubyOnRails
[11:39:05] artto: has joined #RubyOnRails
[11:41:44] patarr: has joined #RubyOnRails
[11:49:20] mikeiniowa: has joined #RubyOnRails
[11:50:03] tvw: has joined #RubyOnRails
[11:57:07] Jameser: has joined #RubyOnRails
[11:58:15] conta: has joined #RubyOnRails
[11:59:00] dps: has joined #RubyOnRails
[12:00:59] fourcolors: has joined #RubyOnRails
[12:03:21] nOwz: has joined #RubyOnRails
[12:04:01] nyaa: has joined #RubyOnRails
[12:06:07] pawnbox: has joined #RubyOnRails
[12:06:10] eforbes: has joined #RubyOnRails
[12:15:10] d0nn1e: has joined #RubyOnRails
[12:18:00] tildes: has joined #RubyOnRails
[12:18:08] artto: has joined #RubyOnRails
[12:23:23] Qchmqs: has joined #RubyOnRails
[12:32:46] artto: has joined #RubyOnRails
[12:39:29] habitullence: has joined #RubyOnRails
[12:39:33] tvw: has joined #RubyOnRails
[12:40:08] habitullence: Can someone tell me why resource :tests, :only => :update doesn’t create test_path(:id)?
[12:40:41] habitullence: From the routing docs looks like it should but I’m getting no method in tests.
[12:41:18] Jameser`: has joined #RubyOnRails
[12:44:32] habitullence: Never mind, going to be explicit. Rails seems to think that PATCH & PUT are interchangable anyway, which isn’t ideal.
[12:46:01] pLaTo0n: how can I change the output format in a view?
[12:46:07] pLaTo0n: for example dates or currencies
[12:48:11] dminuoso: pLaTo0n: say what?
[12:48:30] dminuoso: pLaTo0n: Use i18n
[12:50:56] nyaa: has joined #RubyOnRails
[12:56:00] pawnbox: has joined #RubyOnRails
[12:56:49] csk: has joined #RubyOnRails
[12:59:11] hotpancakes: has joined #RubyOnRails
[13:00:43] artto: has joined #RubyOnRails
[13:03:44] Jameser: has joined #RubyOnRails
[13:04:46] xall: has joined #RubyOnRails
[13:12:08] shinnya: has joined #RubyOnRails
[13:12:12] TvL2386: has joined #RubyOnRails
[13:13:51] tedwing: has joined #RubyOnRails
[13:15:54] pawnbox: has joined #RubyOnRails
[13:17:52] pawnbox_: has joined #RubyOnRails
[13:21:35] pawnbox: has joined #RubyOnRails
[13:24:04] fox_mulder_cp: pLaTo0n: i18n, strftime...
[13:24:37] Qchmqs: has joined #RubyOnRails
[13:26:38] itsautomatisch: has joined #RubyOnRails
[13:26:45] conta: has joined #RubyOnRails
[13:30:44] artto_: has joined #RubyOnRails
[13:32:09] hotpanca_: has joined #RubyOnRails
[13:33:09] nettoweb: has joined #RubyOnRails
[13:33:36] Ergo: has joined #RubyOnRails
[13:33:39] teddysmoker: has joined #RubyOnRails
[13:35:36] hotpancakes: has joined #RubyOnRails
[13:37:54] Derperperd: has joined #RubyOnRails
[13:39:26] teddysmoker: has joined #RubyOnRails
[13:40:57] knight33: has joined #RubyOnRails
[13:41:25] yigitsadic: has joined #RubyOnRails
[13:42:38] patarr: has joined #RubyOnRails
[13:48:34] pawnbox: has joined #RubyOnRails
[13:50:21] Jameser: has joined #RubyOnRails
[13:50:57] zpe: has joined #RubyOnRails
[13:53:59] chouhoulis: has joined #RubyOnRails
[13:55:36] patarr: has joined #RubyOnRails
[13:56:02] conta: has joined #RubyOnRails
[13:58:25] Jameser: has joined #RubyOnRails
[13:58:33] artto: has joined #RubyOnRails
[14:01:26] antgel: has joined #RubyOnRails
[14:03:28] doodlehaus: has joined #RubyOnRails
[14:04:09] pawnbox: has joined #RubyOnRails
[14:09:22] pLaTo0n: has joined #RubyOnRails
[14:16:58] ramortegui: has joined #RubyOnRails
[14:18:16] chouhoulis: has joined #RubyOnRails
[14:22:42] alaing: has joined #RubyOnRails
[14:23:53] alaing: how do i generate a string that is randomly between 1 and 5000 chars
[14:24:12] alaing: I dont mind if it just "a" 5000 times
[14:24:40] tbuehlmann: like this? 'a'*5000
[14:27:20] alaing: i'm sure there was some rails magic to make that more readable but i just cant remember what it was called
[14:27:52] epochwolf: 'a' * rand(5000) would do what you're asking.
[14:29:10] arywista: has joined #RubyOnRails
[14:29:33] adavia: has joined #RubyOnRails
[14:31:03] beingjohnm: I use postgresql and am going to start storing incoming emails processed with griddler. I should use column type jsonb to store an array of hashes, jsonb to store a hash, and text (with array: true) to store an array?
[14:31:57] ariedler: has joined #RubyOnRails
[14:32:45] DLSteve: has joined #RubyOnRails
[14:32:51] Derperperd: has joined #RubyOnRails
[14:33:15] sid_fules: has joined #RubyOnRails
[14:33:36] gloscombe: has joined #RubyOnRails
[14:38:44] ahrs: has joined #RubyOnRails
[14:48:57] cpruitt: has joined #RubyOnRails
[14:49:42] sid_fules: has joined #RubyOnRails
[14:50:41] Or1on: has joined #RubyOnRails
[14:50:56] rfoust: has joined #RubyOnRails
[14:52:53] fourcolors: has joined #RubyOnRails
[14:52:58] pLaTo0n: has joined #RubyOnRails
[14:53:17] solars: has joined #RubyOnRails
[14:53:43] Jameser: has joined #RubyOnRails
[14:54:04] solars: hi, how would I select records from a subquery returning ids, like this? Property.where(id: "select id from properties")
[14:54:38] artto: has joined #RubyOnRails
[14:54:54] epochwolf: solars: any reason you can't just write that as a join?
[14:54:56] arraveiesata: has joined #RubyOnRails
[14:55:35] matthewd: solars: What are you actually trying to do?
[14:55:58] solars: matthewd: epochwolf the actual subquery is a bit more complex, but it basically returns IDs of records that I'm interested in
[14:56:07] epochwolf: solars: Well, this should work: Message.where(user_id: Profile.select("user_id").where(gender: 'm'))
[14:56:15] solars: matthewd: I'm not sure how I would integrated such a query in an active record query
[14:56:33] matthewd: .where("id in (select id from properties)")
[14:56:54] arywista: has joined #RubyOnRails
[14:57:13] matthewd: (it's probably not the best solution to your problem, but if you just want a literal answer, there it is)
[14:57:37] solars: matthewd: ah that was obvious
[14:57:38] solars: I guess this works
[14:57:58] solars: I'm not sure if there is a nicer way actually
[14:58:00] epochwolf: solars: my solution does the same thing but keeps the protections of using active record.
[14:58:15] epochwolf: For example, sql injection.
[14:58:21] Takumo: has joined #RubyOnRails
[14:58:21] Takumo: has joined #RubyOnRails
[14:58:27] solars: epochwolf: I don't have the second query as AR/Arel, it's just a string
[14:58:46] matthewd: solars: That's why I asked for more details
[14:59:01] epochwolf: ah, then just interplote and pray you didn't inject unchecked input. :)
[14:59:09] solars: epochwolf: hmm maybe something like this would work as well: Property.select(id: Property.select("select id from properties"))
[14:59:13] solars: but it doesn't seem so
[14:59:33] solars: just for the sake of an example
[14:59:41] epochwolf: Yeah, that was incorrect syntax.
[14:59:43] solars: the subquery model would be a different table
[14:59:51] matthewd: I don't understand what's going on now
[15:00:03] epochwolf: It's Property.where() not Property.select()
[15:00:11] matthewd: I told you how to do the thing you want to do.. and you're trying to find a more obscure way of spelling it?
[15:00:23] solars: matthewd: haha don't let me confuse you sorry
[15:00:39] solars: matthewd: I was looking for a cleaner AR way, with where(id: ....)
[15:01:14] solars: nevermind, I confused myself, it's actually pretty clear
[15:01:17] matthewd: The cleaner way is to not use a raw query
[15:01:31] matthewd: If you're going to use a raw query, I have shown you the correct way to do it
[15:01:59] solars: matthewd: epochwolf: I was looking for something like: Item.where(property: Property.where(query_string))
[15:02:12] epochwolf: solars: that'll work just like that.
[15:02:14] solars: matthewd: replacing the sql string with arel is the second step
[15:02:19] solars: epochwolf: yeah I just realized
[15:02:25] epochwolf: solars: *pat*
[15:02:30] solars: thanks guys :)
[15:03:01] epochwolf: solars: you'll need to do Property.select("id").where() or it's going to barf. :)
[15:03:02] fox_mulder_cp: hi. somebody writes system service file for rails app operation?
[15:03:10] Guest6988: has joined #RubyOnRails
[15:03:20] matthewd: epochwolf: False
[15:03:45] solars: I think it does this automatically due to Model.select
[15:03:57] solars: Model.where, sorry
[15:04:02] epochwolf: matthewd: false?
[15:04:32] matthewd: epochwolf: No need for a select
[15:04:47] epochwolf: matthewd: it adds it automatically?
[15:04:57] brent__: has joined #RubyOnRails
[15:05:28] matthewd: Yeah, a `.where(column: relation)` filter uses the relation's PK by default
[15:05:39] epochwolf: ah, so you need a select when it's not the PK.
[15:07:03] matthewd: Yep... but IME you generally want the PK
[15:07:35] matthewd: (because that means you're using the right "base" class, which means you have its scopes available, etc)
[15:08:02] matthewd: More often the column you're matching for in the outer query won't be id, though
[15:08:51] epochwolf: It's been a while since I've used subqueries. I haven't done a lot of reports at this company. Previous job had all kinds of convoluted queries. Assuming the primary key for a subquery generally wasn't correct because we'd use the foriegn key from another table to skip loading the table that foreign key belonged to. :)
[15:09:13] cpruitt: solars: I’m a little late to the conversation but wanted to just add one point. Doing Item.where(property: Property.where(query_string)) will run two separate selects. Most times that’s OK but if you’re obsessive about keeping the number of queries down you might opt for entering using the where(“id IN (select …)”) method.
[15:09:22] xangria: has joined #RubyOnRails
[15:09:51] tycoon177: didn't even think about it and i did @course_sessions.each |session| and I didn't even think about the session hash ;-;
[15:09:54] xangria: has joined #RubyOnRails
[15:10:16] epochwolf: cpruitt: um... I don't think that's correct. Queries are lazy loaded. ActiveRecord should roll that into a single query.
[15:10:38] epochwolf: I'll load up a console and check that.
[15:10:55] cpruitt: epochwolf: Yeah I’d be interested in knowing that.
[15:12:40] epochwolf: [4] pry(main)> Transcript.where(sending_account_id: User.where(email: 'bob@example.com')).to_sql
[15:12:43] epochwolf: => "SELECT \"transcripts\".* FROM \"transcripts\" WHERE \"transcripts\".\"sending_account_id\" IN (SELECT \"users\".\"id\" FROM \"users\" WHERE \"users\".\"email\" = 'bob@example.com')"
[15:13:22] solars: yeah it's integrated in the other query
[15:13:26] solars: if you use .to_sql
[15:13:35] solars: that's the nice part about Arel :)
[15:13:37] SteenJobs: has joined #RubyOnRails
[15:13:44] epochwolf: cpruitt: in rails 2.3, yeah, it didn't work that way.
[15:14:03] epochwolf: I think Rails 3 added Arel and all this stuff got fancy.
[15:15:10] pwnd_nsfw`: pinky out queries
[15:16:37] cpruitt: epochwolf: LOL it didn’t even occur to me that Arel was Arel in this context. Thanks for the correction.
[15:16:46] n1lo: has joined #RubyOnRails
[15:16:50] pawnbox: has joined #RubyOnRails
[15:17:10] cpruitt: For some reason I had it in my head that AR was collecting the valued of the subquery & then inserting them, but it’s smarter than I thought.
[15:17:28] epochwolf: cpruitt: that's how it used to work back in Rails 2.3 :)
[15:17:38] pLaTo0n: has joined #RubyOnRails
[15:17:53] epochwolf: ActiveRecord is pretty explicit what operators trigger the query to execute.
[15:18:11] cpruitt: Oh, well then I don’t feel so bad. Since Rails 3 just came out I haven’t had any time to catch up on the new & fancy. ;-) j/k
[15:18:32] epochwolf: cpruitt: I work primarily on old rails applications. :(
[15:18:41] epochwolf: I'm always a major version or two behind.
[15:19:18] cpruitt: epochwolf: Most of mine are R4. I think I only have one R3 app left around.
[15:19:22] nettoweb: has joined #RubyOnRails
[15:19:42] epochwolf: cpruitt: I'm on the tail end of a 3->4 upgrade.
[15:19:59] epochwolf: Also a jruby 1.7 -> 9 upgrade.
[15:20:22] beingjohnm: anybody want to just confirm I'm would be going about storing arrays, hashes, and arrays of hashes properly in my question? Much appreciated.
[15:20:29] epochwolf: That one is pretty easy, except for a few broken gems... (fuck you uuid)
[15:21:16] matthewd: beingjohnm: It doesn't sound obviously wrong... though I'd at least *consider* using relations and associations over in-row arrays, for example.
[15:21:16] epochwolf: beingjohnm: if you're using jsonb, you're just serializing data into jsonb, so you'll be limited to the datatypes jsonb supports.
[15:21:36] cpruitt: epochwolf: Can I ask a dump opinion question? Are there any security concerns with Java on the server for jruby? We usually avoid java like the plague but clearly it’s used in the enterprise all over the place. Just always sits weird with me (lack of experience I guess).
[15:21:48] cpruitt: *”dumb opinion question”
[15:22:13] epochwolf: cpruitt: Well, don't run apache tomcat on a port open to the internet.
[15:22:13] artto: has joined #RubyOnRails
[15:22:16] beingjohnm: matthewd: so, have a separate contacts table and store each recepient there and associate that back to the email table?
[15:22:29] matthewd: cpruitt: What would be the particular risk of java vs ruby, for example?
[15:22:42] epochwolf: BAD THINGS(tm) happen.
[15:22:59] cpruitt: matthewd: Java just has a long history of vulnerabilities as far as I’ve seen.
[15:23:10] epochwolf: cpruitt: Rails has too.
[15:23:19] pwnd_nsfw`: Every language*
[15:23:20] epochwolf: There's some delightful ones.
[15:23:28] matthewd: beingjohnm: Yeah. Which you go with likely depends on how you anticipate wanting to query it, for example.
[15:23:49] SteenJobs: has joined #RubyOnRails
[15:23:52] beingjohnm: epochwolf: I should probably read a bit more about the difference between json and jsonb
[15:23:52] matthewd: Every network-facing service*
[15:24:02] epochwolf: cpruitt: java behind a firewall really isn't a security issue, it will use a crapload of ram though. :)
[15:24:21] epochwolf: java trades ram for cpu.
[15:24:26] cpruitt: Oh of couse, so has PHP, .Net, etc… Java in particular just seemed to be like flash to me. Just a magnet for exploits.
[15:24:40] epochwolf: cpruitt: that's the browser plugin.
[15:24:46] cpruitt: Good point.
[15:24:50] matthewd: Read: I'd be far more worried about Rails vulnerabilities on a jruby stack than I would "Java" vulnerabilities.. surely most of the latter are either in a server like Tomcat, or in a [Java] web framework you wouldn't be involving
[15:24:51] epochwolf: Totally seperate from the server stuff.
[15:25:22] epochwolf: matthewd: you don't run tomcat as a front end, you stick nginx in front of it.
[15:25:42] epochwolf: nginx should capture most of the exploits and drop them for being invalid http.
[15:25:45] beingjohnm: matthewd: initially only quering by id but probably should think about that more. This might take one could be a simple implementation and greatly expand it. :)
[15:25:46] matthewd: Yeah, at that level.. Flash *and* ActiveX were written in C, and so is Ruby.. scary!
[15:25:49] cpruitt: I guess it’s just bad PR issue with me.
[15:25:56] cpruitt: Maybe worth checkout out again
[15:26:19] epochwolf: cpruitt: java is used everywhere and more of it's problems are discovered because of that.
[15:26:43] epochwolf: If you want something that doesn't have a history of vulernablities, use a language no one uses.
[15:27:06] epochwolf: Just use haskell as a web server.
[15:27:26] pwnd_nsfw`: brainfuck has no vulnerabilities
[15:28:49] cpruitt: For some reason I’d just had it in my head that the java runtime itself had a diproportionate number of vulnerabilities compared to other software. Apparently that’s not the case.
[15:29:29] cpruitt: Makes sense that most problems come via the browser plugin.
[15:29:56] solars: epochwolf: matthewd: ok I've got to ask again, ArBudget.where(property: ArProperty.where("select id from ar_properties")) still doesn't work as .where and also .select only accept parts of the query, not a complete query
[15:30:06] envint: has joined #RubyOnRails
[15:30:34] solars: epochwolf: matthewd it's producing a nesting like: "SELECT `ar_budgets`.* FROM `ar_budgets` WHERE `ar_budgets`.`ar_property_id` IN (SELECT `ar_properties`.`id` FROM `ar_properties` WHERE (select id from ar_properties))"
[15:30:58] ResidentBiscuit: has joined #RubyOnRails
[15:31:09] matthewd: solars: I've already told you how to do what you want.
[15:31:24] epochwolf: solars: you don't put the entire query in the where, only the where cluase.
[15:31:32] matthewd: solars: Either take the answer, or give more information on what you're actually trying to achieve at a higher level.
[15:31:55] epochwolf: Hell, just give me the entire query and subquery and I can write it.
[15:31:56] solars: matthewd: epochwolf: it's as I wrote before, I've got the complete subquery for ids, as a string
[15:32:00] cpruitt: solars: You might want to gist your code
[15:32:26] matthewd: solars: Either take the answer, or give more information on what you're actually trying to achieve at a higher level.
[15:32:45] solars: matthewd: epochwolf: my question is: given the query I just posted, how would I write it so I don't have to alter the sql string
[15:33:32] cpruitt: solars: You can’t
[15:33:33] solars: meaning: how can I use ArProperty with a complete query as string
[15:33:35] matthewd: solars: I've already answered that. Stop trying to invent different spellings.
[15:33:40] agent_white: has joined #RubyOnRails
[15:33:52] epochwolf: solars: ArBudget.where(property: ArProperty.where("1=1"))
[15:34:18] solars: matthewd: not really, those were different versions
[15:34:20] matthewd: ArBudget.where("property_id in (select id from properties)")
[15:34:23] solars: epochwolf: but that's only the where part
[15:34:24] cpruitt: solars: You’re trying to get AR to parse & extract SQL fragments. It doesn’t do that
[15:34:39] conta: has joined #RubyOnRails
[15:34:39] epochwolf: solars: You haven't given me anything else to work with.
[15:35:30] solars: it boils down to ArProperty.where('select id from fubar where 1=1') - I think cpruitt is right
[15:35:52] SteenJobs: has joined #RubyOnRails
[15:36:04] matthewd: I think I'm right
[15:36:06] solars: there is find_by_sql but it results in 2 calls afaik
[15:36:14] ariedler: has joined #RubyOnRails
[15:36:33] solars: matthewd: I know that I can write it as a single string like "id in (#{query})" but my second question was different to that
[15:36:40] cpruitt: solars: To be fair, everyone who’s given advice is right. You’re not really sharing enough to let them help the way they could.
[15:36:56] cpruitt: You should really gist your code
[15:37:10] brent__: has joined #RubyOnRails
[15:37:27] cpruitt: Preferably with a comment or two if needed ;-)
[15:37:27] matthewd: solars: I have told you that is the correct way to do it. Further questions of the form "okay, but what if I did it this other wrong way instead?" are not useful.
[15:37:40] solars: cpruitt: as mentioned it boils down to ArProperty.where('select id from fubar where 1=1') , but I think that's not possible
[15:38:01] epochwolf: solars: you can't do that. where takes the where clause, not an entire query.
[15:38:18] agent_white: Mornin' folks
[15:38:23] solars: I can do it with find_by_sql - but I thought there might be something that results in a relation object
[15:38:23] epochwolf: The only AR bits that take the entire query immediately execute said query.
[15:38:37] solars: epochwolf: exactly
[15:38:52] LBRapid: has joined #RubyOnRails
[15:39:04] cpruitt: solars: It’s not about what it “boils down to” it’s that no one really knows what you’re trying to accomplish or why. There are two distinct approaches that I’ve seen suggested. I’m not sure what else anyone can suggest with one line of code.
[15:39:16] epochwolf: solars: So, either you share your code or use matthewd's method.
[15:39:25] solars: cpruitt: epochwolf understood it, it's fine
[15:39:32] manzo: has joined #RubyOnRails
[15:39:46] solars: epochwolf: the code above is what is relevant, and you provided the right answer
[15:39:48] rakesh_verma: has joined #RubyOnRails
[15:41:21] cpruitt: solars: I mean, I guess you could be crazy & do something like ArProperty.where(id: Fubar.where(’select id from fubar where 1=1’.split(‘where’).last))
[15:41:49] SteenJobs: has joined #RubyOnRails
[15:42:08] solars: cpruitt: not if the query includes a complex condition
[15:42:33] cpruitt: No, but we wouldn’t know that cause we haven’t seen the code. ;-)
[15:42:51] solars: cpruitt: that's why I mentioned "without altering the string"
[15:42:53] pwnd_nsfw: has joined #RubyOnRails
[15:43:00] froglegs: has joined #RubyOnRails
[15:43:01] cpruitt: Are you storing select statements in a database to generate dynamic queries or something?
[15:43:04] solars: cpruitt: but yeah, you understood what I wanted to know :)
[15:43:23] solars: cpruitt: it's coming from a third party component, the query, and is rather complex
[15:43:46] epochwolf: In that case I would execute the queries seperately.
[15:43:59] solars: epochwolf: no need to, it's working fine like this
[15:44:15] solars: what would be the reason for separation?
[15:44:26] adavia: Im wondering how to do this. Lets say i have a survey which have many questions and each question might have many answers. I want to set up dynamic email notifications based on the question and answer submitted. I'm a bit lost figuring out how to set up all these dynamically
[15:44:28] epochwolf: Not everything is legal in a subquery.
[15:44:32] cpruitt: simplification for starters
[15:44:47] solars: epochwolf: it's a trusted component, it just cannot be changed at this time
[15:45:41] epochwolf: solars: Putting a query in () doesn't isolate it completely.
[15:45:54] matthewd: I can't think of any select query that's not legal in a subquery in PG.. is that a mysql-ism?
[15:46:00] fourcolors: has joined #RubyOnRails
[15:46:05] epochwolf: matthewd: comment at the end for example.
[15:46:40] solars: epochwolf: yes that's clear, but that's a trust issue, which is not relevant in this scenario
[15:46:52] matthewd: Ah, right, I was thinking at AST level, not the string inclusion
[15:47:16] epochwolf: matthewd: I'm just talking sql syntax, () does not isolate things.
[15:47:40] epochwolf: matthewd: like comments...
[15:47:56] envint: has joined #RubyOnRails
[15:48:17] matthewd: (err.. *given* that the potential subquery is a valid fully formed query in its own right)
[15:48:33] epochwolf: I'm talking parsing it.
[15:48:49] matthewd: Oh okay, I thought you were going for higher level stuff when you said isolate
[15:48:49] cpruitt: matthewd: I can’t remember what the issue was but PG was complaining to me a while back about a subquery being invalid. Something I was doing just wasn’t supported in a subquery.
[15:49:19] epochwolf: matthewd: no, I'm saying a valid query won't necessarily be a valid subquery.
[15:49:37] epochwolf: Just for parsing.
[15:50:21] srinidhi: has joined #RubyOnRails
[15:50:24] matthewd: epochwolf: I can't think of anything else, though.. "\n)" seems like it'd have a pretty good chance of doing the thing
[15:50:32] matthewd: .. as long as it doesn't have a trailing semicolon
[15:52:13] epochwolf: I don't think limit/offset works in subqueries.
[15:52:43] epochwolf: Then I'm thinking of something else.
[15:52:51] Derperperd: has joined #RubyOnRails
[15:53:18] matthewd: One of the closest things to a 'hint' PG has is OFFSET 0
[15:54:27] epochwolf: oh wow... you can join on subqueries.
[15:54:42] epochwolf: That's so much nicer than how mssql makes you do it.
[15:55:56] SteenJobs: has joined #RubyOnRails
[15:56:09] dangerousdave: has joined #RubyOnRails
[15:58:37] Derperperd: has joined #RubyOnRails
[16:00:28] Tatey: has joined #RubyOnRails
[16:01:05] artto: has joined #RubyOnRails
[16:02:50] mertbulan: has joined #RubyOnRails
[16:05:53] SteenJobs: has joined #RubyOnRails
[16:07:37] artto: has joined #RubyOnRails
[16:12:17] dangerousdave: has joined #RubyOnRails
[16:13:16] choke: has joined #RubyOnRails
[16:14:24] SteenJobs: has joined #RubyOnRails
[16:14:56] csk: has joined #RubyOnRails
[16:17:00] cschneid_: has joined #RubyOnRails
[16:19:30] dminuoso: ACTION pokes matthewd 
[16:24:30] SteenJobs: has joined #RubyOnRails
[16:28:07] brent__: has joined #RubyOnRails
[16:28:33] envint: has joined #RubyOnRails
[16:29:46] pLaTo0n: has joined #RubyOnRails
[16:30:29] brent__: has joined #RubyOnRails
[16:31:18] pLaTo0n: has joined #RubyOnRails
[16:31:49] SteenJobs: has joined #RubyOnRails
[16:33:05] Suslov: has joined #RubyOnRails
[16:33:24] pLaToOn: has joined #RubyOnRails
[16:34:04] Andr3as: hello everyone.. i've an issue with a form but dont know where to look at... here's a screenshot of it before i press signup and after i press it (below) http://bit.ly/2mpx9aW
[16:34:33] Andr3as: when i open up users/new again, it looks good, if there is a validation error its screwed again
[16:34:37] platoon23: has joined #RubyOnRails
[16:34:49] Andr3as: i've even tried to remove the error partial - no change
[16:34:53] platoon23: has joined #RubyOnRails
[16:34:59] Andr3as: has anyone ver experienced something like this?
[16:35:52] Aherin: has joined #RubyOnRails
[16:36:11] Andr3as: here's a gist of that view, fwiw - https://gist.github.com/awunder/883979b62a98c589801ea42a95061518
[16:37:41] Suslov: has joined #RubyOnRails
[16:40:52] matthewd: dminuoso: pong
[16:41:54] chopin: has joined #RubyOnRails
[16:42:06] dminuoso: matthewd: So I heard you were working on a two way data binding react and activerecord, right?
[16:43:34] Derperperd: has joined #RubyOnRails
[16:46:42] matthewd: dminuoso: unpong :P
[16:47:33] dminuoso: matthewd: Now now dont be modest.
[16:47:46] dminuoso: Im not asking for much.
[16:50:47] fox_mulder_cp: ho. how i can properly start resque via systemd?
[16:52:23] hotpanca_: has joined #RubyOnRails
[16:53:08] fourcolors: has joined #RubyOnRails
[16:55:02] rogue_koder: has joined #RubyOnRails
[16:55:51] ferr1: has joined #RubyOnRails
[17:03:21] szulak_: has joined #RubyOnRails
[17:04:13] s2013: has joined #RubyOnRails
[17:07:46] fourcolors: has joined #RubyOnRails
[17:13:08] fourcolors: has joined #RubyOnRails
[17:17:54] SteenJobs: has joined #RubyOnRails
[17:22:24] pawnbox: has joined #RubyOnRails
[17:23:24] Derperperd: has joined #RubyOnRails
[17:23:50] DrYockel: has joined #RubyOnRails
[17:29:23] gusrub: has joined #RubyOnRails
[17:31:06] Cohedrin: has joined #RubyOnRails
[17:31:24] username1: has joined #RubyOnRails
[17:32:02] havenwood: fox_mulder_cp: `sudo systemctl start redis`, setup resque in your Procfile and `sudo forman export systemd /etc/systemd/system && sudo systemctl start resque && sudo systemctl daemon-reload && sudo systemctl start fox_mulder_cp`
[17:32:28] havenwood: fox_mulder_cp: Or something like that.
[17:33:04] havenwood: fox_mulder_cp: daemon-reload after you create your service
[17:33:24] havenwood: fox_mulder_cp: forman can create the service for you from a Procfile
[17:34:59] gambl0re: has joined #RubyOnRails
[17:35:41] envint: has joined #RubyOnRails
[17:40:31] Axsuul: anyone have a good solution for dropping existing database connections when doing a rake db:drop?
[17:44:10] Rodya_: has joined #RubyOnRails
[17:44:20] pawnbox: has joined #RubyOnRails
[17:48:23] froglegs: has joined #RubyOnRails
[17:48:28] hotpanca_: has joined #RubyOnRails
[17:48:52] dionysus69: has joined #RubyOnRails
[17:51:15] dminuoso: axsuul: Yes, don't invoke db:drop in the first place.
[17:51:54] dminuoso: axsuul: The thing is without knowing what else is connected to the database, there's no safe semantics. Instead tackle this from your deployments perspective.
[17:52:08] Axsuul: sorry this is for development
[17:52:54] dminuoso: axsuul: Signal SIGTERM to the application server.
[17:53:33] Cohedrin: has joined #RubyOnRails
[17:54:06] dminuoso: i.e. you could have a custom rake task that looks for your puma pid and signals SIGTERM to it. the waiting is probably a bit tricky afterwards but you could just wait for the pid file to disappear and then invoke the next rake task
[17:54:38] yigitsadic: has joined #RubyOnRails
[17:54:57] tildes_: has joined #RubyOnRails
[17:55:27] dminuoso: Or if you're as brave as me, you could just send SIGKILL.
[17:55:33] dminuoso: (That will ensure a fast shutdown from puma)
[17:55:56] cnk: has joined #RubyOnRails
[17:56:04] matthewd: axsuul: http://stackoverflow.com/a/5408501/476979 may help
[17:56:31] dminuoso: matthewd: Will ActiveRecord play nicely if you pull this?
[17:57:55] ahrs: has joined #RubyOnRails
[18:00:59] Coldblackice: has joined #RubyOnRails
[18:01:26] matthewd: I mean.. we'll play nicely through the disconnect, but after the drop, things might get fuzzier
[18:01:51] greenbird: has joined #RubyOnRails
[18:01:56] hahuang61: has joined #RubyOnRails
[18:03:51] Cache_Money: has joined #RubyOnRails
[18:06:29] envint: has joined #RubyOnRails
[18:07:54] arBmind: has joined #RubyOnRails
[18:09:04] Derperperd: has joined #RubyOnRails
[18:09:33] djbkd: has joined #RubyOnRails
[18:12:38] pawnbox: has joined #RubyOnRails
[18:14:13] mikecmpbll: has joined #RubyOnRails
[18:15:36] SteenJobs_: has joined #RubyOnRails
[18:16:55] dobs: has joined #RubyOnRails
[18:18:16] arBmind: has joined #RubyOnRails
[18:18:45] dobs: hi, how can i automatically reload a library in my /lib folder that does NOT follow rails naming convention (i.e. its main usage is for ruby) and which uses "require_relative" statements?
[18:21:13] codelahoma: has joined #RubyOnRails
[18:21:33] matthewd: dobs: Restart the process.
[18:22:59] dobs: (without restaring the process lol)
[18:23:23] SteenJobs_: has joined #RubyOnRails
[18:23:37] dobs: "require_dependency" works for one file but it does not reload the required files
[18:23:38] gusrub: has joined #RubyOnRails
[18:23:59] matthewd: Yeah. You can't do what you want.
[18:24:02] codelahoma_: has joined #RubyOnRails
[18:24:15] matthewd: Well.. not with the Rails reloader, anyway. You're welcome to write your own.
[18:24:41] dobs: so how can i use a library-for-ruby-that-is-not-a-gem in rails
[18:24:43] gusrub: has joined #RubyOnRails
[18:25:00] dobs: any idea? tips? guide? lol
[18:25:47] matthewd: You said you're already doing that, so I'm not sure what you're asking
[18:26:19] dobs: ok let's say i have a file "lib/foo.rb" which contains "require_relative ./blah.rb" on its first line
[18:26:22] matthewd: Rails can only reload files that it has autoloaded. If your files are designed to be loaded through some other mechanism, they can't be reloaded.
[18:26:49] SteenJobs__: has joined #RubyOnRails
[18:26:53] dobs: and i add in my application_controller "require_dependency lib/foo.rb"
[18:27:58] dobs: in my ... very limited understanding of rails ... i wouldve thought reloading lib/foo.rb would also automatically reload lib/blah.rb
[18:28:10] matthewd: Well, it won't.
[18:28:41] dobs: ok so do you have any tips on how to write a library which is both easy to use with ruby and with rails without "adapting it for rails"
[18:28:56] matthewd: 1. It should be a gem
[18:29:00] matthewd: 2. No really, it should be a gem
[18:29:09] matthewd: 3. You don't use reloading
[18:29:24] dobs: the problem with gems is that it is very hard and inconvenient to develop it while testing it on a rails app
[18:29:33] dobs: ok thanks anyway
[18:29:42] matthewd: How do you do it on other non-rails ruby apps?
[18:30:04] dobs: require_relative "./my_lib/my_lib.rb"
[18:30:09] hotpancakes: has joined #RubyOnRails
[18:30:10] duderonomy: has joined #RubyOnRails
[18:30:41] matthewd: I mean how do you get past the 'very hard and inconvenient' lack of reloading
[18:30:55] dobs: in a plain ruby script?
[18:31:34] dobs: :rrun in vim lol
[18:31:49] rfoust: has joined #RubyOnRails
[18:32:09] futilegames: has joined #RubyOnRails
[18:32:46] cpruitt: dobs: Generally I think you’d usually do one of two things: 1. Create a gem in isolation, develop it using your tests and if the library isnt’ dependent on rails, don’t worry about rails at all. Then you can just use it in rails afterwards without worrying about reloading, or 2. jut make it part of your rails app, get it to work and then extract it into a gem later (see option 1).
[18:33:19] dobs: cpruitt: ok but what about a "non-general" situation
[18:33:33] cpruitt: The problem here is that you’re developing ruby code, in the context of a rails app, using a rails app to do it, not doing it the rails way, and then saying it’s difficult.
[18:33:57] cpruitt: Honestly it just sounds like you’re looking for a shortcut. There really isnt’ one.
[18:34:04] dobs: well i was looking for a way to execute-the-require-statement-each-time-the-controller-is-called like in php
[18:34:27] cpruitt: Not to point out the obvious but ruby isn’t php. ;-)
[18:34:37] dobs: ... ok thanks for your time
[18:35:38] matthewd: ISTM the equivalent to PHP would be to just restart the process between each request ¯\_(ツ)_/¯
[18:36:37] dobs: ok let's say you work for a REALLY weird client that has all his ruby libs under /opt/rubylibs and you dont have root access and they are NOT gems how would you require them under rails
[18:36:47] SteenJobs: has joined #RubyOnRails
[18:37:06] cpruitt: require or reload?
[18:37:22] dobs: require them so that they are reloaded each requests
[18:37:48] ariedler: has joined #RubyOnRails
[18:37:50] cpruitt: But why do you need to reload something you aren’t able to edit?
[18:37:58] dobs: "you dont" as in "it's not a good practice" or "you don't" as is "its impossible" ?
[18:38:02] NoGodDamnIdea: has joined #RubyOnRails
[18:38:02] NoGodDamnIdea: has joined #RubyOnRails
[18:38:18] matthewd: It's not supported by the Rails reloader
[18:38:32] cpruitt: Nothing is “impossible” but you’ll have to develop your own way of doig it
[18:38:39] matthewd: It's impossible without writing your own reloader
[18:38:56] dobs: sorry i really thought you guys were saying "i wont tell you because its considered bad practice"
[18:39:32] cpruitt: No, not at all. I’m happy to help someone shoot themselves in the foot if it gets the job done. If I wanted a channel where people were a-holes I’d head over to #wordpress
[18:40:10] dobs: lol yeah it's just sometimes devs. are like that
[18:40:16] dobs: sorry again
[18:40:50] cpruitt: No worries.
[18:41:13] dobs: on the FIRST page request the second require IS executed though which i think is weird
[18:41:49] matthewd: That's when it gets loaded for the first time
[18:42:33] cpruitt: I’m still confused about the need to reload a file you don’t have access to.
[18:43:07] cpruitt: If you can’t edit it (permissions or whatever) why do you need to reload? Or was that just an analogy?
[18:43:08] dobs: i do have access to the file but cannot rename it nor can i "gem" it
[18:43:50] dobs: and for 100$/hr i said "yes mister no problem"
[18:43:57] cpruitt: Is it just one class or a single file with a bunch of crap?
[18:44:14] cpruitt: And you’re tasked with editing said crap?
[18:44:21] dobs: a file which contains multiple requires
[18:44:33] cpruitt: can you gist it?
[18:44:37] dobs: well i wouldnt call it crap just not standard
[18:45:03] cpruitt: No, I didn’t mean “crap” in a derigotory way, just “crap” as in “stuff”. sorry
[18:46:20] matthewd: I guess you could maybe preemptively require_dependency all the leaf files? Maybe?
[18:46:32] dobs: that is why im trying right now
[18:47:22] dobs: i had 2 ideas: 1) glob all .rb and require_dependency and 2) create a "false lib folder" with symlinks following rails conventions
[18:47:30] dminuoso: If I use a sequence token that rails can use to ensure that no two users are trying to edit and submit the same resource, is there a conventional name for such a token?
[18:47:43] defsdoor: has joined #RubyOnRails
[18:48:04] dminuoso: (It would basically just be a database sequence that search form contains and rails can check whether it has advanced when receiving the PATCH/PUT or not)
[18:48:09] dminuoso: *that the form contains
[18:48:31] matthewd: dminuoso: http://api.rubyonrails.org/classes/ActiveRecord/Locking/Optimistic.html
[18:48:36] cpruitt: I guess the problem with req_dep is that it’ll then depend on activesupport. If this is supposed to be used outside of rails that might be an issue.
[18:49:01] tbuehlmann: I'm so bad, first thing I just did was looking up on pessimistic locking since I always mix them up
[18:49:14] dobs: cpruitt: not if Dir["/opt/rubylibs/blah/**/.rb"].each .... is in the application_controlle
[18:49:38] matthewd: dobs: Which Rails version?
[18:49:58] dminuoso: matthewd: Oh was about to reinvent the wheel I guess. Cheers.
[18:50:11] matthewd: Rails.application.reloader.to_prepare do (load the stuff here) end
[18:50:22] dobs: matthewd: ooohh what is that
[18:50:30] matthewd: Put that in an initializer
[18:50:36] cpruitt: whew… look at that (sent with fireworks)
[18:50:51] dobs: matthewd: very interesting let me take a look
[18:51:12] matthewd: Don't get too excited.. it won't magically reloadify stuff -- but it will run that block at boot and after each reload
[18:51:55] matthewd: So combining that with require_dependency, which marks the file to be unloaded during reload, should maybe end up with what you want
[18:52:32] matthewd: Basically, just a more "correct" place to put the loading than squeezing it somewhere inside a controller
[18:53:23] cpruitt: matthewd: All the requires would need to be done there right? If one of the required files in turn includes a require statement, that won’t be reloaded would it?
[18:53:40] dobs: cpruitt: this is exactly my problem
[18:54:18] chouhoulis: has joined #RubyOnRails
[18:54:31] cpruitt: You’d need to change every require in your library code to require_dependency, hence my comment about adding a hard dependency on activesupport
[18:54:50] cpruitt: There’s not a way I know of to reload an entire dependency graph.
[18:55:08] dobs: which is ... in my humble opinion .. a little weird
[18:56:44] SteenJobs: has joined #RubyOnRails
[18:57:00] matthewd: We're obliged to respect ruby semantics for ordinary requires; Ruby doesn't do reloading, and if we didn't load it, it's not our job to unload it
[18:57:03] cpruitt: I dont think so. If your comparing to php, it’s the equivilant of “require_once”. You can’t do it again once something’s been required unless the process is restarted. In a rails app, the process isnt’ restarted between requests.
[18:58:10] cpruitt: I fyou want it reloaded every time you could use load instead of require but who knows what kinds of side effects you’d have then.
[18:58:40] matthewd: e.g. just because your model/controller/whatever requires some file from stdlib before some other non-rails file happens to require it, if we then unloaded... 'csv', say, people would be.. surprised.
[18:58:52] dobs: what about my idea to create a false lib folder with symlinks to each file following the naming conventions?
[18:59:12] dobs: and the eager_load_paths
[18:59:37] matthewd: I think the walk + require_dependency seems simpler
[18:59:42] chouhoul_: has joined #RubyOnRails
[18:59:54] dobs: i just tried the walk + rd and it doesnt work because every files is loaded twice
[18:59:58] matthewd: Otherwise you're likely going to have issues if any of the symlinked files contain requires for each other
[19:00:33] matthewd: Oh, right.. you could get around that
[19:01:01] matthewd: .. maybe :)
[19:01:05] dobs: dir.each combined with require_dependency does not work i just tried it 2 mins ago, everything is loaded twice
[19:01:17] matthewd: Add the fully expanded path to $" after you require_dependency
[19:02:22] matthewd: Oh, sorry, I thought we were trying to come up with a solution. Enjoy.
[19:02:46] SteenJobs: has joined #RubyOnRails
[19:03:31] dobs: the thing is im a little bit skeptical about the fact that i would be the first ever rails coder to try and reload a ruby lib!?
[19:04:01] envint: has joined #RubyOnRails
[19:04:15] dobs: i think i just dont understand the rails reloader lol
[19:04:18] matthewd: My attitudeometer pegged on your previous message
[19:04:22] cpruitt: No, I’m sure you’re not the first, but it’s definately an edge case, probably because it’s not possible without writing a reloader similar to rails’
[19:04:51] dobs: matthewd: not sure what you mean sorry english is not my 1st lang.
[19:06:11] cpruitt: Look, ruby is designed to load a file once per process. Process starts, file loaded, constants defined, process runs until it ends. Your web server is one process. It doesn’t restart every request like PHP. That’s on purpose. You’re trying to break rules and that’s going to come with some headaches.
[19:06:58] tjvc: has joined #RubyOnRails
[19:06:58] tjvc: has joined #RubyOnRails
[19:07:26] pLaTo0n: has joined #RubyOnRails
[19:07:47] cpruitt: Maybe forgo the entire rails server and do everything in your test suite and make sure you don’t have spring enabled. That should cause the process to be restarted between each test run.
[19:08:45] matthewd: Your skepticism is coming through very clearly. I'm not enjoying your attitude ("i just tried it 2 mins ago"), so I'm losing interest in helping.
[19:09:48] dobs: i have absolutely no idea what you are talking about but sorry anyway
[19:09:55] aesthetik: has joined #RubyOnRails
[19:10:03] dobs: anyway thank you for your time guys
[19:10:38] matthewd: My last suggestion was: add the fully expanded path to $" after you require_dependency
[19:10:47] dobs: irc is a really weird medium to communicate lol
[19:11:01] aesthetik: has joined #RubyOnRails
[19:11:43] aesthetik: has left #RubyOnRails: ()
[19:15:22] envint: has joined #RubyOnRails
[19:15:32] cpruitt: dobs: IRC can take a little practice. :-)
[19:17:01] cpruitt: Hard to be in a situation where you’re frusterated that there’s no simple solution to a problem when you need one. That can come across like you’re fighting the people helping you. I’ve been there, but it’s best to just take advice & try it. If you don’t have a solution, trust the people you’re asking for help, ya know?
[19:17:19] dobs: yeah i understand
[19:17:26] GodFather: has joined #RubyOnRails
[19:17:45] dobs: plus the fact that this question has been asked like 10000x times on stackoverflow without any working answer lol
[19:18:04] cpruitt: Honestly, that should tell you something. :-)
[19:18:19] dobs: yeah that rails should support this lol ;) j/k
[19:18:32] sid_fules: has joined #RubyOnRails
[19:19:06] cpruitt: lol submit a pull request.
[19:19:15] dobs: irc is usually the "last line of defense" lol
[19:19:22] Aherin: has joined #RubyOnRails
[19:19:23] matthewd: I'm one of three, maybe four, people who maintain and actually know the reloader -- and this is the first time I've heard such a request, so.. yeah. :)
[19:20:05] dobs: matthewd: !? its like one of the most voted question on s/o lol
[19:20:26] cpruitt: dobs: I don’t think the rails maintainers use SO for issue tracking.
[19:20:54] matthewd: cpruitt: To be fair, we also don't use issues for feature request tracking ;)
[19:20:55] dobs: cpruitt: yeah and maybe i have trouble making my question clear lol
[19:21:31] matthewd: (we're actually pretty bad about feature requests, tbh... unless someone who wants it makes it, they don't tend to go anywhere)
[19:21:40] cpruitt: matthewd: Well I have no idea where the requests go, I just know it isn’t SO. lol
[19:21:42] DominicB1rford: has joined #RubyOnRails
[19:21:53] DominicB1rford: has left #RubyOnRails: ()
[19:21:58] DominicB1rford: has joined #RubyOnRails
[19:24:50] cpruitt: matthewd: Off topic question, If someone was interested in doing some gruntwork to get a little more open source contributions under their belt, how much handholding might they realistically expect to get early on from rails maintainers?
[19:25:21] dobs: that is a very good question
[19:25:40] alfiemax: has joined #RubyOnRails
[19:25:52] alfiemax: i'm using this gem : https://github.com/ActsAsParanoid/acts_as_paranoid
[19:26:18] matthewd: I'm always happy to provide work-out-how-to-do-the-thing handholding
[19:26:22] alfiemax: rails 5, so i've added `acts_as_paranoid` to ApplicationRecord class so that it applies to all models
[19:26:37] alfiemax: but i'd like to skip it for just one model
[19:26:48] matthewd: Where we more often run into difficulty is when people want work-out-what-to-work-on handholding
[19:26:49] envint: has joined #RubyOnRails
[19:27:03] doodlehaus: has joined #RubyOnRails
[19:27:07] SteenJobs: has joined #RubyOnRails
[19:27:11] cpruitt: matthewd: Yeah I can see that being an issue.
[19:27:25] matthewd: The nature of Rails, being large, and mature, and popular, is that there isn't really a queue of easily approachable issues for us to hand out
[19:27:53] koneko: has joined #RubyOnRails
[19:28:01] matthewd: You need to have something that's actually bitten you -- then you're motivated to fix it, and we're happy to help that happen
[19:28:09] cpruitt: I usually get stuck more on the “how do other people want this to be tested?”, “how do I submit a PR for this?”, “how to I get over not wanting really smart people to look at my code?” lol
[19:28:31] matthewd: I can help with 2/3 of those ;)
[19:28:43] cpruitt: the last 2 right? ;-)
[19:29:43] pulkit4tech: has left #RubyOnRails: ()
[19:29:46] gambl0re: has joined #RubyOnRails
[19:30:55] pulkit4tech: has joined #RubyOnRails
[19:31:35] cek: has left #RubyOnRails: ()
[19:33:20] jsrn_: has joined #RubyOnRails
[19:36:31] envint: has joined #RubyOnRails
[19:37:08] whatasunnyday: has joined #RubyOnRails
[19:38:40] whatasunnyday: Hello folks, anyone using Google App Engine to host their rails application? I feel pretty good about using Heroku / AWS but looking for a healthy middle ground. Was thinking about putting a project on there. Also curious how pricing hashes out compared to Heroku / AWS if anyone knows.
[19:46:00] gusrub: has joined #RubyOnRails
[19:49:56] hotpancakes: has joined #RubyOnRails
[19:50:31] hotpancakes: has joined #RubyOnRails
[19:52:22] DLSteve: whatasunnyday, I have a Python web app in GAE and it's ok but I think Heroku might be better for Rails.
[19:52:58] whatasunnyday: Thanks for the response DLSteve. If you don't mind me asking, what makes you think Rails might be better suited by Heroku? How much is it costing you / month?
[19:53:04] DLSteve: GAE pushes their NoSQL DB and you have to do some work if you want to use their SQL DB.
[19:53:24] whatasunnyday: DLSteve, ah, that's good to know. I was interested in using Postgres on Google Cloud. It was announced today.
[19:53:27] SteenJobs_: has joined #RubyOnRails
[19:53:45] DLSteve: I pay about $10 a month but I'm running a very small productivity tool for 15 people.
[19:54:15] DLSteve: whatasunnyday, Yah MySQL was the only option for a long time.
[19:54:50] whatasunnyday: DLSteve, Thanks, very helpful. I don't have many users in this particular instance but I would say that the database load is a bit larger than normal for the size. Running a BI application that rolls up a lot of data.
[19:55:28] DLSteve: Ah ok. Yah I'm not 100% of the performance between GAE and Heroku tbh.
[19:55:43] DLSteve: Heroku is probably a little more mature.
[19:55:59] whatasunnyday: DLSteve, yeah, there's no read replicas in Postgres since it's beta :D
[19:56:24] chouhoulis: has joined #RubyOnRails
[19:56:45] whatasunnyday: DLSteve last question, are you using the "front end instance?"
[19:58:28] froglegs: has joined #RubyOnRails
[19:59:48] Pumukel: has joined #RubyOnRails
[20:04:39] DLSteve: whatasunnyday, Not sure. TBH I built the app two years ago and they have added a lot since then. I was just using whatever the standard instance was.
[20:04:59] whatasunnyday: DLSteve got it. thanks for your time. really appreciate your opinion.
[20:05:54] whatasunnyday: see ya later everybody
[20:06:52] envint: has joined #RubyOnRails
[20:13:08] pawnbox: has joined #RubyOnRails
[20:13:46] Brad_: has joined #RubyOnRails
[20:14:50] SteenJobs_: has joined #RubyOnRails
[20:19:31] banisterfiend: has joined #RubyOnRails
[20:19:41] jenrzzz: has joined #RubyOnRails
[20:19:41] jenrzzz: has joined #RubyOnRails
[20:19:58] envint: has joined #RubyOnRails
[20:24:34] ocpysh: has joined #RubyOnRails
[20:24:59] ocpysh: what does https://github.com/carrierwaveuploader/carrierwave#making-uploads-work-across-form-redisplays store in "avatar_cache"?
[20:27:44] itsautomatisch: has joined #RubyOnRails
[20:31:27] hotpanca_: has joined #RubyOnRails
[20:32:22] SteenJobs_: has joined #RubyOnRails
[20:35:03] ocpysh: anybody around?
[20:36:01] cpruitt: ocpysh: It’s been a while since I’ve looked at carrierwave caches it but I think it’s a string with the encoded image data.
[20:36:11] dobs: has joined #RubyOnRails
[20:37:14] meoblast001: has joined #RubyOnRails
[20:37:35] ocpysh: cpruitt : in the second example, under "It might be a good idea to show the user that a file has been uploaded, in the case of images, a small thumbnail would be a good indicator:"
[20:37:49] ocpysh: there is @user.avatar_url
[20:38:14] ocpysh: which indicates the "avatar" has been stored somewhere .. so wouldn't the cache by the url?
[20:38:32] knight33: has joined #RubyOnRails
[20:39:04] dobs: according to this answer on SO: http://stackoverflow.com/questions/38198668/rails-5-load-lib-files-in-production any class file in /app is automatically loaded which i cant make it work. what i do: 1- mkdir app/foo; 2- vim app/foo/foo.rb; 3- class foo def msg puts "hello world" end end 4- rails console 5- x = Foo.new <-- error uninitialized constant
[20:39:12] SteenJobs_: has joined #RubyOnRails
[20:39:27] pawnbox: has joined #RubyOnRails
[20:39:54] cpruitt: ocpysh: I’m not sure. Inspect the source & see.
[20:40:30] cpruitt: I know carrierwave uses a temp directory before saving the final file. It might be a reference to that.
[20:40:37] ocpysh: alright, yeah I'm not a rubyist, just became aware there is this neat solution in ror, and was wondering how it works
[20:41:48] cpruitt: ocpysh: https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/mount.rb#L76
[20:42:17] cpruitt: Looks like it just points to a temp file saved from the prior submission
[20:42:20] ocpysh: cpruitt : oh cool, thanks
[20:43:01] ocpysh: cpruitt : do you know if carrierwave keeps track of temp files in the db?
[20:43:05] dobs: i guess my question is: does rails 5 autoloads all the files in app/ ?
[20:43:38] cpruitt: ocpysh: No it doesn’t. The only thing stored is the path of the final file upload.
[20:44:20] cpruitt: You create your own DB string columns. carrierwave just mounts on what you create. It doesn’t alter your DB in any way
[20:44:52] froglegs: has joined #RubyOnRails
[20:45:07] cpruitt: ocpysh: Are you looking at it to try to port the pattern to something else?
[20:45:09] ocpysh: cpruitt : so that "string that identifies" is what, the file name?
[20:45:14] ocpysh: cpruitt : yes
[20:46:09] cpruitt: path & file base name
[20:46:25] fourcolors: has joined #RubyOnRails
[20:47:37] ocpysh: cpruitt : are temp files publicly available?
[20:47:52] cpruitt: Good question. I’m not sure. Hold..
[20:47:54] apotry: has joined #RubyOnRails
[20:48:18] cpruitt: Yes, they are
[20:49:06] ocpysh: cpruitt : alright, thanks!
[20:49:13] aperkins81: has joined #RubyOnRails
[20:50:12] SteenJobs_: has joined #RubyOnRails
[20:51:00] ocpysh: cpruitt : one last question, how does cw know when to delete temp files?
[20:51:45] ocpysh: check the creation date + delete after N hours?
[20:52:04] fourcolors: has joined #RubyOnRails
[20:54:28] cpruitt: ocpysh: It’s a small problem with CW. CW saves a temp file up until the database record is saved. When it’s saved it does whatever image processing you’ve told it to do, saves one or more final variants of the file, and then deleted the temp file.
[20:54:43] Rodya_: has joined #RubyOnRails
[20:55:16] DoctorMonocular: has joined #RubyOnRails
[20:55:21] ocpysh: cpruitt : what if the db record is never saved?
[20:58:02] ocpysh: anyway, thanks a lot.
[20:59:10] dminuoso: ocpysh: Tempfiles should not leak under normal circumstances.
[20:59:19] anjen: has joined #RubyOnRails
[20:59:40] cpruitt: ocpysh: I’m really not sure of the details
[21:00:33] dminuoso: cpruitt: In a nutshell it's basically a Tempfile.new { |file| do_stuff }
[21:00:43] dminuoso: cpruitt: The file will be reaped by its finalizer the next time the GC fires
[21:00:56] dminuoso: Even CW will do this.
[21:01:14] SteenJobs_: has joined #RubyOnRails
[21:02:24] alfiemax: got a question
[21:02:30] alfiemax: using devise with rails 5
[21:02:37] cpruitt: dminuoso: Is there a difference between a CW temp file and a cache file? The file can’t be removed when the GC runs or any browser request for it will 404
[21:03:07] alfiemax: since authenticate_user! is added as a before_action
[21:03:29] loechel: has joined #RubyOnRails
[21:03:31] alfiemax: has left #RubyOnRails: ()
[21:04:55] cpruitt: ocpysh: At some point CW is looking for old files & removing them, but I’m not familiar with the internals enough to know what condition causes it.
[21:04:56] cpruitt: https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/storage/file.rb#L107
[21:05:53] szulak: has joined #RubyOnRails
[21:06:08] jenrzzz: has joined #RubyOnRails
[21:07:01] SteenJobs_: has joined #RubyOnRails
[21:08:23] workmad3: has joined #RubyOnRails
[21:11:13] conta: has joined #RubyOnRails
[21:11:18] chopin: has joined #RubyOnRails
[21:13:48] meoblast001: has joined #RubyOnRails
[21:14:03] srinidhi: has joined #RubyOnRails
[21:15:16] chopin_: has joined #RubyOnRails
[21:17:14] Limix: has joined #RubyOnRails
[21:19:02] cnk: has joined #RubyOnRails
[21:20:01] ElDoggo: has joined #RubyOnRails
[21:20:10] srinidhi: has joined #RubyOnRails
[21:24:09] lupine: has joined #RubyOnRails
[21:28:05] froglegs: has joined #RubyOnRails
[21:29:19] alex88: has joined #RubyOnRails
[21:29:59] meoblast001: has joined #RubyOnRails
[21:31:27] SteenJobs_: has joined #RubyOnRails
[21:32:36] dionysus69: has joined #RubyOnRails
[21:34:43] hahuang61: has joined #RubyOnRails
[21:35:35] zero1one0: has joined #RubyOnRails
[21:37:16] ElDoggo: does anyone know how to take a file from ActionDispatch::Http::UploadedFile and save it as-is to file using Ruby's File without futzing around with encoding?
[21:37:36] SteenJobs_: has joined #RubyOnRails
[21:38:11] tildes_: has joined #RubyOnRails
[21:42:12] ElDoggo: When I pass the ActionDispatch::Http::UploadedFile object's object.tempfile.read to File.new, it works fine for text files but pdfs and images throw an Encoding::UndefinedConversionError ("x89" from ACII-8BIT to UTF-8)
[21:43:58] jsrn_: has joined #RubyOnRails
[21:47:13] netzfisch: has joined #RubyOnRails
[21:49:24] SteenJobs_: has joined #RubyOnRails
[21:50:25] DoctorMonocular: has joined #RubyOnRails
[21:53:10] DoctorMonocular: has joined #RubyOnRails
[21:54:03] djbkd: has joined #RubyOnRails
[21:54:45] ElDoggo: Well you see ElDoggo, the right approach is just copying the file using FileUtil: FileUtils.cp(tempfile_path, newfile_path)
[21:55:02] ravster: has joined #RubyOnRails
[21:56:29] s2013: has joined #RubyOnRails
[21:57:43] cnk: has joined #RubyOnRails
[21:59:28] SteenJobs_: has joined #RubyOnRails
[22:02:18] ravster: Is there an common way to organize a rails controller-action to render data differently based on the role of the user? My first thought was to do a conditional on user-role and delegate to private methods, but I was wondering if there is another way to do this with a better pattern.
[22:02:30] ravster: Its a JSON endpoint
[22:03:13] cnk: has joined #RubyOnRails
[22:04:53] froglegs: has joined #RubyOnRails
[22:07:15] dminuoso: ravster: Is there also difference in how you handle the actions?
[22:07:19] dminuoso: ravster: Perhaps even disallow some?
[22:07:25] Derperperd: has joined #RubyOnRails
[22:08:15] dminuoso: ravster: I would do the dispatch in the view actually
[22:08:35] dminuoso: ravster: say have show.html.haml render a different partial depending on .can?
[22:08:51] dminuoso: ravster: The reason is that it does not change the way that the controller behaves.
[22:09:02] dminuoso: It just changes what you see, which is the single responsibility of the view.
[22:09:21] cnk: has joined #RubyOnRails
[22:10:11] djbkd: has joined #RubyOnRails
[22:10:21] ravster: dminuoso: Ok, I'll try and set the filters in the view layer. Thanks.
[22:18:52] pawnbox: has joined #RubyOnRails
[22:18:55] ErhardtMundt: has joined #RubyOnRails
[22:20:50] jenrzzz: has joined #RubyOnRails
[22:20:51] jenrzzz: has joined #RubyOnRails
[22:21:12] fourcolors: has joined #RubyOnRails
[22:21:17] SteenJobs_: has joined #RubyOnRails
[22:21:25] tvw: has joined #RubyOnRails
[22:24:03] fourcolors: has joined #RubyOnRails
[22:24:44] cschneid_: has joined #RubyOnRails
[22:25:59] cnk: has joined #RubyOnRails
[22:26:33] SteenJobs_: has joined #RubyOnRails
[22:28:56] iliketurtles: has joined #RubyOnRails
[22:33:15] bheesham: has joined #RubyOnRails
[22:37:43] koneko: has joined #RubyOnRails
[22:39:25] ariedler: has joined #RubyOnRails
[22:40:42] irishfromua: has joined #RubyOnRails
[22:40:56] SteenJobs_: has joined #RubyOnRails
[22:41:06] ule: has joined #RubyOnRails
[22:42:43] FCser: has joined #RubyOnRails
[22:46:12] SteenJobs_: has joined #RubyOnRails
[22:46:40] cnk: has joined #RubyOnRails
[22:48:28] sid_fules: has joined #RubyOnRails
[22:48:41] ariedler: has joined #RubyOnRails
[22:51:31] envint: has joined #RubyOnRails
[22:52:02] SteenJobs_: has joined #RubyOnRails
[22:55:09] sneakers: has joined #RubyOnRails
[22:57:44] cnk: has joined #RubyOnRails
[22:58:23] pawnbox: has joined #RubyOnRails
[23:00:54] SteenJobs_: has joined #RubyOnRails
[23:05:15] Cache_Money: has joined #RubyOnRails
[23:06:41] SteenJobs: has joined #RubyOnRails
[23:10:56] SteenJobs_: has joined #RubyOnRails
[23:14:26] gilest: has joined #RubyOnRails
[23:16:00] beingjohnm: ACTION has spent two hours dealing with a rounding issue
[23:17:24] envint: has joined #RubyOnRails
[23:17:55] beingjohnm: ACTION gives up and updates his expected value so his tests pass
[23:19:41] adam12: Have you seen assert_delta?
[23:20:01] adam12: err, it might be assert_in_delta
[23:20:51] adam12: ^ beingjohnm
[23:21:27] samdvr: has joined #RubyOnRails
[23:21:35] hahuang65: has joined #RubyOnRails
[23:23:34] DoctorMonocular: has joined #RubyOnRails
[23:24:13] SteenJobs_: has joined #RubyOnRails
[23:28:25] pawnbox: has joined #RubyOnRails
[23:28:45] jenrzzz_: has joined #RubyOnRails
[23:31:09] duderono_: has joined #RubyOnRails
[23:31:10] ExcelTronic: has joined #RubyOnRails
[23:32:04] DoctorMonocular: has joined #RubyOnRails
[23:38:48] SteenJobs_: has joined #RubyOnRails
[23:43:01] var-ela: has joined #RubyOnRails
[23:46:51] beingjohnm: adam12: I hadn't seen that. Thanks
[23:48:11] ResidentBiscuit: has joined #RubyOnRails
[23:50:36] hamster88: has joined #RubyOnRails
[23:51:29] hamster88: I am stuck with something and would really appreciate the help.
[23:51:59] xMopxShell: has joined #RubyOnRails
[23:52:05] hamster88: when i am trying to run rails s i am getting following error
[23:52:09] hamster88: ArgumentError: Unknown key: :optional. Valid keys are: :class_name, :anonymous_class, :foreign_key, :validate, :autosave, :dependent, :primary_key, :inverse_of, :required, :foreign_type, :polymorphic, :touch, :counter_cache
[23:54:11] hamster88: here is the full output of above error
[23:54:11] hamster88: http://pastebin.com/dMYppMNj
[23:55:46] hamster88: here is the gist url https://gist.github.com/anonymous/0eafbc985d11bbcf13b890a6eeb77f8b
[23:56:06] cnk: hamster88: I think you have a model with a misconfigured association -
[23:56:06] hamster88: I am not able to find where exactly this :optional is.
[23:56:21] cnk: look in your models files for the word optional
[23:56:38] hamster88: I looked for it but not able to find
[23:56:56] hamster88: on all files tbh but no where to be found
[23:56:59] cnk: OK then what have you changed since the last time the server ran correclty
[23:57:33] hamster88: nothing it was on AWS and all i did is just i cloned my git
[23:57:40] hamster88: to my local
[23:57:47] hamster88: it was running on AWS earlier
[23:58:31] hamster88: i just searched again for this :optional.. and honestly iam not able to find it :(