I get error after using rails new command - ruby-on-rails

I get error after I use rails new command-
Pareshs-MacBook-Pro:Desktop psghodge$ rails new lynda_cms
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/rails-2.3.5/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rails-2.3.5/lib/rails_generator/base.rb:90:in `<class:Base>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rails-2.3.5/lib/rails_generator/base.rb:85:in `<module:Generator>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rails-2.3.5/lib/rails_generator/base.rb:48:in `<module:Rails>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rails-2.3.5/lib/rails_generator/base.rb:6:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rails-2.3.5/lib/rails_generator.rb:34:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rails-2.3.5/bin/rails:14:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/rails:23:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/rails:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'

Judging by your error, you're trying to use Rails v2.3.5 with ruby 2.0.0. Without doing a lot of googling I can't be certain, but I'm fairly sure that old versions of Rails like that only work with ruby 1.8.7.
Unless you have a really good reason to use a version of Rails that old, you shouldn't do it.
Use a new Rails, or if you have to use that Rails then install ruby 1.8.7

Related

What does undefined method `configure' for nil:NilClass (NoMethodError) mean?

What does undefined method `configure' for nil:NilClass (NoMethodError) mean?
I tried reinstalling and reinstalling. I'm also have trouble updating the GEMFILE to ruby 2.4.2. Your Ruby version is 2.4.2, but your Gemfile specified 2.2.5. I tried "bundle update" removing 2.2.5 but it gives me a error... I tried everything. and now I get this nil:Nil:Class error... PLease help!
The last known error I did was to remove the .ds-store and i typed something add gitignore or something because I was having trouble with the git pull. I found this while I was troubleshooting and I also hit git commit - m " ".
This was when the nil:Nil:Class error popped up each type i try to run the rails s.
/Users/sandychow/roughhouse-web/config/application.rb:10:in `<top (required)>': undefined method `configure' for nil:NilClass (NoMethodError)
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/sandychow/roughhouse-web/bin/rails:8:in `require'
from /Users/sandychow/roughhouse-web/bin/rails:8:in `<top (required)>'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /Users/sandychow/.rvm/gems/ruby-2.2.5/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/sandychow/roughhouse-web/bin/spring:16:in `require'
from /Users/sandychow/roughhouse-web/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Sandys-MBP:roughhouse-web sandychow$
What Ruby version manager are you using, i would suggest you to use rvm to maintain ruby manager and with rvm use ruby~2.2.5 as it is mentioned in your gem file. first go to project directory and change your ruby version to 2.2.5 and then run bundle update. this may resolve your issue. RVM

in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)

I have just started learning Ruby on Rails. I installed all the related softwares and started exploring the same. When I try to start the default server in Rails (WEBrick), I am getting the following error.
C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/helpers.rb:40:in `<module:Helpers>': uninitialized constant ActionView::Helpers::ActiveModelHelper (NameError)
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/helpers.rb:4:in `<module:ActionView>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/helpers.rb:3:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/base.rb:5:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/actionview-4.2.5/lib/action_view/base.rb:5:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:7:in `<class:Template>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:6:in `<module:WebConsole>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/template.rb:1:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console.rb:12:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web-console.rb:1:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
from C:/Temp/Rails-Project/Sites/simple_cms/config/application.rb:7:in `<top (required)>'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in`require'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in`block in server'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in`tap'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in`server'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in`run_command!'
from C:/Apps/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Upon research in SOF, found from the link and other link that the nokogiri needs to be updated in the Gemfile. I updated and executed the Bundle Install command. Even after that, its not working. Please suggest me the ways to fix it. FYI, I am using the latest versions of gems.
I also updated my Gemfile with
gem 'rack', '~> 1.6.0'
It did not work.
Install an older version of rails (4.0.0) because I think windows doesn't have stable version of rails > 4.0.
Change the version in gemfile.

Thor Argument Error when trying to create a new Rails app

I'm trying to create a new app using rails-api. When I run rails-api new mynewapp I get the following:
/Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1.1/lib/thor/parser/option.rb:125:in `validate_default_type!': An option's default must match its type. (ArgumentError)
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1.1/lib/thor/parser/option.rb:111:in `validate!'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1.1/lib/thor/parser/argument.rb:24:in `initialize'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1.1/lib/thor/parser/option.rb:9:in `initialize'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1.1/lib/thor/base.rb:544:in `new'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1.1/lib/thor/base.rb:544:in `build_option'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/thor-0.19.1.1/lib/thor/base.rb:274:in `class_option'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/base.rb:202:in `class_option'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/app_base.rb:71:in `add_shared_options_for'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/rails/app/app_generator.rb:160:in `<class:AppGenerator>'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/rails/app/app_generator.rb:159:in `<module:Generators>'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/rails/app/app_generator.rb:153:in `<module:Rails>'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/generators/rails/app/app_generator.rb:3:in `<top (required)>'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rails-api-0.4.0/lib/rails-api/generators/rails/app/app_generator.rb:2:in `<top (required)>'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from /Users/sandy/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rails-api-0.4.0/bin/rails-api:3:in `<top (required)>'
from /Users/sandy/.rbenv/versions/2.2.2/bin/rails-api:23:in `load'
from /Users/sandy/.rbenv/versions/2.2.2/bin/rails-api:23:in `<main>'
I get the exact same error when trying rails new mynewapp, except instead of
...gems/rails-api-0.4.0/bin/rails-api:3:in `<top (required)>'
I get
...gems/railties-4.2.4/bin/rails:9:in `<top (required)>'
And even running rails -v gives the same error.
Google was no help. Does anyone have any idea what might causing this?
If you run rails -v and get an error, your installation is probably bad. I'd try re-installing rails...
Follow this:
http://installrails.com/
It looks like thor 0.19.1.1 made a breaking change. Try changing it to 0.19.1 and see if that fixes the issue.

"rails server" not working, sqlite3_native symbol not found

I'm getting this error message when I try the "rails server" command... not really sure what's going on?
/Library/Ruby/Gems/1.8/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle: dlsym(0x1010621e0, Init_sqlite3_native): symbol not found - /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle (LoadError)
from /Library/Ruby/Gems/1.8/gems/sqlite3-1.3.5/lib/sqlite3.rb:6
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/grace/Documents/web_stuff/tutorbookrails/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.1.3/lib/rails/commands.rb:52:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.3/lib/rails/commands.rb:52
from /Library/Ruby/Gems/1.8/gems/railties-3.1.3/lib/rails/commands.rb:49:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.1.3/lib/rails/commands.rb:49
from script/rails:6:in `require'
from script/rails:6
Have you tried reinstalling the 'sqlite3-ruby' gem?
There might be some sqlite-ruby interface issue in your system as this SO answer, Sqlite3 error after Rails 3 (beta 4) install, points out.
And also, you should use rvm/rbevn and ruby 1.9 if there isn't any specific requirement for ruby 1.8.

rails server command WINDOWS

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.

Resources