user3457246
user3457246

Reputation: 11

Routes.rb: Multiple Controllers

I have been able to view a single controller at localhost with port 3000 using root 'controller#action'. I would like to view multiple controllers using the routes.rb config file. Please advise if I am not following the best path. Should I create a different view/controller for each control such as textfield, dropdown, etc. I am new to ruby on rails and web development.

Upvotes: 1

Views: 149

Answers (1)

Richard Peck
Richard Peck

Reputation: 76774

You should look at the Rails Routing documentation - this explains how to do it:

#config/routes.rb
resources :users, :posts, :transactions

This will create a series of RESTful routes which you can use in your application, for any controller


Should I create a different view/controller for each control such as textfield, dropdown

Each controller/action is basically what your users will see when they hit a specific "page" on your site. Each view shows the user a bunch of HTML; each controller creates the variables to use in that view; each model pulls relevant data from the database

You should read about how to get started with Rails to see how this works

Upvotes: 0

Related Questions