#RubyOnRails - 25 February 2018
« Back 1 day Forward 1 day »
[06:57:04] maryo: I am trying to run one of my existing rails application and getting a message something like this https://dpaste.de/bMuQ/raw any help would be appreciated.
[11:42:23] dminuoso: maryo: This happens when you use the rails binstub while your CWD is not inside a rails project folder.
[14:05:56] cstls: if i have a products model with a tags association, how can i return products that only have, say, 'tag1' and 'tag2' associated with them, and nothing else?
[14:08:35] maryo: dminuoso, Hi it seems like my environment is screwed some how. When I type "rails --version" outside the project directory it works fine. But inside the project directory it doesn't give out any results. Also typing "rails s" inside the project directory is giving out an error like this https://dpaste.de/7Sss
[15:06:23] havenwood: You don't need gemsets these days with bundler and all, but some folk still use them.
[15:09:58] havenwood: maryo: An aside, but RVM recommends not using the root user. A non-root user installation will be in the user home directory.
[15:10:38] havenwood: maryo: If you want to keep using gemsets, a simple solution would be to: gem install bundler && bundle
[15:47:12] maryo: havenwood, is there a way to go back to bundler without using gemsets? I see Gemfile has all the gems listed there. I have cd into in the directory and done "bundle install" but even though when I execute "rails s" I still see the same message https://dpaste.de/bMuQ/raw
[15:49:16] havenwood: maryo: It's printing the help page like it's not in a Rails app root directory, hrmm.
[15:51:09] maryo: havenwood, I get this in the output "/usr/local/rvm/gems/ruby-2.4.1@rails-bootstrap/bin/bundle
[15:52:35] maryo: havenwood, that doesn't work either. Is there a way to remove gemset fully and use bindle ?
[15:55:09] havenwood: maryo: Yes, you can delete all your gemsets and disable gemsets with RVM. I'm always suspicious of root installs of RVM though. It's probably worth imploding RVM and reinstalling as a non-root user.
[15:57:48] havenwood: maryo: Or switch to something simpler that doesn't have gemsets like ruby-install/chruby.
[16:04:10] alexandernst: I'm trying to use pry in order to debug gitlab, but after I run "gitlab-rails console production" and "require 'pry'" irb says that it couldn't load such a file, but I know pry is installed
[16:05:03] maryo: havenwood, without sudo, I get "mktemp: failed to create file via template `/usr/local/rvm/rvm-exec-test.XXXXXX': Permission denied
[16:07:27] maryo: havenwood, also I believe earlier root installation affected all the user accounts. So do we need to first uninstall the ruby and rails completely from the root account?
[17:06:03] maryo: havenwood, great. I have done it and now able to execute curl command in the normal user account. Here is how it looks like https://dpaste.de/2uhU what would be next? Any thing else needs to be taken care?
[17:07:27] maryo: havenwood, ok before that do we need to source this >> "source /home/rails01/.rvm/scripts/rvm"
[17:07:59] havenwood: maryo: The RVM installation should have handled the sourcing in your dotfiles.
[17:09:11] havenwood: maryo: You might want to go ahead and set a default Ruby: rvm --default use ruby
[17:26:56] maryo: havenwood, can you please have a look at this result https://dpaste.de/Oxnn still something is missing I suppose
[17:31:43] maryo: havenwood, first gives me the help menu. Second gives me "-bash: bin/rails: No such file or directory
[17:32:22] havenwood: maryo: Ah, I see there's no bin/ dir. Is this an older Rails app? Can you show us the Gemfile?
[17:33:40] havenwood: maryo: After running `rackup`, in your browser you can see your app at: localhost:9292
[17:36:17] havenwood: maryo: Well, `rackup` does do the trick, but you'll probably want to track down why `rails s` isn't detecting it's a Rails app.
[17:37:52] havenwood: maryo: I guess you could trace through what `rails s` does and see where it goes awry.
[17:42:06] havenwood: maryo: You don't have a script/rails or bin/rails directory, which seems odd to me. A Rails 5.1 app should have a bin/ dir.
[17:42:35] maryo: havenwood, I have created a new test rails project and that seems to work for me https://dpaste.de/Buwy
[17:43:11] havenwood: maryo: I think the Rails app you were trying to run is just missing its bin/rails file.
[17:47:42] maryo: havenwood, how about copying the bin directory from new project to the problematic project. Will that make any difference?
[17:48:51] havenwood: maryo: I'm not sure if that's all that's missing, but yeah - if you can figure out what all was stripped and replace it I'd expect things to work. I'm a bit surprised that the `app:update:bin` task didn't work. Hrm. Maybe someone else will have an idea about what's wrong on that front.
[17:50:11] maryo: havenwood, by the way just to confirm things. I am running "rails app:update:bin" command inside the affected project. Hope that's correct
[18:18:49] maryo: havenwood, i have fixed the issue by copying the full bin directory to the affected project and it worked fine. Not sure how that happened. But somehow it is ok now. One more query if you have a little time. I do have one project which is running on old rails and here is how the Gemfile looks like https://dpaste.de/hPRc so to run this project do I need to create a separate environment ?
[18:37:09] maryo: havenwood, the app was running fine earlier without any issues but showing now an error with device gem -> https://dpaste.de/NJ5o
[18:50:43] maryo: havenwood, just a clarification. My other app uses 2.4.1 version of ruby. If i now do "rvm install ruby-2.3.6" will this overwrite the other version? Or I can have two versions?
[18:55:01] maryo: I have executed the above command and then during 'bundle exec rails s' I get "-bash: /usr/bin/bundle: /usr/bin/ruby: bad interpreter: No such file or directory
[19:00:35] schneider: ACTION https://www.facebook.com/groups/708874352499611/permalink/1664264323627271/
[19:06:17] maryo: havenwood, I have executed the above command and then during 'bundle exec rails s' I get "-bash: /usr/bin/bundle: /usr/bin/ruby: bad interpreter: No such file or directory"
[19:08:44] havenwood: maryo: If you want to auto-switch to 2.3.6 for this project: echo "ruby-2.3.6" > .ruby-version
[19:58:22] desnudopenguino: i'm working on adding rspec to my rails app for testing, but after add it to the gemfile and bundle install, i'm getting the following error when running `bundle exec rails generate rspec:install`:
[19:58:32] desnudopenguino: /home/yacfr/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/watcher/file.rb:19:in `initialize': Operation not supported - Failed to open file
[19:58:35] desnudopenguino: /usr/home/yacfr/yacfr/shared/sockets/puma.sock: File type not supported. (Errno::EOPNOTSUPP)
[21:21:42] Radar: Work in progress... but it should get you to the point of being able to figure out where `rails s` is going wrong.
[22:56:21] desnudopenguino: i ended up dumping my filesystem and doing a fresh pull from my git repo and it seemed to fix that issue.