How to create view in RoR if skipped during controller generation

Posted by swapnesh on Stack Overflow See other posts from Stack Overflow or by swapnesh
Published on 2012-12-05T04:43:50Z Indexed on 2012/12/05 5:03 UTC
Read the original article Hit count: 196

  1. When I run this:

    rails generate controller hello index
    

    it no doubt generates hello controller, but accidentally when I run another command like this:

    rails generate controller world
    

    it creates the world controller successfully, but missed the Route "world/index" like as "hello/index". For this mistake I need to use destroy controller and 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.

  2. This command

    rails generate controller contact-us index
    

    creates a route as contact_us/index or contact_us after changing routes.rb under config folder. How could I create a more SEO friendly URL in RoR? Like localhost:3000/contact-us?

  3. 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_us
    

    I 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?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby