Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6101355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:29:26+00:00 2026-05-23T13:29:26+00:00

So this has just been driving me nuts! I have looked through tons of

  • 0

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.

So, I have a RoR App where I can create a new event.

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:

undefined method `event_path’ for #<#:0x00000100a15800>

Here are some (hopefully) relative code bits:

views/events/create.html.erb

<%= simple_form_for(@event) do |f| %>
<%= f.input :name %>
<%= f.input :date %>
<%= f.input :location %>
<%= f.input :organization %>
<%= f.input :description %>
<%= f.submit "Create Event"%>

<% end %>

controllers/events_controller.rb

class EventsController < 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

models/event.rb

   class Event < ActiveRecord::Base
    validates_presence_of :name
    has_and_belongs_to_many :organizations

    attr_accessible :name, :date, :location, :organization, :description
    attr_accessor :organizations

    end

config/routes.rb (only relevant part)

resources :events, :only => [:index, :new, :create, :edit]

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.

Thanks!

Kevin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:29:26+00:00Added an answer on May 23, 2026 at 1:29 pm

    After your create or update methods, you redirect to @event, which will redirect to the show page of your event. You have not generated the route for the show, update, destroy pages, by using the :only clause. You can verify this by running rake routes on your console. Remove the :only clause and it would work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a javascript function that has been driving me nuts. This is the
This has been driving me nuts for the past hour. I have two computers,
I know this has been asked thousands of times but I just can't find
This problem has been driving me nuts all day and there has to be
This has been driving me insane all day and I think I have the
A situation I have under Windows XP (SP3) has been driving me nuts, and
I have a problem that has been driving me nuts for days.. I've tried
I have had this problem for a while and it has been driving me
This is driving me nuts - I have been round and round in circles,
This has been driving me crazy all day. I just want the value of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.