title: ActiveRecord::RecordNotFound - Couldn't find Keynote without an ID
body: <p>I'm building an application that has a Keynote model and a Story model (as well as a User model that I implemented with Devise).
  Keynotes have many Stories and a Story belongs to a Keynote.</p>
  
  <p>I'm having problems creating new stories and I get the following error:</p>
  
  <blockquote>
    <p><strong>ActiveRecord::RecordNotFound in StoriesController#create</strong></p>
    
    <p>Couldn't find Keynote without an ID</p>
  </blockquote>
  
  <p>The error happens on line 17 of stories_controller.rb which is</p>
  
  <pre><code>@keynote = Keynote.find(params[:keynote_id])
  </code></pre>
  
  <p>in the create method.</p>
  
  <p>This is part of my stories_controller.rb</p>
  
  <pre><code>class StoriesController &lt; ApplicationController
  
    before_filter :authenticate_user!, :except =&gt; [:show, :index]
  
    def index
      @keynote = Keynote.find(params[:keynote_id])
      @stories = @keynote.stories
    end
  
    def new
      @keynote = Keynote.find(params[:keynote_id])
      @story = @keynote.stories.build
    end
  
    def create
      if user_signed_in?
        @keynote = Keynote.find(params[:keynote_id])
        @story = @keynote.current_user.stories.build(params[:story])
        if @story.save
          flash[:notice] = 'Question submission succeeded'
          redirect_to keynote_stories_path
        else
          render :action =&gt; 'new'
        end
      end
    end
  </code></pre>
  
  <p>This is my keynotes_controller.rb</p>
  
  <pre><code>class KeynotesController &lt; ApplicationController
    def index
      @keynotes = Keynote.find :all, :order =&gt; 'id ASC'
    end
  
    def new
      @keynote = Keynote.new
    end
  
    def show
      @keynote = Keynote.find(params[:id])
    end
  
    def create
      @keynote = Keynote.new(params[:keynote])
      if @keynote.save
        flash[:notice] = 'Keynote submission succeeded'
        redirect_to keynotes_path
      else
        render :action =&gt; 'new'
      end
    end
  
  end
  </code></pre>
  
  <p>Any help would be really appreciated.</p>
  
  <p>Edit:
  These are the Parameters when I try to create a new Story.</p>
  
  <blockquote>
    <p>{"utf8"=>"✓", 
    "authenticity_token"=>"76odSpcfpTlnePxr+WBt36fVdiLD2z+Gnkxt/Eu1/TU=",
    "story"=>{"name"=>"as"}, 
    "commit"=>"Send"}</p>
  </blockquote>
  
  <p>It looks like the ID for the Keynote is not being passed.</p>
  
  <p>This is the view for StoriesController#new</p>
  
  <pre><code>&lt;%= error_messages_for 'story' %&gt;
  
  &lt;%= form_for @story do |f| %&gt;
      &lt;p&gt;
          Question:&lt;br /&gt;
          &lt;%= f.text_field :name %&gt;
      &lt;/p&gt;
      &lt;p&gt;
          &lt;%= submit_tag "Ask" %&gt;
      &lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>This is what I have in my routes.rb file:</p>
  
  <pre><code>  get "keynotes/index"
    get "users/show"
    devise_for :users
    get "votes/create"
    get "stories/index"
  
    resources :keynotes do
      resources :stories
    end
  
    resources :stories do
      get 'bin', :on =&gt; :collection
      resources :votes
    end
  
    resources :users
  
    root :to =&gt; 'keynotes#index'
  </code></pre>