I'm just starting a new rails app but it doesn't let me start the server, after typing 'rails s' the console just pukes me out this;
/Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x007fa393f7db20> (NoMethodError)
from /Users/user/Desktop/MiProyecto/Portafolio/config/application.rb:12:in `<class:Application>'
from /Users/user/Desktop/MiProyecto/Portafolio/config/application.rb:10:in `<module:Portafolio>'
from /Users/user/Desktop/MiProyecto/Portafolio/config/application.rb:9:in `<top (required)>'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:78:in `require'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/user/.rvm/gems/ruby-2.4.1/gems/railties-4.2.9/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:9:in `require'
from bin/rails:9:in `<main>'
Any thoughts?
Thanks in advance.
ps: I already ran bundle install and it went out perfectly.
Check in which Rails version you started your application. If by any chance you changed it, upgrading or downgrading it, then, just to be sure, try removing the Gemfile.lock file, adding the "original" Rails version and bundling again.
I reproduced the 'method_missing': undefined method 'load_defaults' error firstly creating a blank Rails application using the 5.1.3 version, and then changing it to the 5.0.1, removing the Gemfile.lock and running bundle.
Related
I'm really new to Ruby and its Rails framework and I was following a tutorial when I ran into some issues using the rails generate command. I tried using rails generate scaffold and rails generate controller but it didn't work. The full trace is this:
/usr/lib/ruby/vendor_ruby/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x000055cdba53c180> (NoMethodError)
from /home/eric/Projects/blog/config/application.rb:12:in `<class:Application>'
from /home/eric/Projects/blog/config/application.rb:10:in `<module:Blog>'
from /home/eric/Projects/blog/config/application.rb:9:in `<top (required)>'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `require'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:92:in `preload'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
I think that the main issue is that I'm missing the 'load_defaults' method, but I couldn't find anything on how to resolve the issue. For context, I'm doing this all on a completely new rails project on Ubuntu - the only things I've done so far are rails new and bundle install.
Somewhat curiously, this issue is only popping up on new rails projects that I've created. I tried using rails generate commands on a project I had earlier and it worked. I couldn't figure out what was different between the projects though.
Any suggestions would be greatly appreciated!
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
While running redmine 1.4.7 in development mode using the command rails s, I have got error like below
/usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/options.rb:32:in
`default_options': undefined method `write_inheritable_attribute' for
Rails::Generator::Base:Class (NoMethodError)
from /usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/base.rb:90:in
`<class:Base>'
from /usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/base.rb:85:in
`<module:Generator>'
from /usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/base.rb:48:in
`<module:Rails>'
from /usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/base.rb:6:in
`<top (required)>'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in
`require'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in
`require'
from /usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator.rb:37:in
`<top (required)>'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in
`require'
from /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:126:in
`require'
from /usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/bin/rails:15:in `<top
(required)>'
from /usr/local/bin/rails:23:in `load'
from /usr/local/bin/rails:23:in `<main>'
I have spent about 2 hours for fixing it and got some references from this link
and now am getting this error. How can I fix this??
/usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb:7:in `<class:AppGenerator>': Use RbConfig instead of obsolete and deprecated Config.
/usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb:7:in `<class:AppGenerator>': Use RbConfig instead of obsolete and deprecated Config.
/usr/local/lib/ruby/gems/2.0.0/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb:7:in `<class:AppGenerator>': Use RbConfig instead of obsolete and deprecated Config.
undefined method `camelize' for "app":String
I have solved this by using rvm
Try doing the following :
Install "gem uninstall rmagick" and "gem cleanup"
Run the server as bundle exec rails s
I have Produtor model on my app and I'm trying to debug it with rails console..
but when I try to use rails console inside my app directory I get this error
D:\ruby\app>rails console
Loading development environment (Rails 3.2.9)
irb(main):001:0> Produtors.all
NameError: uninitialized constant Produtors
from (irb):1
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
what is the problem?
You need to use the name of the model, Produtor instead. The extra s is what is throwing you off. Try Produtor.all instead.
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.