I am still having trouble with Ruby on Rails. I run rails s (this is for my openproject app) and I get this (before it was working). I also wanted to make a note I am now using Ruby 2.0 and I still get the same error.
require 'rails/all'... 0.850s
Bundler.require... 7.700s
/home/bistro/openproject/config/application.rb:89:in `<class:Application>': uninitialized constant I18n::JS (NameError)
from /home/bistro/openproject/config/application.rb:61:in `<module:OpenProject>'
from /home/bistro/openproject/config/application.rb:60:in `<top (required)>'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
from /home/bistro/.rvm/gems/ruby-1.9.3-p484/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I'm working on a Rails Ember app and I had exactly the same problem, trying to internationalize the client-side using the i18n-js gem (https://github.com/fnando/i18n-js). To give more context, I am following the instructions in this article: http://eviltrout.com/2013/11/24/i18n-in-ember.html
In my case, Rails did not find I18n::JS because it is now called SimplesIdeias::I18n (you can see it by running rake middleware from the command line). Adding the line
config.middleware.use SimplesIdeias::I18n::Middleware
in the application.rb file solved the problem for me, hope it helps.
If you happen upon this now adays. your gemfile should say something like gem 'i18n-js', ">= 3.0.0.rc11". Otherwise you will end up using version 2.0
Related
I have problem with ActiveAdmin. I've added the gem 'activeadmin' to my Gemfile and ran
$ bundle install
which worked. But when I try to:
$ rails g active_admin:install
I get:
/home/dominika/active_admin/config/application.rb:10:in `<module:ActiveAdmin>': superclass mismatch for class Application (TypeError)
from /home/dominika/active_admin/config/application.rb:9:in `<top (required)>'
from /home/dominika/.rvm/gems/ruby-2.2.0/gems/spring-1.2.0/lib/spring/application.rb:82:in `require'
from /home/dominika/.rvm/gems/ruby-2.2.0/gems/spring-1.2.0/lib/spring/application.rb:82:in `preload'
from /home/dominika/.rvm/gems/ruby-2.2.0/gems/spring-1.2.0/lib/spring/application.rb:143:in `serve'
from /home/dominika/.rvm/gems/ruby-2.2.0/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
from /home/dominika/.rvm/gems/ruby-2.2.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
from /home/dominika/.rvm/gems/ruby-2.2.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
from /home/dominika/.rvm/gems/ruby-2.2.0/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /home/dominika/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/dominika/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Maybe it's really stupid, but I really don't know how to fix it.
Please, help...
This happens because your application is called active_admin. Rename it, and everything will work.
To rename the app view this thread to get the instructions.
Overall it sounds like you are pretty much doing things correctly.
I've added the gem 'active_admin'
From the documentation it's:
# Gemfile
gem 'activeadmin'
Does that help?
Spent all day trying to make it works.
Installed like described in readme.
This shell call:
rdebug-vim --file /Users/aleksandrkunin/.vim/tmp/ruby_debugger --output /Users/aleksandrkunin/.vim/tmp/ruby_debugger_output --socket /var/folders/p9/dq06c2dn72nbbk45qdc5yx1h0000gp/T/vLSSici/17 --logger_file /Users/aleksandrkunin/.vim/tmp/ruby_debugger_log --debug_mode 0 --vim_executable mvim --vim_servername VIM --separator ++vim-ruby-debugger-separator++ -- '/Users/aleksandrkunin/Documents/rails_projects/tracks_dev/script/rails' server
Cause this error:
Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:12:in `alias_method': undefined method `get_pr_arguments' for module `Byebug::FrameFunctions' (NameError)
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:12:in `<module:FrameFunctions>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:2:in `<module:Byebug>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/byebug/commands/frame.rb:1:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `block in <top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `each'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/lib/debugger_xml.rb:5:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/debugger-xml-0.4.1/bin/rdebug-vim:15:in `<top (required)>'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/bin/rdebug-vim:23:in `load'
from /Users/aleksandrkunin/.rbenv/versions/2.1.2/bin/rdebug-vim:23:in `<main>'
Is it possible to run? Is there another way for visual debugging in VIM?
I think the problem is that you're trying to use a gem that says it's for Ruby >= 1.9 with Ruby 2+.
rdebug does not work with Ruby 2.0+, only with Ruby in the 1.9 range. The documentation is confusing but that's how it is.
... This is a new version of the plugin, which uses debugger-xml gem, and works only with Ruby >= 1.9....
Look at the revision history of rdebug and you can see it hasn't been updated in a while.
With 2.1.1 you're using byebug, which doesn't implement the necessary call to work with Vim, hence the message:
undefined method `get_pr_arguments' for module `Byebug::FrameFunctions' (NameError)
Your choices are:
Revert to Ruby 1.9.3-p551, which is the latest of that series and install rdebug.
Stop trying to use vim-rdebug and learn to use byebug in its standalone mode, which is a more traditional debugger and works nicely. (Alternately you could use Pry and pry-debug.)
To solve my problem, which is discussed in Why do I get “undefined method 'paginate'” error in production? I'm running
bundle exec rails runner -e production 'WillPaginate'
on the server like suggested in this github issue:
https://github.com/mislav/will_paginate/issues/308#issuecomment-17167158
Question: If I don't get any output, is that the confirmation, that will_paginate is running correctly?
I'm using: Ruby 2.0.0p247, Rails 4.0.0, Ubuntu 12.10 LTS, Unicorn, Capistrano
You're correct: if you see no output, that means that Ruby was able to resolve the constant, which means that will_paginate is loaded correctly in your production environment.
If it isn't, you'll see an "uninitialized constant" error, like so:
/home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `eval': uninitialized constant WillPaginate (NameError)
from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `eval'
from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands/runner.rb:53:in `<top (required)>'
from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands.rb:86:in `require'
from /home/ash/.rbenv/versions/2.1.0-preview1/lib/ruby/gems/2.1.0/gems/railties-4.0.0/lib/rails/commands.rb:86:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I set myself the task of upgrading my app from rails 3.1 to rails 3.2.6 on my local mac book air lion dev environment. I followed this guide and ruby is upgraded, and all of my gems seemed to install and rails -v gives the answer of rails 3.2.6. If I run any rails commands though, e.g. rails c to start the console, I get this:
MacBook-Air:myapp bob$ rails c
/Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `require': cannot load such file -- ./pubnub.rb (LoadError)
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `<top (required)>'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/bob/work/myapp/config/application.rb:13:in `<top (required)>'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `require'
from /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Yes I do use pubnub in my app - it's always been working fine so I don't suspect it necessarily is the problem.
The application.rb line 13 (might be not be relevant) is
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require *Rails.groups(:assets => %w(development test))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
I do precompile assets before deploying.
The /Users/bob/.rvm/gems/ruby-1.9.3-p0#rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1 file is present and I opened it fine.
Does anyone know whats going on / is it pubnub specific or something else? I'm not sure how to troubleshoot further and googling hasn't brought anything up so far.
Thanks,
Dave
I don't see the file pubnub-ruby.rb in the repo for that gem. Try running $ bundle install or $ gem update pubnub-ruby.
I am completely new to ror and am following Michael Hartl's tutorial but I keep getting an error when I get to section 1.2.5. using the rails server command. When I use this command (whilst I am in my rail app directory 'first_app') I get the following error
c:\Users\rails_projects\first_app>rails server
c:/rails_projects/first_app/config/application.rb:7:in `<top (required)>': undefined method `groups' for Rails:
Module (NoMethodError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.11/lib/rails/comma
nds.rb:28:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.11/lib/rails/comma
nds.rb:28:in `block in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.11/lib/rails/comma
nds.rb:27:in `tap'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.0.11/lib/rails/comma
nds.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I can't figure out what went wrong, my bundle installed fine (section 1.2.4).
If your Gemfile is not set to use rails 3.1 or greater, try updating to 3.1.