rails generate controller Comments not creating the files it should create - ruby-on-rails

Am following ruby on rails documentation and am hooked here, it dosen't seem to create expected files, i need some help please.
C:\Sites\blog>rails generate controller Comments
i ran the code above but got this instead.
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load': C:/Sites/blog/config/routes.rb:10: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `block in load'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:286:in `load'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:55:in `each'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:55:in `load_paths'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:18:in `reload!'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:41:in `block in updater'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/file_update_checker.rb:81:in `execute'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:42:in `updater'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application/finisher.rb:128:in `block in <module:Finisher>'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `call'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
from C:/Sites/blog/config/environment.rb:5:in `<top (required)>'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/application.rb:329:in `require_environment!'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/actions.rb:16:in `require_application_and_environment!'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/generate/generate_command.rb:19:in `perform'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
- List item
Please help me, and is documentation the best place for learning rails

Your routes.rb has an error in it somewhere. Backup your existing routes.rb file and then change it to,
Rails.application.routes.draw do
end
Then run your generate command. Afterwards, add the previous contents back into routes.rb

Related

Unable to run rails console and I'm not sure what the issue is

I'm trying to run rails console but I'm getting a bunch of messages and I'm not being able to determine where exactly the issue is. Other Rails commands are working.
I've seen suggestions to run spring stop or comment spring in the gemfile but neither of those worked.
I'm getting this in my terminal:
rails console
/home/lutzcc1/code/lutzcc1/rails-task-manager/config/routes.rb:4:in `block in <main>': undefined local variable or method `new_task' for #<ActionDispatch::Routing::Mapper:0x0000557103736ee0> (NameError)
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:429:in `instance_exec'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:429:in `eval_block'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:411:in `draw'
from /home/lutzcc1/code/lutzcc1/rails-task-manager/config/routes.rb:1:in `<main>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `block in load_paths'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `load_paths'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:20:in `reload!'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:30:in `block in updater'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/file_update_checker.rb:83:in `execute'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:10:in `execute'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/finisher.rb:184:in `block in <module:Finisher>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `run'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application.rb:363:in `initialize!'
from /home/lutzcc1/code/lutzcc1/rails-task-manager/config/environment.rb:5:in `<main>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:106:in `preload'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Here is my routes file:
Rails.application.routes.draw do
get 'tasks', to: 'tasks#index'
get 'tasks/new', to: 'tasks#new', as: new_task
post 'tasks', to: 'tasks#create'
get 'tasks/:id', to: 'tasks#show', as: tasks
get 'tasks/:id/edit', to: 'task#edit', as: edit_task
patch 'tasks/:id', to: 'task#update'
delete 'task/:id', to: 'task#destroy'
end
Here's the problem:
as: new_task
You probably meant
as: :new_task
That's why rails complains about an undefined method or variable new_task

Syntax Error every Time I run a rails command

I'm trying to generate pages for a new rails project but I keep getting this error.
$ rails generate controller pages home
/Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load':/Users/reidwahlbrink/Desktop/Hanna's Blog/config/initializers/session_store.rb:3: syntax error, unexpected tIDENTIFIER, expecting end-of-input
...re, key: '_Hanna's_Blog_session'
... ^ (SyntaxError)
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:648:in `block in load_config_initializer'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/notifications.rb:161:in `instrument'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:647:in `load_config_initializer'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:611:in `each'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/engine.rb:611:in `block in <class:Engine>'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:44:in `each'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:44:in `tsort_each_child'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:411:in `call'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
from /Users/reidwahlbrink/Desktop/Hanna's Blog/config/environment.rb:5:in `<top (required)>'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:92:in `require'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:92:in `preload'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:140:in `serve'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /Users/reidwahlbrink/.rvm/gems/ruby-2.1.2/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/reidwahlbrink/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
I've also tried to run rails server and it will load the server and then exit and return this same error. I'm working my way through One Month Rails and was trying to set up my own project with what I had learned so far after watching the creating more pages lesson. Please help!
You need to escape your apostrophe '_Hanna\'s_Blog_session'
Or you can just use double quotes "_Hanna's_Blog_session"
The reason for this is that in the single quotes case you need to identify that the apostrophe is part of the string literal rather than the end of the string.
You have a space and a single quote in your application's path:
/Users/reidwahlbrink/Desktop/Hanna's Blog/
^ ^
Probably from running:
rails new "Hanna's Blog"
This is going to cause many problems. You should delete that directory and instead run:
rails new hannasblog

Rails Generate Controller suddenly decided to stop working

