jwright9
asked on
How do I add a new view page (web page) to my Ruby on Rails applicartion?
I have created a ruby on rails applications using scaffolding. It runs fine. I want to add a new view page to my application by hand but I am having no luck so far. I added a reference to the page in routes.rb and added an entry in the controller. I am not real familiar with this aspect of rails.
The entry in the route.db looks like this:
Msp1::Application.routes.d raw do
resources :businesses
match 'manage' => 'businesses#manage'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
The entry in my controller:
def manage
@businesses = Business.all
respond_to do |format|
format.html # manage.html.erb
format.xml { render :xml => @businesses }
end
end
Thanks.
The entry in the route.db looks like this:
Msp1::Application.routes.d
resources :businesses
match 'manage' => 'businesses#manage'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
The entry in my controller:
def manage
@businesses = Business.all
respond_to do |format|
format.html # manage.html.erb
format.xml { render :xml => @businesses }
end
end
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sure; check this out - http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/
And thanks for the points!
And thanks for the points!
ASKER