-
When I run this:
rails generate controller hello indexit no doubt generates hello controller, but accidentally when I run another command like this:
rails generate controller worldit creates the world controller successfully, but missed the
Route "world/index"like as “hello/index”. For this mistake I need to usedestroy controllerand then generate it once more, is thr some kind of mid way command that I can generate if forgotten something rather than destroying and creating every time. -
This command
rails generate controller contact-us indexcreates a route as
contact_us/indexorcontact_usafter changing routes.rb under config folder. How could I create a more SEO friendly URL in RoR? Likelocalhost:3000/contact-us? -
I am working on some very basic rules to follow RoR..like 3 static pages (Home, About us, Contact Us) Just simple html content to understand more, will certainly add more features to it as well.
localhost:3000/home localhost:3000/About_us localhost:3000/contact_usI created this via creating home, About_us, contact_us controller command and then changed html in views. Since I am on an initial phase, I read somewhere for static pages we can create this in our public like what we have error pages there in the folder or the approach im using is correct?
When I run this: rails generate controller hello index it no doubt generates hello
Share
when you use rails generator it will create controller and view folder for it
will create test_controller.rb and view/test folder
rails generate controller test index
will create test_controller.rb and view/test/index.html.erb file as well as define a route for you
However what its sounds like you are trying to do is have single controller with static pages what i would suggest you do is generate home_controller with home, aboutus, and contact actions and than map the routes to them like so
controllers/home.rb
routes.rb
and than define your views in