« Back to channel list

#RubyOnRails - 20 April 2017

« Back 1 day Forward 1 day »
[00:08:26] quazimodo: has joined #RubyOnRails
[00:23:16] wethu: has joined #RubyOnRails
[00:32:46] Tempesta: has joined #RubyOnRails
[00:49:46] Technodrome: has joined #RubyOnRails
[00:53:20] chouhoulis: has joined #RubyOnRails
[00:58:56] segy: has joined #RubyOnRails
[01:02:30] duderono_: has joined #RubyOnRails
[01:06:38] quazimodo: has joined #RubyOnRails
[01:07:18] HoierM: has joined #RubyOnRails
[01:11:44] nahtnam: has joined #RubyOnRails
[01:19:37] adam12: has left #RubyOnRails: ("Leaving...")
[01:24:57] spicerack: has joined #RubyOnRails
[01:41:58] rfoust: has joined #RubyOnRails
[01:46:45] quazimodo: i'm confused
[01:46:51] quazimodo: why does devise need rememberable?
[01:47:39] quazimodo: i used to know, but now forgotten, if the rails session store is cookie, and the cookie is held by the browser, why we need rememberable, doesn't the cookie .... just exist with them signed in?
[01:48:03] quazimodo: or does the cookie that rails uses for session expire when the user closes the browser?
[01:49:30] quazimodo: maybe i'm holding the sessien cookie for too long
[01:52:22] quazimodo: ok. I understand now, everything is all good
[01:59:52] loy_aqua: has joined #RubyOnRails
[02:04:59] libastral: has joined #RubyOnRails
[02:17:18] irishfromua: has joined #RubyOnRails
[02:19:30] gusrub: has joined #RubyOnRails
[02:22:42] duderonomy: has joined #RubyOnRails
[02:31:12] fschuindt: Folks, I am trying to create a rails gem. What's the recommended way to pass configuration parameters to it?
[02:32:57] fschuindt: nvm, I found a good article: http://brandonhilkert.com/blog/ruby-gem-configuration-patterns/
[02:37:04] hndk: has joined #RubyOnRails
[02:51:30] mwlang: finally figured out the chicken/egg problem with capistrano deploy and rake version not existing.
[02:51:49] mwlang: turned out I had —local flag specified on line: set :bundle_flags, '--deployment —‘local
[02:52:18] bronson: has joined #RubyOnRails
[02:52:21] mwlang: (typoed that!). Anyway, removing —local fixed the deployments.
[03:00:25] sandstrom: has joined #RubyOnRails
[03:09:54] gusrub: has joined #RubyOnRails
[03:29:12] Trynemjoel: has joined #RubyOnRails
[03:31:25] cerulean: has joined #RubyOnRails
[03:32:41] ChanServ: -q *!*@174-29-46-3.hlrn.qwest.net
[03:32:54] Radar: cerulean: try now
[03:33:58] cerulean: ay mate thankeys
[03:34:29] cerulean: im playing with linux-mint, i just installed it and deleted windows
[03:34:48] cerulean: on an old asus i resurrected, the power cable was lost but i found it. haha
[03:35:05] cerulean: i was impressed with how i could get a 16gb Kingston USB stick for 8 bucks
[03:35:32] cerulean: just for fun and testing, main dev machine is stilla macbook pro haha
[03:59:22] mwlang: havenwood: thanks for the mina link. Definitely looks like something I’d seriously consider switching to.
[04:07:23] LastWhisper: hey guys random question -- I have a string = "Firstline\rSecondline" -- can I do string.include?(\r)
[04:08:09] oddalot: you don't have to surround it in quotes?
[04:08:50] erozas: has joined #RubyOnRails
[04:08:54] LastWhisper: i did string.include?('\r')
[04:09:00] LastWhisper: and it returned false :(
[04:09:12] oddalot: do you have to escape the \?
[04:09:20] oddalot: maybe '\\r'
[04:11:31] LastWhisper: nah :( didnt work either. Can I check for the hex value?
[04:12:00] LastWhisper: double quoted string!
[04:18:52] loy_aqua: has joined #RubyOnRails
[04:19:32] mwlang: LastWhisper: “"Firstline\rSecondline”.include?(“\r”) => true for me.
[04:19:45] mwlang: also, you can do: "Firstline\rSecondline" =~ /\r/
[04:20:30] cerulean: has left #RubyOnRails: ("bbl")
[04:29:28] aperkins81: has joined #RubyOnRails
[04:33:55] sdwrage: has joined #RubyOnRails
[04:37:16] rakm: has joined #RubyOnRails
[04:43:21] aperkins81: hi there, how do you loop through updating objects in a migration ignoring duplicate key constraints? (ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR).. have tried a rescue block in the loop and also a if !instance.update_attributes(...) next end .. and instance.try{ update_attributes ... } but all seem to abort the migration instead of skipping over
[04:44:10] aperkins81: normally i'd deal with checking the constraing but i'm looping through ~12 different models
[04:44:38] aperkins81: (cleaning up foreign key objects)
[04:45:15] aperkins81: s/constraing/constraint
[04:46:57] quazimodo: has joined #RubyOnRails
[04:47:55] aperkins81: this mess :P https://gist.github.com/aperkins81/81eaa7a4a4b033c5d258bba3f348f4f7
[04:52:37] bronson: has joined #RubyOnRails
[04:54:57] dminuoso: ACTION hands mwlang a docker container
[04:55:03] dminuoso: Here, use mine by the way.
[04:55:08] dminuoso: !goodmorning
[04:55:08] helpa: おはよう ございます
[04:56:20] mwlang: ACTION bookmarks docker for another day
[04:57:36] catbusters: has joined #RubyOnRails
[04:59:06] mwlang: what can I say? I’ve been capifying since oh, 2006 or 2007. Docker wasn’t even born then. But its definitely something climbing ever higher on my priority list.
[05:08:15] dminuoso: mwlang: Hehe, well Docker is certainly a bonus, especially since it fits well into already established puppet/chef/ansible worlds.
[05:11:26] jeyraof^mbpr: has joined #RubyOnRails
[05:11:48] mwlang: aperkins81: add unique validation on the field and then check instance.valid? before instance.save
[05:12:29] aperkins81: i want to skip over unique validation errors (eg dont create a record if it exists).. currently manually handling the case of the model with the constraint
[05:12:39] mwlang: depending on Rails version, I seem to recall issues with unique constraints from AR adapter poking through begin/rescue blocks
[05:13:13] mwlang: aperkins81: the gist you posted doesn’t have a begin / rescue block, btw.
[05:13:23] aperkins81: no, i tried 3 methods
[05:14:10] mwlang: aperkins81: what rails version?
[05:14:36] aperkins81: just trying with a begin / rescue block in the main inner loop
[05:15:38] mwlang: hmmm…can you put the begin / rescue back in and gist that?
[05:16:01] aperkins81: ok.. running it now it seems to be going...slowly :)
[05:18:55] Technodrome: has joined #RubyOnRails
[05:31:29] r3vDev: has joined #RubyOnRails
[05:46:00] aperkins81: mwlang, that got me passed the unique prob (correctly skips these cases) ... but now am debugging some cryptic postgres error with columns i've not seen... i'm sure it will get there though...
[05:46:08] aperkins81: updated gist
[05:46:50] Jameser: has joined #RubyOnRails
[05:47:24] mwlang: sounds like progress. the gist looks fine.
[05:48:16] aperkins81: have you seen the error at the bottom before?
[05:48:36] aperkins81: just came across it and researching now...
[05:53:27] bronson: has joined #RubyOnRails
[06:07:03] pLaTo0n: has joined #RubyOnRails
[06:12:52] morfin: has joined #RubyOnRails
[06:13:11] morfin: hello, which server do you prefer for production deployment?
[06:13:48] morfin: Seems like Rails 5 moved to Puma 3, or maybe go classic way with Unicorn?
[06:13:51] havenwood: morfin: Puma is the default Rack webserver. Apache or Nginx make a fine reverse proxy.
[06:14:00] morfin: ah, so Puma :)
[06:16:08] lele: has joined #RubyOnRails
[06:16:17] morfin: ACTION use Nginx as reverse proxy
[06:47:17] DoubleMalt: has joined #RubyOnRails
[06:50:02] r3vDev: has joined #RubyOnRails
[06:53:29] KorriX: has joined #RubyOnRails
[07:04:13] arBmind: has joined #RubyOnRails
[07:06:23] jeyraof^mbpr: has joined #RubyOnRails
[07:15:13] MissionCritical: has joined #RubyOnRails
[07:18:54] quazimodo: has joined #RubyOnRails
[07:25:28] sandstrom: has joined #RubyOnRails
[07:26:47] Qchmqs__: has joined #RubyOnRails
[07:37:25] wethu: has joined #RubyOnRails
[07:42:21] marr: has joined #RubyOnRails
[07:43:59] atrius: has joined #RubyOnRails
[07:50:50] conta: has joined #RubyOnRails
[07:58:04] workmad3: has joined #RubyOnRails
[08:03:14] srinidhi: has joined #RubyOnRails
[08:08:24] mikecmpbll: has joined #RubyOnRails
[08:09:40] Sigyn: has joined #RubyOnRails
[08:13:40] eyck: has joined #RubyOnRails
[08:16:29] sevenseacat: has joined #RubyOnRails
[08:31:48] rgr: has joined #RubyOnRails
[08:40:14] marr: has joined #RubyOnRails
[08:40:20] DrYockel: has joined #RubyOnRails
[08:43:17] jeyraof^mbpr: has joined #RubyOnRails
[08:55:19] lxsameer: has joined #RubyOnRails
[09:05:17] arBmind: has joined #RubyOnRails
[09:19:04] loy_aqua: has joined #RubyOnRails
[09:33:19] vedu: Hello. How can I pass a variable to my mail template after my mailer action is executed? The variable is created in the action
[09:36:26] tbuehlmann: vedu: not sure I understand. instance variables are available in the mailer template
[09:43:52] dminuoso: (This remark was inserted to keep tbuehlmann happy)
[09:44:39] tbuehlmann: I just waited for that to come, thanks!
[09:44:50] dminuoso: You're welcome.
[09:45:06] dminuoso: I have set up a daily schedule to ensure a healthy relationship, tbuehlmann.
[09:45:54] tbuehlmann: sounds reasonable
[10:00:12] Fernando-Basso: has joined #RubyOnRails
[10:03:25] cerulean: has joined #RubyOnRails
[10:03:43] ferr: has joined #RubyOnRails
[10:06:30] pawandubey: has joined #RubyOnRails
[10:08:34] pawandubey: We are facing a weird issue with Rails caching. Basically object instances are being cached by activerecord across different requests. Using reload fixes the issue. What can we do to avoid this?
[10:09:36] pawandubey: I know about using the uncached block, but the weird thing here is that objects are being cached even after they are modified
[10:09:45] cerulean: are you expiring your caches ever
[10:10:13] pawandubey: Yes caches expire every 15 minutes
[10:10:21] cerulean: race condition?
[10:10:37] cerulean: caching layer bug?
[10:10:41] cerulean: not expiring the right keys?
[10:11:18] pawandubey: I doubt it is a race condition - said code is not parallel. Not sure if that might be happening under the hood though.
[10:11:41] cerulean: so it comes through wrong on a link click then refresh fixes it?
[10:11:54] cerulean: sounds like page caching is conflicting with object caching
[10:12:01] cerulean: or lack of object caching
[10:12:12] pawandubey: Nope, refresh doesn't fix it. It's being cached by activerecord query cache.
[10:12:38] cerulean: reload means what then ?
[10:12:40] pawandubey: @model.reload
[10:13:03] pawandubey: It is peculiar as this is only happening with associations
[10:13:08] cerulean: sounds like you're failing to write the right data somewhere
[10:13:48] cerulean: probably the model caching layer doesnt understand associations
[10:14:07] cerulean: disable all caching and re-add it back properly
[10:14:16] pawandubey: So if there is a company with multiple users, and let old_users = @company.users, then @company.users.create!(..) then new_users = @company.users, we see that old_users == new_users
[10:14:56] cerulean: after the create! expire your cache
[10:15:00] pawandubey: But if we do a @company.users.reload! after the create method, it works as expected
[10:15:02] cerulean: every time you modify DB
[10:15:10] tbuehlmann: pawandubey: do you evaluate/load old_users? if not, it's an unloaded relation
[10:15:57] pawandubey: tbuehlmann: we do return old_users as a json response
[10:16:25] pawandubey: Shouldn't activerecord expire the query cache when it sees a create! on the users association?
[10:16:27] solars: has joined #RubyOnRails
[10:17:02] vedu: tbuehlmann: oh sorry. I was creating the instance variable in a an after_action
[10:17:15] solars: quick question: I always get an empty flash with the following minimalistic controller/view - can anyone tell me why this is? I thought if I add it to redirect_to it should be displayed https://gist.github.com/solars/206a7e21755c068a810968b0ab36aaca still on rails 4.2
[10:21:58] solars: is this maybe because of the before action?
[10:22:20] cerulean: has left #RubyOnRails: ()
[10:22:42] pawandubey: solars: are your Rails logs normal?
[10:25:16] solars: pawandubey: well they look normal
[10:28:29] GodFather: has joined #RubyOnRails
[10:29:38] pawandubey: solars: try flash.keep to persist the flash values for one request cycle before redirect_to
[10:32:31] solars: pawandubey: same result, doesn't help
[10:44:53] pawandubey: solars: what is at the end of new_payment_url?
[10:49:56] solars: pawandubey: how do you mean at the end?
[10:50:17] pawandubey: solars: I mean what does it point to in your routes file?
[10:56:18] catbusters: has joined #RubyOnRails
[10:56:23] DoctorMonocular: has joined #RubyOnRails
[10:58:06] solars: pawandubey: it's the default new action (see view template in the gist)
[11:07:07] quazimodo: has joined #RubyOnRails
[11:17:06] platoon23: has joined #RubyOnRails
[11:18:12] uksio: has joined #RubyOnRails
[11:18:19] KorriX: has joined #RubyOnRails
[11:22:07] rgr: has joined #RubyOnRails
[11:29:03] Ratler: has joined #RubyOnRails
[11:33:49] cheeti: has joined #RubyOnRails
[11:34:21] cheeti: hi hoe to hide error in production? config.consider_all_requests_local = false not working
[11:34:34] cheeti: hi how to hide error in production? config.consider_all_requests_local = false not working
[11:35:04] universa1: define: how to hide error? what do you want to do?
[11:35:12] universa1: not show the stack trace?
[11:35:24] universa1: just a generic 500 page?!
[11:35:33] cheeti: http://howtoprogram.eu/question/n-a,8792 this is not working
[11:36:05] universa1: cheeti: are you running in production mode?
[11:36:09] cheeti: universa1 i want to hide application error want to show 500 page
[11:36:15] universa1: *show hat you are actually running in production mode.
[11:36:33] cheeti: checking in server only
[11:36:48] cheeti: http://54.243.7.78/
[11:37:52] universa1: not seeing that it runs in production mode...
[11:38:22] pawandubey: cheeti: Rails automatically does that if you run with the environment variable RAILS_ENV set as production
[11:38:50] universa1: cheeti: show your vhost for apache please.
[11:39:12] cheeti: pawandubey can u please tell me how to set production environment
[11:39:35] universa1: you set it in the apache vhost.
[11:39:58] pawandubey: universa1: that depends on whether cheeti is using apache in the first place
[11:40:31] universa1: i think i saw it somewhere mentioned.
[11:40:48] universa1: pawandubey: yep: "I run my rails application (Rails 4.2.x) with the passenger module for Apache." on his link ;)
[11:42:26] pawandubey: cheeti: how are you starting the rails server?
[11:44:19] pawandubey: universa1: that question is almost an year old, so I doubt if this is the same person :P
[11:44:37] universa1: you'll never know
[11:44:57] universa1: but you are most likely right, didn't check it
[11:46:02] cheeti: pawandubey rails s
[11:46:19] universa1: so you are running in development mode.
[11:46:21] pawandubey: cheeti: replace that command with RAILS_ENV=production rails s
[11:46:32] universa1: or rails s -e production ;)
[11:46:46] cheeti: pawandubey i am checking in server
[11:46:49] pawandubey: Yes either of these will work
[11:47:03] loy_aqua: has joined #RubyOnRails
[11:47:08] cheeti: i am running sudo service apache2 restart
[11:47:12] universa1: brb, quickly need the keyboard at the tablet to reinstall it ;)
[11:48:20] cheeti: pawandubey testing in server using pem file not in local system
[11:48:35] cheeti: http://54.243.7.78/
[11:48:49] pawandubey: cheeti: Hmm, you don't need to do that if you've not configured Rails to use Apache as the server explicitly, just kill the Rails process and run the command mentioned previously
[11:48:57] pawandubey: What is a pem file?
[11:49:18] cheeti: AWS pem file
[11:49:41] pawandubey: Oh, you mean the security certificate file
[11:50:02] pawandubey: As long as you can access the terminal on your server it shouldn't matter
[11:51:20] cheeti: we can't run rails s in server
[11:51:22] bbrowning: has joined #RubyOnRails
[11:51:51] cheeti: how can i run in that RAILS_ENV=production rails s
[11:52:15] pawandubey: cheeti: can you clarify why can't you run rails s in server?
[11:52:49] pawandubey: If I understand this correctly you are using some SSH client to log into your server, right?
[11:53:03] cheeti: yes exact
[11:54:04] pawandubey: Okay, once you have done that you need to go to the directory where your app is, from your error page, it seems to be at /var/www/kb/
[11:54:30] cheeti: i modified config.consider_all_requests_local = false in config/environment/production.rb file and restart the server
[11:54:36] cheeti: but not working
[11:55:06] pawandubey: cheeti: after you modify any file inside config directory, you need to restart the server for it to take effect
[11:55:15] pawandubey: By server I mean the rails server
[11:55:41] cheeti: did this sudo service apache2 restart
[11:55:55] pawandubey: No, that restarts apache
[11:56:36] pawandubey: Rails doesn't use apache as it's server, so it doesn't do anything to Rails
[11:56:39] cheeti: how to restart?
[11:57:25] pawandubey: Navigate to the directory where your rails app is stored
[11:57:38] cheeti: ok after that
[11:57:39] pawandubey: You can do that by running cd /var/www/kb
[11:57:52] pawandubey: Then you need to kill the already running rails process
[11:58:38] cheeti: after that
[11:59:04] pawandubey: To do that, you need to get the process ID, which is stored in tmp/pids/server.pid in your rails directory, get that PID and kill that process
[11:59:33] pawandubey: Then run RAILS_ENV=production rails s from within your rails directory to restart the rails server
[12:00:17] watersoul: has joined #RubyOnRails
[12:04:01] cheeti: pawandubey there is no server.pid in that directory
[12:05:01] r3vDev: has joined #RubyOnRails
[12:05:15] cheeti: in sever we don't run application like rails s
[12:05:18] watersoul: has joined #RubyOnRails
[12:05:28] cheeti: i did't use that command at all
[12:05:41] pawandubey: In /var/www/kb/tmp/pids/server.pid ? If it is not there then you can check ps -aux | grep rails to see if there are any rails processes running
[12:06:32] pawandubey: If you don't get anything then just try to restart the server with RAILS_ENV=production rails s anyway.
[12:06:53] cheeti: yes i did that it's showing 15808 pts/0 S+ 0:00 grep --color=auto rails
[12:07:47] cheeti: if i run kill -9 15808 it's showing -bash: kill: (15808) - No such process
[12:08:17] ravster: has joined #RubyOnRails
[12:08:25] pawandubey: cheeti: Yes, because that is the result for the grep command you ran itself, which finishes by the time you see the result
[12:08:49] pawandubey: Can you tell me the result for lsof -wni tcp:80 and lsof -wni tcp:30000 ?
[12:09:12] pawandubey: * tcp:3000 in the second command, not 30000
[12:10:17] watersoul: has joined #RubyOnRails
[12:11:00] pawandubey: Okay then you can probably just run the restart command above
[12:11:43] cheeti: restart command?
[12:12:59] pawandubey: cheeti: yeah, but that depends on what server you are using for Rails. Have you configured it to use any specific server?
[12:13:09] pawandubey: How do you start your rails app on the server?
[12:13:18] universa1: pawandubey: X-Powered-By:Phusion Passenger 5.1.2
[12:13:24] universa1: Server:Apache/2.4.18 (Ubuntu)
[12:13:31] universa1: speeding it up a little ;)
[12:13:42] pawandubey: Ooo, I missed that
[12:13:57] universa1: pawandubey: nah, i just looked at the response headers
[12:14:03] universa1: so he didn't write it anywhere ;)
[12:15:25] watersoul: has joined #RubyOnRails
[12:16:11] pawandubey: universa1, yes I checked the response headers after you posted it :P
[12:17:12] cheeti: sudo service apache2 restart this only
[12:17:15] pawandubey: cheeti: so you are using apache, so you must have configured a virtual host file somewhere
[12:17:50] pawandubey: in that virtual host file, you probably have this line somewhere: RailsEnv development
[12:17:57] pawandubey: Replace it with RailsEnv production
[12:20:19] watersoul: has joined #RubyOnRails
[12:23:59] cheeti: y all those things in gemfile group :development do gems not loading in server
[12:24:09] cheeti: y this not working
[12:24:51] pawandubey: cheeti: that is the intention. gems in group :development only load in development environment
[12:25:06] cheeti: this means in server running in production level only
[12:25:20] watersoul: has joined #RubyOnRails
[12:25:24] cheeti: y config.consider_all_requests_local = false this is not working
[12:26:54] pawandubey: cheeti: did you try restarting apache after modifying the virtual host file?
[12:32:17] ableto: has joined #RubyOnRails
[12:47:51] quirkycoders: has joined #RubyOnRails
[12:51:03] quirkycoders: So yesterday I restored my database and run my migration which worked initially. I have a couple migrations that create a boolean column and then set the value to 'false'...however now when does not set the values and I get a 'nil' when I check the values after the migration. Any ideas?
[12:51:35] quirkycoders: https://gist.github.com/1af8a1546d04984067989911f1b3e047
[12:52:06] quirkycoders: ^ one of the files that should create the column and set values to false.
[12:53:35] cerulean: has joined #RubyOnRails
[12:53:43] cerulean: i just had the most enjoyable like day of rails coding
[12:53:51] pawandubey: quirkycoders: specify the default value along with the add_column method. Specifying it afterwords doesn't affect records created before.
[12:53:56] cerulean: i invented what i believe to be the best audio player on the internet
[12:55:26] quirkycoders: I initially tried that but postgres doesn't like setting values that way. I did it the recommend way. Create the column then set the values then create the default that will be used for new records.
[12:55:40] cerulean: has left #RubyOnRails: ()
[12:56:32] quirkycoders: I guess my point is that it worked when I did it initially but now when I restore the db and run migration it doesn't work so I'm kinda scratching my head on that one.
[12:56:48] pawandubey: quirkycoders: what is the problem with postgres? I use postgres in production and set defaults along with add_column and it always works fine
[12:57:58] pawandubey: I guess you can check if the changes have been propagated to postgres
[12:59:30] arBmind: has joined #RubyOnRails
[13:03:00] quirkycoders: hmmm...yeah I just did it and it didn't complain this time but it still didn't set the values either.
[13:03:01] quirkycoders: https://gist.github.com/2b71bc67e5b2947e2c53ed95c4f68227
[13:03:34] quirkycoders: Spree::Program.last(10).map(&:alert_admins2)
[13:03:34] quirkycoders: => [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
[13:06:53] pawandubey: Hmm, very weird. Can you try adding null: false to the options and see if that works out fine?
[13:07:20] quirkycoders: pawandubey: I agree...like I said it was working now it's acting weird.
[13:08:15] pawandubey: I have never seen that happen, but maybe I have never had to use a boolean column like that. But on the other hand since nil is a falsy value, you can use it instead of false in predicates
[13:08:39] pawandubey: So maybe it's a data saving strategy by the postgres adapter
[13:08:55] pawandubey: Purely speculating here
[13:09:30] quirkycoders: Yeah I'm almost thinking there's a problem with my postgres installed but not sure where to start as far as diagnosing the problem.
[13:10:22] pawandubey: This passes both nil: false and default as well https://robots.thoughtbot.com/avoid-the-threestate-boolean-problem
[13:12:03] Jameser: has joined #RubyOnRails
[13:13:18] quirkycoders: fyi...this is the error I get when doing default in add_column.
[13:13:23] quirkycoders: Adding a column with a non-null default requires
[13:13:23] quirkycoders: the entire table and indexes to be rewritten. Instead:
[13:13:23] quirkycoders: 1. Add the column without a default value
[13:13:25] quirkycoders: 2. Commit the transaction
[13:13:27] quirkycoders: 3. Backfill the column
[13:13:29] quirkycoders: 4. Add the default value
[13:18:17] rfoust: has joined #RubyOnRails
[13:18:53] pawandubey: That is understandable - not a postgres issue, just how relational databases work.
[13:19:29] pawandubey: Doesn't explain why you would get nil values for records which explicitly set the value
[13:20:19] quirkycoders: yeah I agree...that's just why I didn't do the everything as a one liner...it complains when I do so...somewhat consistently
[13:20:30] jphase: has joined #RubyOnRails
[13:20:48] dblessing: has joined #RubyOnRails
[13:32:00] Pumukel: has joined #RubyOnRails
[13:33:18] DLSteve: has joined #RubyOnRails
[13:33:57] agent_white: has joined #RubyOnRails
[13:36:53] agent_white: Mornin' folks
[13:39:25] Fernando-Basso: has joined #RubyOnRails
[13:39:36] Jameser: has joined #RubyOnRails
[13:39:47] patarr: has joined #RubyOnRails
[13:50:50] loechel: has joined #RubyOnRails
[13:52:14] bachmann: has joined #RubyOnRails
[14:01:33] bbrowning_: has joined #RubyOnRails
[14:19:40] akshat: has joined #RubyOnRails
[14:24:02] ravster: agent_white: good morning
[14:26:39] quirkycoders: has joined #RubyOnRails
[14:30:44] Skull0Inc: has joined #RubyOnRails
[14:31:38] mordof: has joined #RubyOnRails
[14:31:44] donnib: has joined #RubyOnRails
[14:32:36] donnib: hi, i have an onclick here : https://bitbucket.org/nmuldoon/moodapp2/src/072da1ff37c2020f0f50dffd2e12dcfd1321fc8a/app/views/locations/_options.html.erb?at=master&fileviewer=file-view-default#_options.html.erb-7
[14:32:44] donnib: this does not work well on iPad
[14:32:54] donnib: how can i change that to addEventListener ?
[14:33:13] mordof: I'm upgrading from Rails 4.2.6 to 5.0.2. in my application.rb I have a config.to_prepare block with some devise skip_before_filter calls - referring to methods/before_filters set up in my application controller. In Rails 4.2, those had no difficulty - in Rails 5, it now says that the methods are not found. Did the to_prepare block change scope? T
[14:33:13] mordof: rying to find a resolution for this
[14:37:53] hive-mind: has joined #RubyOnRails
[14:39:46] daveomcd: has left #RubyOnRails: ("Leaving")
[14:40:03] daveomcd: has joined #RubyOnRails
[14:40:19] mordof: oh.. it looks like it's nothing to do with to_prepare, but the way Devise changed how it handled the skip_before_filter. now it confirms the method exists right away - it apparently doesn't do that with the older version of devise.
[14:41:43] chouhoulis: has joined #RubyOnRails
[14:42:26] ableto: has left #RubyOnRails: ("Leaving")
[14:42:27] chouhoulis: has joined #RubyOnRails
[14:44:49] am55: i've been wondering how to see which index pg is using when it executes a query
[14:45:10] harfangk: has joined #RubyOnRails
[14:46:35] am55: or better, how to pass that to the puma log along with the queries
[14:47:00] mordof: so my issue is an ActionPack issue, not a devise one.. hmm
[14:50:14] pawandubey: am55: using .explain will tell you how the db is planning the query (including which indexes it is using)
[14:50:27] pawandubey: eg User.find(1).explain
[14:50:44] polishdub: has joined #RubyOnRails
[14:51:05] pawandubey: http://edgeguides.rubyonrails.org/active_record_querying.html#running-explain
[14:52:39] ResidentBiscuit: has joined #RubyOnRails
[14:53:04] ResidentBiscuit: has joined #RubyOnRails
[14:55:41] jphase: has joined #RubyOnRails
[14:57:25] Macaveli: has joined #RubyOnRails
[15:01:19] am55: pawandubey, thanks!
[15:03:19] theunraveler: has joined #RubyOnRails
[15:06:01] G: has joined #RubyOnRails
[15:12:03] r3vDev: has joined #RubyOnRails
[15:14:04] kristofferR: has joined #RubyOnRails
[15:15:28] MissionCritical: has joined #RubyOnRails
[15:19:49] mordof: is it too soon to update a production application to rails 5? there's a bunch of stuff lagging behind the release, and i'm starting to question if i should be putting the time into it right now
[15:23:06] havenwood: mordof: I went ahead and pulled the trigger and am glad I did. What gems are lagging behind?
[15:23:37] rakm: has joined #RubyOnRails
[15:23:46] Technodrome: has joined #RubyOnRails
[15:23:58] mordof: jquery-rails i had to fork. rails-dev-boost i commented out. mostly inconsequential for now. apidock isn't up to date with code - but in the topic here i found the api.rubyonrails.org is the new place to look there, so that's fine
[15:24:34] havenwood: mordof: I figured anything that hasn't fallen in line at this point needs a good look.
[15:24:59] havenwood: 5.1 in release candidate already and all.
[15:25:40] mordof: it was like June 2016 or something when 5 was initially released. there's just so many little things I keep hitting, lol... I guess it's gonna be a long road regardless for this update
[15:26:04] mordof: i'm mainly past gem incompatibilities.. now just hitting repeated conflicts in the code
[15:26:25] AzaToth: has joined #RubyOnRails
[15:28:03] romeoh: has joined #RubyOnRails
[15:29:58] mordof: havenwood: nevermind - i just got a page to finally load, lol. thanks for the feedback :)
[15:30:05] mordof: progress~
[15:40:29] linetrace: has joined #RubyOnRails
[15:41:07] linetrace: How would I call some_method in my ApplicationController from the rails console?
[15:42:55] mordof: depending on how you want things to go - ApplicationController.new.some_method... though i'm not sure that's what you really want
[15:44:12] linetrace: mordof: ah, right, need to instanciate it first. doh!
[15:44:26] Macaveli: has joined #RubyOnRails
[15:45:11] linetrace: mordof: sadly, some functionality that really should be in a rake task, but some old code/bad habits stick in this codebase
[15:45:55] mordof: pull one out every so often :)
[15:46:01] mordof: like the one you're trying to use now
[15:46:07] Skull0Inc: has joined #RubyOnRails
[15:49:34] patarr: I'm following the documentation on ActionMailer and have configured config.action_mailer.smtp_settings in an initializer. But whenever I try to deliver_now, it tries localhost:25
[15:49:39] patarr: Why is it disregarding my configuration?
[15:49:56] username1: has joined #RubyOnRails
[15:50:54] Derperperd: has joined #RubyOnRails
[15:51:07] Skull0Inc: have you tried .. config.action_mailer.delivery_method = :smtp
[15:51:36] Skull0Inc: config.action_mailer.smtp_settings = {
[15:51:36] Skull0Inc: address: 'smtp.gmail.com',
[15:51:37] Skull0Inc: port: '587',
[15:51:37] Skull0Inc: domain: 'localhost',
[15:51:37] Skull0Inc: authentication: "plain",
[15:51:39] Skull0Inc: enable_starttls_auto: true,
[15:51:41] Skull0Inc: user_name: ENV['GMAIL_USERNAME'],
[15:51:44] Skull0Inc: password: ENV['GMAIL_PASSWORD']
[15:52:40] mordof: oh - that's needed now?
[15:52:44] Skull0Inc: well, that's for localhost setup. Have to find a way to set ENV variables... currently I'm using Figaro and also have to add the /config/application.yml to spring watch list
[15:52:49] patarr: Skull0inc: That is exactly what I have.
[15:53:40] Skull0Inc: the trouble I found was an authentication issue where it wasn't picking up my ENV variables..check in rails console ENV['var_name']
[15:54:06] Skull0Inc: I'm having trouble setting up in production on Heroku now.
[15:55:47] Skull0Inc: make sure to have the above setting correctly placed in either config/environments/[development,production].rb
[15:56:11] Skull0Inc: Are you trying on localhost or production?
[15:56:44] patarr: Skull0inc: the issue is it's trying to send to localhost
[15:57:07] Skull0Inc: what error do you get/
[15:57:07] patarr: Skull0inc: I didn't place it in environments/. I put it in an initializer, as I want all environments to have that configuration
[15:57:26] patarr: Socket error trying to connect to localhost on 25. Fairly evident it's trying to send using defaults.
[15:59:18] Skull0Inc: I haven't tried in initializers, but did get mail to send using localhost setup with it placed in development.rb; However it *should* work in either case.
[16:00:25] patarr: ACTION sighs
[16:00:29] patarr: It's always a struggle with Rails.
[16:00:39] Skull0Inc: I actually came here to ask the community: Whats the most dead simple non-gem way to send mail from contact form?
[16:01:10] Skull0Inc: I could send mail in Ruby no problem. But didn't see why sending mail in Rails seems kind of complicated.
[16:01:43] hobodave: has joined #RubyOnRails
[16:05:26] mordof: Skull0inc: we're sending email using Net::SMTP.start <details> do |smtp| smtp.send_message; end in places where we don't use the rails pattern
[16:06:04] mordof: though i'm not entirely certain that doesn't use some configuration or tie to rails stuff... but it looks simple
[16:07:43] pLaTo0n: has joined #RubyOnRails
[16:08:42] Skull0Inc: so just put that in a function call. Do you do any mail queuing? I've read articles where people may set up a queuing system..just thought, that seems a lot for sending a message.
[16:08:43] mordof: it seems we have a patch to use TLS with SMTP though - https://github.com/ambethia/smtp-tls
[16:09:13] mordof: http://stackoverflow.com/questions/1049708/send-email-from-ruby-program-with-tls
[16:10:40] mordof: Skull0inc: for normal email sending, we use the rails actionmailer stuff - sending through mandrill to track our emails. we don't use this approach everywhere
[16:10:55] Skull0Inc: there we go, sending mail from <some_chosen_address> to <any_other_address>
[16:11:54] Skull0Inc: so actionmailer would be the prefered way of dealing with mail?
[16:12:44] Skull0Inc: I'm just interested in sending mail notification from a contact form rather than newsletter type mail.
[16:12:44] mordof: that's the built-in way for rails, yes. it hooks into view rendering, so you can use your normal html views for your emails
[16:13:33] Skull0Inc: yea, its pretty cool that it has templates and that stuff.
[16:14:52] Skull0Inc: Works on localhost sending mail from a non-db type model. just having trouble sending from Heroku. Probably a Google authentication issue..
[16:15:30] Skull0Inc: but was thinking of not having to connect to google to send a notification mail message.
[16:15:33] mordof: maybe not authentication - but it's possible google filters out email from heroku by default
[16:15:59] HoierM: has joined #RubyOnRails
[16:16:29] mordof: Skull0inc: smtp servers have to do a large amount of spam detection to try and protect email inboxes - it really depends on the email you're trying to send, the headers, where it's coming from (if it's trusted), etc if gmail will let it go through
[16:16:51] patarr: Skull0inc: so apparently putting it in the environment configuration files helped.
[16:16:54] patarr: ACTION shakes head in dismay
[16:17:00] Skull0Inc: okay, not sure if I'm doing this correctly...but it seems from most guides setting up that: I connect to my Gmail account to send mail, so i'm connecting to gmail through Heroku to send mail.
[16:17:18] Skull0Inc: it was the ENV vars for me...check in console.
[16:18:34] mordof: patarr: could it be that you're trying to set the config the wrong way in general in the initializers? if you're in an environment file block - the config object is there already. in the initialiser files they can sometimes be referenced differently
[16:18:44] Skull0Inc: if you get time chekc out: https://12factor.net/
[16:19:21] Skull0Inc: I know I still have to check it out.
[16:19:38] mrbubbles: has joined #RubyOnRails
[16:20:53] mrbubbles: Hey folks, I'm haivng a bit of trouble overriding a method in a module. I'm trying to reopen this file: http://bit.ly/2ovbNGN
[16:21:06] mordof: Skull0inc: our application meets most of those... but some of them that we haven't met get in our way from time to time, lol. that's a good breakdown of goals
[16:21:25] mrbubbles: and I want to override the page_title method. I've created helpers/alchemy/pages_helper_decorator and the first line is: Alchemy::PagesHelper.module_eval... is that wrong?
[16:22:08] mordof: module_eval is a thing? i've only ever used class_eval (probably because i've only done this for classes)
[16:22:53] mordof: mrbubbles: that should be fine
[16:24:09] Skull0Inc: mordof:that leaves the question:"...so what's your app?"
[16:26:36] mordof: Skull0inc: checking if i'm allowed to share that, lol
[16:27:19] mordof: it's basically just an app for collecting lots of data for people and aggregating it/allowing for easier planning of things
[16:27:28] mordof: platform of tools/info i guess
[16:28:02] Skull0Inc: its ok if not, i understand :)
[16:28:45] mordof: we're at about 260k lines of code though for everything (also including stuff detached from rails entirely).. so we do have lots of moving parts
[16:28:47] Skull0Inc: i'm looking to do something similar
[16:29:32] Skull0Inc: Dashboard kind of stuff...have you ever done stuff like that?
[16:29:51] mordof: we have a dashboard system with widgets and things
[16:30:10] gusrub: has joined #RubyOnRails
[16:30:14] Skull0Inc: ever used dashing or just built your own?
[16:30:40] mordof: ACTION checks it
[16:30:40] Skull0Inc: dashing is a gem i came across specifically used for dashboard creation by Shopify
[16:30:48] smoitra: has joined #RubyOnRails
[16:31:51] Skull0Inc: this is one of my first projects, and considering using such a thing to get a cool dashboard.
[16:32:18] mordof: our dashboard system is more complex than that - but it may have worked out for what we needed.. not sure
[16:32:25] mordof: we used gridstack, and then build around that
[16:35:19] Skull0Inc: wow, thats pretty cool.
[16:37:00] baweaver: tends to be one of the industry standards anymore
[16:37:01] Skull0Inc: have to make considerations on all aspects to best way to build. its going to be heavy JS no matter what.
[16:37:21] baweaver: Written in Go/AngularJS
[16:38:05] mordof: Skull0inc: if there's not very much user interactivity/animation, then it doesn't need js at all
[16:38:21] mordof: Skull0inc: it's only if you want to go interactive-heavy that js ends up being super involved
[16:38:30] Skull0Inc: people always want charts
[16:38:40] mordof: charts can be rendered server-side
[16:38:50] mordof: it really depends on what you need
[16:39:00] mordof: but there's lots of client-side libraries for charts that make it simple to use
[16:39:08] mordof: so if you don't need to shy away from JS, probably stick to using them
[16:39:15] Skull0Inc: I don't really like too interactive heavy.
[16:39:31] mordof: baweaver: open source.... hmmm.. that looks really cool
[16:39:40] Skull0Inc: just get simple display for updates and go from there if anything needs extending.
[16:39:42] mordof: we use Librato right now for our stuff
[16:39:48] mordof: this looks like an interesting competitor
[16:40:22] baweaver: Grafana is used by a number of large companies, ourselves included
[16:40:44] mordof: baweaver: have you used librato at all? wondering if there's considerable differences
[16:42:47] mordof: baweaver: am i understanding correctly that Grafana is free for commercial use if you don't want the support plan and premium plugins, etc?
[16:42:56] mordof: for self-hosted obviously
[16:42:59] mordof: whoa man..
[16:43:06] mordof: ACTION is intrigued
[16:43:31] baweaver: We have about 40 TVs with random Grafana charts around the office at least
[16:43:51] baweaver: and that's only because we're in the SF satellite office.
[16:43:53] mordof: baweaver: what data store do you use for it?
[16:44:01] baweaver: Currently OpenTSDB
[16:44:45] mordof: Grafana just plugs into that seamlessly i'm guessing?
[16:44:52] baweaver: More or less
[16:45:15] mordof: obviously with configuration of where to look, what metrics to pull in - setting up graphs, etc
[16:45:24] baweaver: I'd like to be able to use something else because HBase and all that is a bloody pain to maintain
[16:45:40] baweaver: you can have multiple data sources as well
[16:45:56] mordof: this is so off topic.. heh
[16:46:03] mordof: can i send you a message?
[16:46:11] baweaver: #ruby-offtopic works too
[16:46:24] baweaver: though I don't see this as a particularly big issue
[16:47:11] mordof: are there other options for a data store with Grafana? i'm asking a lot of questions i'm sure that the answers are on their website.. somewhere... heh
[16:47:33] mordof: oh there they are
[16:52:21] mikecmpbll: has joined #RubyOnRails
[16:54:43] Aytan72: has joined #RubyOnRails
[16:57:55] gusrub: has joined #RubyOnRails
[17:27:30] mrbubbles: I've been building a Spree shop but it just dawned on me that I should have set up Paperclip to upload the images to S3. I know that I can add this (it's well documented) but will I need to reload all the images, or can I just have Paperclip upload them somehow?
[17:31:09] quirkycoders: has joined #RubyOnRails
[17:33:09] mordof: mrbubbles: i don't know the answer directly - but two thoughts come to mind about it. 1) if paperclip stores a reference to images it has uploaded somewhere locally so it can work with files remotely, you'd need to populate that (doubtful, even if it does probably a way to backfill it). 2) the format with which paperclip tries to upload filenames m
[17:33:09] mordof: ay differ from how you're currently doing things, which may cause complications. possibly some updates to files already uploaded might be necessary
[17:33:26] mordof: mrbubbles: other than that, i can't think of reasons why paperclip wouldn't work
[17:33:31] mrbubbles: Okay thanks mordof
[17:33:40] mordof: doesn't mean i didn't just miss something though...
[17:34:04] mordof: you're welcome
[17:34:15] mrbubbles: I'll set up paperclip to use s3, try uploadng a file, check the DB and see how it references each and then see if I can just transfer the files to S3 and then update the references manually
[17:34:41] brent__: has joined #RubyOnRails
[17:36:19] brent__: Sometimes my production rails console will quite unexpectedly and randomly, any idea what could cause that? It doesn't show any error, just changes form an irb line to a bash prompt
[17:39:27] Fernando-Basso: has joined #RubyOnRails
[17:47:35] cseder: has joined #RubyOnRails
[17:48:25] Technodrome: has joined #RubyOnRails
[17:49:03] jaequery: has joined #RubyOnRails
[18:01:45] sdwrage: has joined #RubyOnRails
[18:16:24] rakm: has joined #RubyOnRails
[18:18:48] bronson: has joined #RubyOnRails
[18:18:52] defsdoor: has joined #RubyOnRails
[18:29:33] hobodave: has joined #RubyOnRails
[18:33:42] cseder: has joined #RubyOnRails
[18:41:49] mordof: in rails 5 - the belongs_to is now required. does that hold true same for the has_and_belongs_to_many? or is it strictly belongs_to?
[18:47:23] hobodave: has joined #RubyOnRails
[18:51:10] Macaveli: has joined #RubyOnRails
[19:07:07] pupsicle: habtm uses a join table so your question doesn't really make sense
[19:07:24] pupsicle: The association itself isn't stored in the model so it can't be required.
[19:13:50] dblessing: has joined #RubyOnRails
[19:35:23] targaf: has joined #RubyOnRails
[19:36:45] arBmind: has joined #RubyOnRails
[19:40:15] greengriminal: has joined #RubyOnRails
[19:42:11] srinidhi: has joined #RubyOnRails
[19:57:10] juggler: has joined #RubyOnRails
[19:59:32] amperry: has joined #RubyOnRails
[20:01:25] amperry: hey folks, got a problem with a view: I'm trying to present a form where people can edit the :start_date and :end_date of an existing object, but I can't get the value to display using: '<%= f.date_field :start_date, value: @hold.start_date %>'
[20:02:41] amperry: a calendar select appears, but the value shows as 'mm/dd/yyyy'.
[20:04:57] srinidhi: has joined #RubyOnRails
[20:12:17] hahuang65: has joined #RubyOnRails
[20:12:25] username1: has joined #RubyOnRails
[20:15:01] Aytan72: I think you can omit the value portion, <%= f.date_field :start_date %>
[20:16:14] lxsameer: has joined #RubyOnRails
[20:19:20] Macaveli: has joined #RubyOnRails
[20:21:15] hobodave: has joined #RubyOnRails
[20:28:20] yebyen: man, i have a problem and I think that it would not be a problem if I could just upgrade to Rails 5
[20:28:25] yebyen: but I'm still on 4.2.7.1
[20:28:54] yebyen: I needed to do an ".or" and that's not a thing before Rails 5, for some reason
[20:29:01] yebyen: as in ActiveRecord
[20:29:38] dminuoso: yebyen: Use arel
[20:29:51] yebyen: dminuoso: already found that
[20:30:05] yebyen: if you can tell me how to get an ActiveRecord::Association back out of Arel that will solve my problem
[20:30:11] yebyen: but I'm trying to use arel with filterrific
[20:30:16] yebyen: and there is no documentation about that at all
[20:30:20] dminuoso: yebyen: You can pass an arel table to .where
[20:30:30] dminuoso: AR knows how to make that happening.
[20:30:47] yebyen: wait a second
[20:30:56] yebyen: you're telling me i do have an association
[20:30:57] cagomez: has joined #RubyOnRails
[20:31:07] dminuoso: Wait, association?
[20:31:22] yebyen: yeah like something I can apply further scopes to
[20:31:35] dminuoso: No, you're kind of fucked.
[20:31:47] yebyen: yeah! answering the important questions :D
[20:32:03] dminuoso: yebyen: Just write your queries in raw SQL.
[20:32:12] dminuoso: It's more easily expressed anyway.
[20:32:12] yebyen: that's exactly what I was thinking
[20:33:00] yebyen: that is a good answer, thanks
[20:33:14] yebyen: are you going to railsconf by chance, i'll buy you a beer
[20:34:47] yebyen: that was more help than I got from google, anyway
[20:34:51] yebyen: "ok, then don't do that"
[20:38:17] rgr_: has joined #RubyOnRails
[20:40:16] dminuoso: yebyen: There's metric tons of idiots on SO trying so hard to avoid writing SQL, that they end up writing completely incomprehensible arel code, sql fragments mixed with weird ruby code, etc..
[20:40:34] dminuoso: It's even more surprising that those answers often get upvoted and accepted..
[20:41:43] yebyen: http://cha1tanya.com/2013/10/26/preload-associations-with-find-by-sql.html
[20:42:07] yebyen: and calling undocumented methods to get around not having features that don't exist
[20:42:31] yebyen: that one got me 98% of the way to where I need to be
[20:43:34] yebyen: since I had to eager_load because otherwise this dashboard runs about 150 queries per render!
[20:46:59] yebyen: i've got a pretty nasty query going here
[20:47:59] Technodrome: has joined #RubyOnRails
[20:48:14] dminuoso: yebyen: Or you know. Upgrade to Rails 5?
[20:48:17] dminuoso: It's not major.
[20:48:30] dminuoso: The effort is really small compared to previous major upgrades.
[20:48:41] yebyen: oh i'm pretty sure we should do that
[20:48:48] yebyen: but then i think we might as well upgrade to foundation 6 as well
[20:49:01] dminuoso: yebyen: These two are not linked.. at all..
[20:49:18] amperry: has left #RubyOnRails: ("ERC (IRC client for Emacs 24.5.1)")
[20:49:28] yebyen: it is if you have foundation theme in a gem provided by Marketing Communications department
[20:49:31] yebyen: and it's locked to rails 4
[20:49:45] yebyen: i guess I could upgrade MarCom's gem to Rails 5 and just leave it alone after that
[20:50:37] dminuoso: yebyen: Look at it and figure out whether it actually requires 4.
[20:50:46] dminuoso: It's quite possible that they are just dumb.
[20:51:38] yebyen: actually i'm looking at it now and it doesn't even look like it is locked
[20:51:43] yebyen: don't know where i got that idea
[20:52:13] yebyen: i think it's OK to put this one raw SQL query right here
[20:52:40] yebyen: we literally just went to production and there's a tight timeline for the next 2 months while we get out of pilot mode
[20:56:20] Skull0Inc: has joined #RubyOnRails
[20:59:43] workmad3: has joined #RubyOnRails
[21:00:17] sdwrage: has joined #RubyOnRails
[21:09:32] gambl0re: has joined #RubyOnRails
[21:16:06] amperry: has joined #RubyOnRails
[21:23:30] amperry: Hi folks, I've got a problem with a migration I'm running; it says that I have an undefined method `to_sym` in the file, but I don't see that string anywhere and I don't know what process is adding it. See: https://gist.github.com/amp108/6c3303d4397173b9a975581f7eb2e13b for details.
[21:23:37] kristofferR: has joined #RubyOnRails
[21:23:58] rakm: how would I create an ActiveRecord Relation object? I have a `Device.executions` in my model that is used in a a different domain object, which then calls .where() on it. I'd like to mock out this scope and have it respond appropriately to .where, but don't want to mock out the .where() method call
[21:24:21] havenwood: amperry: you have an instance of a Hash and it's trying to call #to_sym on it
[21:24:38] havenwood: amperry: it's expecting a String or Symbol where you're providing a Hash
[21:24:49] rakm: i'm thinking if i can create a AR Relation with the data I need, I can stub out the Device.execution scope
[21:25:42] rakm: tried ActiveRecord::Relation.new(Execution, 'executions'), but i'm not sure what that second argument is supposed to be other than it's called "table" and it is currently raising an error becuase it should respond to '.engine'
[21:25:51] amperry: havenwood: what's creating the Hash? More to the point, can you see what I'm trying to do with that migration and tell me what the line should look like? It worked on dev.
[21:26:45] havenwood: amperry: add_column(table_name, column_name, type, options = {})
[21:26:56] havenwood: amperry: you're not providing the first three, so your options are bleeding
[21:27:20] havenwood: amperry: (you're missing type)
[21:27:45] havenwood: amperry: for example: add_column :placements, :apt, :string, index: true, foreign_key: true
[21:27:52] amperry: if it's a foreign key, should I just add `:integer` there?
[21:27:56] havenwood: amperry: yup
[21:28:32] havenwood: amperry: or Rails 5 :bigint
[21:29:17] havenwood: I guess that's 5.1
[21:30:10] havenwood: https://github.com/rails/rails/pull/26266
[21:31:23] amperry: The real thing that confuses me is, why didn't I get this error on dev?
[21:31:51] amperry: I seem to be getting a similar error with subsequent migrations as well.
[21:51:10] amperry: how would I use db/schema.rb to update the db schema, rather than run migrations? Will it blow out the existing db, or is it smart enough not to do that?
[21:58:18] dminuoso: amperry: You wouldn't.
[21:58:29] dminuoso: amperry: Just use migrations.
[21:58:49] dminuoso: amperry: schema.rb is just a tool for setting up new databases to the latest known state.
[21:59:00] dminuoso: amperry: The logic to "apply differences" is called migrations.
[22:00:36] amperry: dminuoso: cool, was afraid that was the case.
[22:06:21] aperkins81: has joined #RubyOnRails
[22:13:46] havenwood: Aytan72: hi
[22:14:33] Aytan72: havenwood: hey hey
[22:20:48] gusrub: has joined #RubyOnRails
[22:25:12] quirkycoders: has joined #RubyOnRails
[22:26:24] truenito: has joined #RubyOnRails
[22:27:23] akshat: has joined #RubyOnRails
[22:29:46] aperkins81: has anyone ever come across this sort of error migrating data? https://gist.github.com/aperkins81/81eaa7a4a4b033c5d258bba3f348f4f7
[22:33:08] Technodrome: has joined #RubyOnRails
[22:33:28] quazimodo: has joined #RubyOnRails
[22:44:47] Aytan72: aperkins81: it looks like you are using a .where clause on a string object
[22:45:27] aperkins81: migration works for the first object and is failing on affiliation_costs
[22:45:39] aperkins81: constantize makes the string an object
[22:46:08] aperkins81: think will just do that the railsy way and skip it out of that loop
[22:46:19] aperkins81: eg AffiliationCost.where(event_type: event_types).update_all(event_type_id: EventType.where(name: 'Basic Contact').first.id)
[22:50:21] cagomez: has joined #RubyOnRails
[23:01:11] hahuang65: has joined #RubyOnRails
[23:23:29] irishfromua: has joined #RubyOnRails
[23:26:20] aperkins81: would be nice if rails had a .try_update_all() that only updated objects that dont fail unique key constraints ... looping through individual objects when there are ~150,000 using a begin update_attributes rescue block is too time consuming :| think will have to approach this another way
[23:31:48] Velizar_: has joined #RubyOnRails
[23:34:32] gusrub: has joined #RubyOnRails
[23:35:07] irishfromua: has joined #RubyOnRails
[23:42:13] lupine: arel time
[23:43:09] aperkins81: i thought it was best to avoid arel
[23:43:41] aperkins81: eg, differes from release to release or something
[23:43:48] aperkins81: s/differes/differs
[23:52:55] chouhoulis: has joined #RubyOnRails