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 7587873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:47:01+00:00 2026-05-30T19:47:01+00:00

hi im new in rails and starting a reservation app using ruby 1.9 and

  • 0

hi im new in rails and starting a reservation app using ruby 1.9 and rails 3.2.1

one of my action seems to fail with a error

undefined method `reservefunctionrooms' for #<Reservation:0xb637f24c>

i dont know where it did wrong but i think i did everything right

my route.rb

 resources :reservations do
    resources :reservefunctionrooms 
  end

my controller

class ReservefunctionroomsController < ApplicationController
  # GET /reservefunctionrooms
  # GET /reservefunctionrooms.json
  def index
    #@reservefunctionrooms = Reservefunctionroom.all
    redirect_to Reservation.find(params[:reservation_id])
    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @reservefunctionrooms }
    end
  end

  # GET /reservefunctionrooms/1
  # GET /reservefunctionrooms/1.json
  def show
    #@reservefunctionroom = Reservefunctionroom.find(params[:id])
    redirect_to Reservation.find(params[:reservation_id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @reservefunctionroom }
    end
  end

  # GET /reservefunctionrooms/new
  # GET /reservefunctionrooms/new.json
  def new
    #@reservefunctionroom = Reservefunctionroom.find(params[:id])
    @reservation = Reservation.find(params[:reservation_id])
    @reservefunctionroom = @reservation.reservefunctionrooms.build


  end

  # GET /reservefunctionrooms/1/edit
  def edit
    @reservefunctionroom = Reservefunctionroom.find(params[:id])
  end

  # POST /reservefunctionrooms
  # POST /reservefunctionrooms.json
  def create
    @reservation = Reservation.find(params[:reservation_id])
    @reservefunctionroom = @reservation.reservefunctionrooms.build(params[:reservefunctionroom])

    respond_to do |format|
      if @reservefunctionroom.save
        format.html { redirect_to @reservation, notice: 'Reservefunctionroom was successfully created.' }
        #format.json { render json: @reservefunctionroom, status: :created, location: @reservefunctionroom }
      else
        format.html { render action: "new" }
        #format.json { render json: @reservefunctionroom.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /reservefunctionrooms/1
  # PUT /reservefunctionrooms/1.json
  def update
    @reservefunctionroom = Reservefunctionroom.find(params[:id])

    respond_to do |format|
      if @reservefunctionroom.update_attributes(params[:reservefunctionroom])
        format.html { redirect_to @reservefunctionroom, notice: 'Reservefunctionroom was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @reservefunctionroom.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /reservefunctionrooms/1
  # DELETE /reservefunctionrooms/1.json
  def destroy
    @reservefunctionroom = Reservefunctionroom.find(params[:id])
    @reservefunctionroom.destroy

    respond_to do |format|
      format.html { redirect_to reservefunctionrooms_url }
      format.json { head :no_content }
    end
  end
end

my model reservefunctionroom.rb

  belongs_to :functionroom
  belongs_to :reservation

my functionroom.rb

  has_many :reservefunctionrooms

my view resevefunctionroom/new.html.erb

<h1>New reservefunctionroom</h1>

<%= render 'form', :reservation => @reservation,
    :reservefunctionroom => @reservefunctionroom%>

<%= link_to 'Back', reservefunctionrooms_path %>

_form.html.rb

<%= form_for([reservation,reservefunctionroom]) do |f| %>
  <% if @reservefunctionroom.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@reservefunctionroom.errors.count, "error") %> prohibited this reservefunctionroom from being saved:</h2>

      <ul>
      <% @reservefunctionroom.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

error stack

activemodel (3.2.1) lib/active_model/attribute_methods.rb:407:in `method_missing'
activerecord (3.2.1) lib/active_record/attribute_methods.rb:126:in `method_missing'
app/controllers/reservefunctionrooms_controller.rb:30:in `new'
actionpack (3.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.1) lib/active_support/callbacks.rb:414:in `_run__681443984__process_action__398765339__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.3) lib/journey/router.rb:68:in `block in call'
journey (1.0.3) lib/journey/router.rb:56:in `each'
journey (1.0.3) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__651380482__call__1059175300__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/home/led/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/led/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/led/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

the app doesn’t do much yet it just create a reservation entry
the error points at new if anything else needed just ask me thanks all more power to us

regards led

  • 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-30T19:47:02+00:00Added an answer on May 30, 2026 at 7:47 pm

    You need to add has_many :reservefunctionrooms to your reservation model.

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

Sidebar

Related Questions

I've set up a new Rails 2.3.2 app and added the Basecamp API ruby
I have a new application starting that's using Rails 2.3.8 for stability concerns and
I am just starting ruby on rails. In terminal, I entered rails new TestApp,
We are starting to develop a new website using Rails 3, RSpec 2, and
I am fairly new to Ruby on Rails but am starting to do more
I'm just starting out with rails and I'm practicing the basic ruby commands, one
I'm starting to learn Rails. I'm using Rails 3. In my simple App, I
Starting a new rails project and we have a well-thought-out color palette, and want
We are getting close to releasing our new rails app and so far interest
I am working on the admin section of a new rails app and i'm

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.