Bit new to rails, but I was generating some controllers, I did one, then went to do another and it spit out an error:
c:\row\dev\a>rails generate controller Person name:string
C:/row/ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/rou
ting/mapper.rb:229:in `default_controller_and_action': missing :controller (Argu
mentError)
I tried rubymine just to see and it pretty much just did the same thing, that full list of what it outputted is below. I've never had it just decide to stop generating controllers like that, and I did add something to the routes file because I saw a link that said the routes file might need root to: 'controller#action' though i've never had to include that in the route file to generate a controller before, but that didn't fix it either. That was the only other thing I could find online with a similar problem. Any thoughts?
C:\row\Ruby200\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/row/dev/a/bin/rails generate controller person name:string -s
C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action': missing :controller (ArgumentError)
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `new'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1443:in `add_route'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1422:in `decomposed_match'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1403:in `block in match'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `each'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:1394:in `match'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:601:in `map_method'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/mapper.rb:562:in `get'
from C:/row/dev/a/config/routes.rb:2:in `block in <top (required)>'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/actionpack-4.0.2/lib/action_dispatch/routing/route_set.rb:319:in `draw'
from C:/row/dev/a/config/routes.rb:1:in `<top (required)>'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `block in load'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:223:in `load'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `each'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:16:in `reload!'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `call'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/activesupport-4.0.2/lib/active_support/file_update_checker.rb:75:in `execute'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/routes_reloader.rb:27:in `updater'
from C:131071:in `execute_if_updated'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/row/Ruby200/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from C:/row/Ruby200/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from C:/row/Ruby200/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from C:/row/Ruby200/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from C:/row/Ruby200/lib/ruby/2.0.0/tsort.rb:180:in `each'
from C:/row/Ruby200/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from C:/row/Ruby200/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from C:/row/dev/a/config/environment.rb:5:in `<top (required)>'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
from C:/row/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:44:in `<top (required)>'
from C:/row/dev/a/bin/rails:4:in `require'
from C:/row/dev/a/bin/rails:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
For Generating a controller you specified with method name not variable
like
rails generate controller Person index show
I hope you understand and it work for you.
Thanks.

ActiveAdmin and Rails 4 creating a model resource broke my project

I was following the instructions at http://www.activeadmin.info/docs/0-installation.html#gemfile under the heading Register your models with Active Admin. Before adding the resource of Post I was able to start my server just fine. Once I added the resource of Post, it would no longer start. It was giving me an error about the I18n.config.enforce_available_locales needing to be set to false to prevent the error message. I found another Stack Overflow post which said to set this to false in the application.rb file. After doing this the message no longer shows in my Terminal interface, but the servers don't start.
Now I am getting the following output in Terminal when I run $ rails server
/Applications/MAMP/htdocs/ruby-review/app/admin/post.rb:1:in `<top (required)>': uninitialized constant Post (NameError)
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:179:in `load'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:171:in `block in load!'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:171:in `each'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:171:in `load!'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/application.rb:195:in `routes'
from /Library/Ruby/Gems/2.0.0/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin.rb:80:in `routes'
from /Applications/MAMP/htdocs/ruby-review/config/routes.rb:3:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:341:in `eval_block'
from /Library/Ruby/Gems/2.0.0/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:319:in `draw'
from /Applications/MAMP/htdocs/ruby-review/config/routes.rb:1:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:in `call'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/file_update_checker.rb:75:in `execute'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:30:in `run'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:215:in `initialize!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Applications/MAMP/htdocs/ruby-review/config/environment.rb:5:in `<top (required)>'
from /Applications/MAMP/htdocs/ruby-review/config.ru:3:in `block in <main>'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /Applications/MAMP/htdocs/ruby-review/config.ru:in `new'
from /Applications/MAMP/htdocs/ruby-review/config.ru:in `<main>'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:48:in `app'
from /Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:75:in `start'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:76:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How to I initialize the Constant of Post?
My apologies if these errors seem obvious to some. I am still new to rails.
You have to have a Post model. Do this:
$ rails g model Post
$ rake db:migrate

Rails devise generate model error

I'm trying to use 'rails generate devise model1' in rails 4, but the following error up.
> /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:229:in `default_controller_and_action': missing :controller (ArgumentError)
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `add_route'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:330:in `root'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1459:in `root'
from /home/p4/rails_tut/test_app/config/routes.rb:3:in `block in <top (required)>'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
from /home/p4/rails_tut/test_app/config/routes.rb:1:in `<top (required)>'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/p4/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
from /home/p4/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
from /home/p4/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
from /home/p4/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
from /home/p4/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
from /home/p4/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
from /home/p4/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/p4/rails_tut/test_app/config/environment.rb:5:in `<top (required)>'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
from /home/p4/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.0/lib/rails/commands.rb:45:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have no idea what this the internal working of rails is as this error seem to be some problem coming from 'mapping.rb'.
The following it my routes.rb
TestApp::Application.routes.draw do
root 'dunbs' => 'dunbs#index'
end
Your syntax for defining a root route is incorrect, it should be either root to: 'dunbs#index' or root 'dunbs#index'.
See http://guides.rubyonrails.org/routing.html#using-root for more details.

Resources