Solved

How do I add a new view page (web page) to my Ruby on Rails applicartion?

Posted on 2011-09-04
3
569 Views
Last Modified: 2012-06-21
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.draw 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.
0
Comment
Question by:jwright9
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
JESii earned 500 total points
ID: 36483900
I believe your match statement should look like this:
  match 'manage', :to => 'businesses#manage'
0
 

Author Closing Comment

by:jwright9
ID: 36490393
JESii,  Do you know of any good tutorials that show you the programmer how to add routes, views, etc. to an existing RoR project?
0
 
LVL 12

Expert Comment

by:JESii
ID: 36492583
Sure; check this out - http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/

And thanks for the points!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Hi,      I've been learning Spring and Jersey for the past few months and to say in simple, i am pretty much impressed with these frameworks. Many developers feel it awkward to implement a RESTful Web Services with such a popular Web Application Fr…
WHY MVC is the future technology... As many of you know, MVC is Model,View,Controller pattern. Model View Controller pattern was invented in a Smalltalk context at Xerox in late 1970s. Why is this buzz about MVC: --------------------------- …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now