Gerald Vim wrote in post #1146378:
Did you mean "rails g controller main home contact event about"?
If you use scaffold Rails with generate based on "Main" being a model
first then generate a controller and views based on the model name
pluralized based on inflections database.
It also seems really odd to me your choice of methods to add to your
controller. Shouldn't "home", "contact", "events" and "about" have their
own controllers with their own routes?
$ rails g controller main home contact events about
create app/controllers/main_controller.rb
route get 'main/about'
route get 'main/events'
route get 'main/contact'
route get 'main/home'
invoke erb
create app/views/main
create app/views/main/home.html.erb
create app/views/main/contact.html.erb
create app/views/main/events.html.erb
create app/views/main/about.html.erb
invoke test_unit
create test/controllers/main_controller_test.rb
invoke helper
create app/helpers/main_helper.rb
invoke test_unit
create test/helpers/main_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/main.js.coffee
invoke scss
create app/assets/stylesheets/main.css.scss
$ rake routes
Prefix Verb URI Pattern Controller#Action
main_home GET /main/home(.:format) main#home
main_contact GET /main/contact(.:format) main#contact
main_events GET /main/events(.:format) main#events
main_about GET /main/about(.:format) main#about
I suppose this would work, but still seems quite add to me.
--
Posted via
http://www.ruby-forum.com/.