title: No Method Error – Undefined Method for Class
body: <p>So this has just been driving me nuts! I have looked through tons of posts and can't quite get my app to work.. i am hoping the SO community can.</p>
  
  <p>So, I have a RoR App where I can create a new event. </p>
  
  <p>When I go to localhost:3000/events and localhost:3000/events/new both load correctly and look great.  Here is the problem.  When I submit an event at localhost:3000/events/new, the form info is added to the database, but I get the following error:</p>
  
  <p>undefined method `event_path' for #&lt;#:0x00000100a15800></p>
  
  <p>Here are some (hopefully) relative code bits:</p>
  
  <p><strong>views/events/create.html.erb</strong></p>
  
  <pre><code>&lt;%= simple_form_for(@event) do |f| %&gt;
  &lt;%= f.input :name %&gt;
  &lt;%= f.input :date %&gt;
  &lt;%= f.input :location %&gt;
  &lt;%= f.input :organization %&gt;
  &lt;%= f.input :description %&gt;
  &lt;%= f.submit "Create Event"%&gt;
  </code></pre>
  
  <p>&lt;% end %></p>
  
  <p><strong>controllers/events_controller.rb</strong></p>
  
  <pre><code>class EventsController &lt; ApplicationController
  respond_to :html
  
    def index
      @all_events = Event.all
    end
  
    def show
        @event = Event.find_by_name(params[:id])
    end
  
    def new
      respond_with(@event = Event.new)
    end
  
    def edit
      @event = Event.find_by_name(params[:id])
    end
  
    def create
      @event = Event.create(params[:event])
      if @event.valid?
          flash[:notice] = "Event successfully created"
      end
     end
  
    def update
  @event = Event.find_by_name(params[:id])
  @event.update_attributes(params[:event])
  if @event.valid?
      flash[:notice] = "Event successfully updated"
  end
  respond_with(@event)
    end
  
    def destroy
      @event = Event.find_by_name(params[:id])
      if @event.destroy
          flash[:notice] = "Event successfully deleted"
      end
      respond_with(@event)
    end
  end
  </code></pre>
  
  <p><strong>models/event.rb</strong></p>
  
  <pre><code>   class Event &lt; ActiveRecord::Base
      validates_presence_of :name
      has_and_belongs_to_many :organizations
  
      attr_accessible :name, :date, :location, :organization, :description
      attr_accessor :organizations
  
      end
  </code></pre>
  
  <p><strong>config/routes.rb</strong> (only relevant part)</p>
  
  <pre><code>resources :events, :only =&gt; [:index, :new, :create, :edit]
  </code></pre>
  
  <p>Really appreciate any help that can be provided... I am new to Ruby on Rails, so I am just trying to figure this whole thing out. </p>
  
  <p>Thanks!</p>
  
  <p>Kevin</p>