I've two connected tables. Venues and Specials. A venue might have many specials. When a user has produced a venue If only to enable them to produce a special around the venues#index page. By utilizing nested assets I've accomplished the preferred URL: /venues/5/specials/new.

However, my current code results with: No route matches {:controller=>"specials", :format=>nil}

I am speculating the mistake is by using my SpecialsController and also the def new and def create functions. I'd like the Hyperlink to take me to some form page where I'm able to enter new data for that special offers

<%= link_to 'Add Special', new_venue_special_path(venue) %>

App1::Application.routes.draw do

  resources :venues do 
    resources :specials

def new
    @venue = Venue.find(params[:venue_id])
      @special = @venue.specials.build
        respond_to do |format|
        format.html # new.html.erb
        format.json { render json: @special }

  def create
    @venue = Venue.find(params[:venue_id])
    @special = @venue.specials.build(params[:special])

    respond_to do |format|
      if @special.save
        format.html { redirect_to @special, notice: 'Special was successfully created.' }
        format.json { render json: @special, status: :created, location: @special }
        format.html { render action: "new" }
        format.json { render json: @special.errors, status: :unprocessable_entity }


Started GET "/venues/4/specials/new" for at 2011-12-06 23:36:01 +0200
  Processing by SpecialsController#new as HTML
  Parameters: {"venue_id"=>"4"}
  [1m[36mVenue Load (0.2ms)[0m  [1mSELECT "venues".* FROM "venues" WHERE "venues"."id" = $1 LIMIT 1[0m  [["id", "4"]]
Rendered specials/_form.html.erb (1.9ms)
Rendered specials/new.html.erb within layouts/application (2.6ms)
Completed 500 Internal Server Error in 97ms

ActionView::Template::Error (No route matches {:controller=>"specials", :format=>nil}):
    1: <%= form_for(@special) do |f| %>
    2:   <% if @special.errors.any? %>
    3:     <div id="error_explanation">
    4:       <h2><%= pluralize(@special.errors.count, "error") %> prohibited this special from being saved:</h2>
  app/views/specials/_form.html.erb:1:in `_app_views_specials__form_html_erb__2784079234875518470_70162904892440'
  app/views/specials/new.html.erb:7:in `_app_views_specials_new_html_erb__115378566176177893_70162906293160'
  app/controllers/specials_controller.rb:30:in `new'

Rendered /Users/andrewlynch/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.7ms)
redirect_to @special

this can default to "special offers_path", but you are using venue_special_path

you most likely want:

redirect_to [@venue, @special]

as well as in the shape you'll need exactly the same:

<%= form_for([@venue, @special]) do |f| %>

essentially - the problem is that you've a nested resource... meaning everywhere where you stand proclaiming a url path (including implicit places like form_for) needs to be changed with both @venue and also the @special, rather than only the @special.

you might run into this same "bug" elsewhere inside your produced scaffold code... simply do exactly the same factor and you ought to be great.