Solved

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

Posted on 2011-09-04
3
575 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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…

856 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