« Back to channel list

#RubyOnRails - 18 May 2019

« Back 1 day Forward 1 day »
[00:04:24] atrius: has joined #RubyOnRails
[00:11:17] skryking: has joined #RubyOnRails
[00:25:19] octos: has joined #RubyOnRails
[00:26:23] brool: has joined #RubyOnRails
[00:36:22] orbyt_: has joined #RubyOnRails
[01:01:17] haxx0r: has joined #RubyOnRails
[01:27:51] orbyt_: has joined #RubyOnRails
[01:28:33] Technodrome: has joined #RubyOnRails
[01:46:24] randomuser1012: has joined #RubyOnRails
[01:51:36] randomuser1012: I'm having trouble starting up a postgresql database. The problem is that in order to run it, I need to make sure I run migrations first. In order to run the migrations I need to swap over to my postgres account, however, I get some errors when I try and do that.
[01:53:27] randomuser1012: I try and run `rake db:migrate` and I get a few `Ignoring GEM because its extensions are not built. Try: gem pristine GEM`
[01:53:34] randomuser1012: Has anyone come across this before?
[01:54:53] randomuser1012: https://dpaste.de/71HT
[01:56:15] haxx0r: has joined #RubyOnRails
[02:03:53] kapilp: has joined #RubyOnRails
[02:04:08] randomuser1012: Anyone come across this type of error? https://dpaste.de/71HT
[02:04:59] apparition: has joined #RubyOnRails
[02:05:42] weaksauce: probably a path issue with bundler
[02:14:03] randomuser1012: Yeah, I think you're right @weaksauce
[02:14:52] weaksauce: i imagine there is a way to change the path using a bundler setting to make it accessible to both users
[02:15:08] weaksauce: check the bundler settings
[02:15:21] randomuser1012: Will give that a go
[02:18:23] cjohnson: has joined #RubyOnRails
[02:35:27] s00pcan: has joined #RubyOnRails
[02:36:31] tf2ftw: has joined #RubyOnRails
[02:37:10] randomuser1012: thanks weaksauce
[02:37:48] weaksauce: you're welcome randomuser1012
[02:49:28] weteamsteve: has joined #RubyOnRails
[03:11:20] octos: has joined #RubyOnRails
[03:11:24] braincrash: has joined #RubyOnRails
[03:26:48] Technodrome: has joined #RubyOnRails
[03:50:29] aiguuu: has joined #RubyOnRails
[05:35:39] timdotrb: has joined #RubyOnRails
[05:59:19] s00pcan: has joined #RubyOnRails
[06:08:31] Exuma: has joined #RubyOnRails
[06:41:00] conta: has joined #RubyOnRails
[07:16:27] ellcs: has joined #RubyOnRails
[07:17:28] ellcs: has joined #RubyOnRails
[07:18:02] ellcs: has joined #RubyOnRails
[07:18:28] ellcs: has joined #RubyOnRails
[07:40:28] Technodrome: has joined #RubyOnRails
[07:57:11] duderonomy: has joined #RubyOnRails
[07:59:42] ellcs: has joined #RubyOnRails
[08:00:16] FastJack: has joined #RubyOnRails
[08:09:38] ravenousmoose: has joined #RubyOnRails
[08:39:33] Dbugger: has joined #RubyOnRails
[08:52:41] kapilp: has joined #RubyOnRails
[08:59:44] powerbit: has joined #RubyOnRails
[09:37:30] jefffrails35: has joined #RubyOnRails
[09:50:28] Saukk: has joined #RubyOnRails
[10:11:15] IGnorAND: @weaksauce I want an API app. However not all my data comes from a database. I have an external app with clients. I want to use this list of clients in my app. So when I do a GET /clients I want to call the index method in the controller which should perform an request on the other app instead of on the db.
[10:38:03] IGnorAND: My api however currently gives me a response with a data and meta hash. In the data I have an array of clients. I have been able to do the api request, however I want to output my code as JSON too, so I was thinking of using something like jsonapi. And I am somewhat succesful, but I feel I am doing something wrong
[10:38:05] IGnorAND: https://gist.github.com/nuheluxulu/7de68bd8968b96d970b5cc83c7edac48#file-clients_controller-rb-L9
[10:45:14] xco: has joined #RubyOnRails
[10:51:58] ravenousmoose: has joined #RubyOnRails
[10:55:46] lankanmon: has joined #RubyOnRails
[11:13:20] octos: has joined #RubyOnRails
[11:32:58] tf2ftw: has joined #RubyOnRails
[11:35:29] DTZUZO: has joined #RubyOnRails
[11:42:34] ravenousmoose: has joined #RubyOnRails
[11:51:04] apparition: has joined #RubyOnRails
[12:01:37] haxx0r: has joined #RubyOnRails
[12:23:21] randomuseragain: has joined #RubyOnRails
[12:24:57] randomuseragain: I'm having a problem trying to run migrations from my postgres account. I'm using my postgres account to communicate with the postgres db, however, when I try to run migrations I get this error: https://dpaste.de/71HT
[12:25:10] randomuseragain: It's possible that I have a path issue with bundler
[12:25:33] randomuseragain: Has anyone come across this error before?
[12:40:31] GodFather_: has joined #RubyOnRails
[12:41:44] randomuseragain: Anyone come across this issue before?
[12:42:17] randomuseragain: It may be an issue with bundler and its path
[12:43:09] GodFather: has joined #RubyOnRails
[12:55:41] Technodrome: has joined #RubyOnRails
[12:58:21] Exuma: has joined #RubyOnRails
[13:04:51] Sylario: has joined #RubyOnRails
[13:11:22] haxx0r: i want to make ActiveAdmin accessible only if you have a certain cookie, otherwise 404 is thrown. i have issues to hijack active_admin to inject that. so i wonder if i can inject that on routes level. maybe a constraint?
[13:15:17] Psy-Q: has left #RubyOnRails: ("Leaving")
[13:32:01] tf2ftw: has joined #RubyOnRails
[13:34:28] dustinm`: has joined #RubyOnRails
[13:34:52] zacts: has joined #RubyOnRails
[14:00:57] xco: has joined #RubyOnRails
[14:09:27] ravenousmoose: has joined #RubyOnRails
[14:21:07] defsdoor: has joined #RubyOnRails
[14:28:42] weteamsteve: has joined #RubyOnRails
[14:42:04] zacts: has joined #RubyOnRails
[14:56:53] randomuseragain: I'm having some issues with running migrations from my postgres account. When I try and run `rake db:migrate` I get the following errors: https://dpaste.de/71HT
[14:57:04] randomuseragain: Has anyone come across this before?
[14:58:02] randomuseragain: It may be an issue with bundler's path but I'm not too sure how to go about fixing it
[14:58:50] havenwood: randomuseragain: Usually it's due to multiple Rubies installed. Does it work with `bundle exec rake db:migrate`?
[14:59:18] havenwood: randomuseragain: Sanity check `which bundle` and `gem which bundler`? It's the right Ruby?
[15:00:41] havenwood: randomuseragain: From those warnings, look like you might need a: gem pristine --all
[15:01:33] havenwood: randomuseragain: In modern Rails, the `rake` commands are aliased to `rails`, so you can: bin/rails db:migrate
[15:02:05] randomuseragain: When I run `bundle exec rake db:migrate` I get https://dpaste.de/xJsN
[15:02:22] havenwood: randomuseragain: So first run just: bundle
[15:03:21] srinidhi: has joined #RubyOnRails
[15:04:21] weird_error: has joined #RubyOnRails
[15:04:28] randomuseragain: My postgres account doesn't have the rights to install system ruby gems - https://dpaste.de/kmv8
[15:05:33] randomuseragain: I get more of the same error when I use rails by the way
[15:05:48] randomuseragain: That's why I've tried just sticking with using rake
[15:06:11] havenwood: randomuseragain: It seems there are two Rubies involved here, a system one and an RVM one.
[15:06:21] havenwood: randomuseragain: Is Bundler installed on your current Ruby?
[15:06:27] havenwood: randomuseragain: gem which bundler
[15:06:33] havenwood: randomuseragain: If not: gem install bundler
[15:06:55] havenwood: randomuseragain: You need to be able to install the gems from the Gemfile.lock to run the app.
[15:07:12] havenwood: randomuseragain: As the error suggests, you can vendor them if you want to install locally in the app directory.
[15:07:27] randomuseragain: when I ran `gem pristine --all` I got the following https://dpaste.de/xrKW
[15:07:50] havenwood: randomuseragain: You don't have write permission for your own home dir?
[15:08:24] havenwood: randomuseragain: rvm fix-permissions
[15:08:30] randomuseragain: I do, but I have two different accounts
[15:08:39] randomuseragain: A postgres account
[15:08:43] randomuseragain: and my own account
[15:08:58] havenwood: randomuseragain: Install gems somewhere you have permission to install gems. Run `bundle` from the account that can install gems.
[15:10:31] randomuseragain: havenwood: I just tried checking if I could use bundle from my primary account and it looks like that isn't right either
[15:11:00] randomuseragain: gem which bundle ---> ERROR: Can't find Ruby library file or shared library bundle
[15:11:08] havenwood: randomuseragain: gem install bundler
[15:11:18] havenwood: randomuseragain: gem which bundler
[15:12:05] randomuseragain: ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /home/jrodr4544/.rvm/gems/ruby-2.6.0/gems/bundler-2.0.1/exe/bundle
[15:12:12] havenwood: randomuseragain: (there's an "r" in the gem name, but not the command)
[15:12:21] Exuma: has joined #RubyOnRails
[15:12:30] havenwood: randomuseragain: rvm fix-permissions
[15:13:22] havenwood: randomuseragain: Is that your own home dir? Seems there are a lot of permissions issues going on.
[15:17:01] LightStalker: has joined #RubyOnRails
[15:18:59] randomuseragain: havenwood: Well, I'm running bash in windows. Not sure if that might be part of the problem
[15:19:40] randomuseragain: havenwood: I now got it to install bundler
[15:20:06] randomuseragain: havenwood: had to run rvm fix-permissions
[15:20:12] havenwood: randomuseragain: ah, cool
[15:20:54] randomuseragain: gem which bundler /home/jrodr4544/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/bundler.rb
[15:25:17] randomuseragain: havenwood: I use my postgres account to run migrations. I can't do it from my primary account because `PG::ConnectionBad: FATAL: Peer authentication failed for user "postgres"`
[15:25:46] randomuseragain: My database.yml configuration has the user postgres configured
[15:26:55] randomuseragain: havenwood: Also, thanks for helping get the permissions fixed on my primary account
[15:27:23] havenwood: randomuseragain: Now that Bundler's working on your primary account, from there run: bundle
[15:29:28] randomuseragain: havenwood: Yup, I ran bundle
[15:31:08] havenwood: randomuseragain: Usually to share gems between accounts, you'd either use vendor gems locally into the app directory or use a system gem installation both can share. Alternatively, you could install gems separately for both accounts.
[15:34:41] Exuma: Hey, how do I get the URL to a CSS file instead of just the path? Similar to how the root_path vs root_url will take the path and the later will take the full current URL
[15:35:00] Exuma: I have ot interact with an API that requires me to pass a CSS file and i want to pass one of the compiled sass files in my app
[15:36:06] Exuma: css absolute url* - its a payment iframe so its going to be loading the file immediately in the iframe, which is why I need to do this quirky thing
[15:37:12] Exuma: I want it to be a 'one off' thing, i dont want to go messing with asset_host
[15:48:03] tf2ftw: has joined #RubyOnRails
[15:59:53] randomuseragain: havenwood: If i'm not mistaken, rake isn't a gem therefore, I should be able to use it from another account. In this case, my postgres
[16:01:53] havenwood: randomuseragain: Rake actually is a gem!
[16:02:19] randomuseragain: havenwood: whoops
[16:03:18] randomuseragain: havenwood: the only reason I have the postgres account is to be able to run migrations
[16:03:31] havenwood: randomuseragain: Along with did_you_mean, minitest, net-telnet, power_assert, test-unit and xml-rpc - rake is a "bundled" gem that ships along with Ruby.
[16:03:47] havenwood: Unlike default gems, which also ship with Ruby, bundled gems can be uninstalled.
[16:03:55] havenwood: Default gems can be updated, but not uninstalled.
[16:04:18] randomuseragain: Gotcha, so rake is a default gem
[16:04:25] havenwood: No, rake is a bundled gem.
[16:05:11] havenwood: But yes, it ships with Ruby.
[16:06:17] randomuseragain: I just realized I've got two different ruby versions running. In my postgres account - ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
[16:06:32] havenwood: Default gems are bigdecimal, io-console, json, openssl, psych, rdoc, rubygems, webrick, cmath, csv, date, dbm, gdbm, sdbm, etc, fcntl, zlib, strscan, stringio, scanf, ipaddr, fileutils and fiddle. A bunch were gemified from the stdlib in 2.5.
[16:06:40] randomuseragain: In my primary account - ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
[16:11:48] randomuseragain: havenwood: gotcha
[16:22:53] tdy: has joined #RubyOnRails
[16:29:11] pd09041999: has joined #RubyOnRails
[16:57:34] zacts: has joined #RubyOnRails
[17:11:38] orbyt_: has joined #RubyOnRails
[17:12:19] octos: has joined #RubyOnRails
[17:14:15] Fernando-Basso: has joined #RubyOnRails
[17:40:19] ravenousmoose: has joined #RubyOnRails
[17:41:08] eddof13: has joined #RubyOnRails
[18:00:45] deepredsky: has joined #RubyOnRails
[18:12:51] s00pcan: has joined #RubyOnRails
[18:18:08] zacts: has joined #RubyOnRails
[18:53:38] xco: has joined #RubyOnRails
[18:58:52] pd09041999: has joined #RubyOnRails
[19:18:44] weaksauce: perhaps changing bundle config path /some/shared/path would help randomuseragain
[19:19:15] weaksauce: but you do have to be on the same ruby
[19:21:26] weaksauce: IGnorAND not sure what your question is actually. can you be a bit more specific than "And I am somewhat succesful, but I feel I am doing something wrong"
[19:22:03] weaksauce: what is stopping you from converting the data to a json response directly?
[19:28:11] randomuseragain: weaksauce: Do you if there's a recommended path to share?
[19:28:34] randomuseragain: Do you know if there's a recommended path to share?
[19:29:06] weaksauce: i'm not sure but something accessible by both accounts and not likely to be overwritten by a cache purge.
[19:29:12] weaksauce: should work
[19:29:55] weaksauce: you can do it under ./vendor/bundler if you want. just .gitignore that directory
[19:30:16] randomuseragain: At the moment, I have bundler working on my primary account and when I run `rails db:migrate` I'm no longer getting the same errors as before
[19:31:42] randomuseragain: weaksauce: I'm getting this instead from my postgres account: https://dpaste.de/iqpE
[19:31:55] randomuseragain: To me, definitely made some progress
[19:32:28] weaksauce: well you do need bundler installed but you also need the same ruby
[19:32:52] weaksauce: you can try gem install bundler
[19:33:18] weaksauce: and move all the gems under the same path. in ./vendor/bundler
[19:33:29] weaksauce: after you make the config change you need to bundle install
[19:34:40] randomuseragain: weaksauce: `gem install bundler` gives me permission error ; gem install bundler Fetching: bundler-2.0.1.gem (100%) ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /var/lib/gems/2.5.0 directory.
[19:35:01] randomuseragain: from my postgres account
[19:35:13] weaksauce: that's because you are using the system ruby i guess.
[19:35:40] weaksauce: which ruby are you using on the other account?
[19:35:41] randomuseragain: It was working at some point
[19:36:05] randomuseragain: postgres - ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
[19:36:23] randomuseragain: primary - ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
[19:36:50] weaksauce: well that's part of the problem
[19:37:06] weaksauce: make both use ruby2.6
[19:37:55] randomuseragain: I tried doing that but im not able to use a version manager at the moment
[19:39:46] randomuseragain: Well, I'm trying to swap the version from my postgres account and i get: Command 'rvm' not found, but there are 21 similar ones.
[19:40:03] randomuseragain: Does the global option allow me to change it system wide?
[19:40:38] weaksauce: i don't use rvm sorry
[19:43:22] weaksauce: either install a system ruby and keep that up to date (not always the best move) or install rvm on the postgres account or set postgress permissions temporarily to install bundler or give your app account permissions to run db migrations
[19:59:01] ravenousmoose: has joined #RubyOnRails
[20:19:44] zacts: has joined #RubyOnRails
[20:30:36] randomuseragain: weaksauce: Thanks! Just got the migrations to work. Although I'm not sure if this was the appropriate way to go about it, I install rvm and bundler on postgres account and that led to successful migrations
[20:31:36] lato: has joined #RubyOnRails
[20:37:52] weaksauce: randomuseragain that works. i doubt there is a "best" way on things like that.
[20:58:50] choke: has joined #RubyOnRails
[21:04:56] choke: has joined #RubyOnRails
[21:13:06] choke: has joined #RubyOnRails
[21:13:21] zacts: has joined #RubyOnRails
[23:03:18] FastJack: has joined #RubyOnRails
[23:04:47] RiPuk: has joined #RubyOnRails
[23:25:11] uks: has joined #RubyOnRails
[23:30:42] zacts: has joined #RubyOnRails