Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8934169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:43:10+00:00 2026-06-15T09:43:10+00:00

When I run this: rails generate controller hello index it no doubt generates hello

  • 0
  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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:43:12+00:00Added an answer on June 15, 2026 at 9:43 am

    when you use rails generator it will create controller and view folder for it

    rails generate controller test
    

    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

    rails generate controller home
    

    controllers/home.rb

    HomeController < ApplicationController
      def index
      end
      def about_us
      end
      def contact
      end
    end
    

    routes.rb

    match '/home', :to => 'home#index'
    match '/About_us', :to => 'home#about_us'
    match '/Contact_us' , :to=> 'home#contact_us'
    

    and than define your views in

    views/home/index.html.erb
    views/home/about_us.html.erb
    views/home/contact_us.html.erb
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when I run a command like rails generate model Address Rails creates the model
When I run my rails console I got something like this: Loading development environment
If I run rails generate controller ControllerName I get an empty controller? I can
I'm following this tutorial (seems good) for Rails. After I run ruby script/generate scaffold
Before the switch and in all apps on this passenger that run rails 2.0
I run this command : select * from LIST where JCODE = 8 and
I'm trying to run this code but this error appear: Uncaught TypeError: string is
I would like to run this script (embed drive list in a site) that
Let's say I did this: script/generate controller home And in the home controller made
When I run: rails generate model MyUsers I get -S, [--skip-sprockets] # Skip Sprockets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.