Uninitialized constant Reservations

hi im having a bit trouble in my application im new in ROR development
i made a static page where my function rooms of my reservation
application are showed and can be add in in the
reservation_function_room(line item of reservation functionroom) it
raises uninitialized constant Reservations cant figure out whats wrong
very thanks in advance thanks

page-static pages
class PagesController < ApplicationController

def functionroom
@reservation = Reservation.find(params[:reservation_id])
@function_room = FunctionRoom.all
end
end

functionroom.html.erb

<% if notice %>

<%= notice%>

<%end%>

functionRooms

<%@function_room.each do |functionroom|%>

<%= functionroom.name%>

<%= number_to_currency(functionroom.price)%>

<%= button_to 'add function room', reservation_reservation_function_room_path(:function_room_id => functionroom), :method => :post,:remote => true%> <%end%>

reservation_contoller.rb
def index
@reservations = Reservation.all
end

def show
@reservation = Reservation.includes(:reservation_function_rooms =>
:function_room,:reservation_package => :package).find(params[:id])
end

class ReservationFunctionRoomsController < InheritedResources::Base
def show
@reservation_function_room =
ReservationFunctionRoom.find(params[:id])
end

def new
@reservation_function_room = ReservationFunctionRoom.new
end

def create
@reservation = Reservation.find(params[:reservation_id])
function_room = FunctionRoom.find(params[:function_room_id])
@reservation_function_room =
@reservation.add_function_room(function_room.id)

if @reservation_function_room.save
redirect_to @reservation, :notice => “function room successfuly
added”
end
end
end

routes

get “pages/menu”

resources :reservation_function_rooms

resources :services

resources :reservations do
get “pages/functionroom”
end

resources :reservation_packages

resources :package_line_items

resources :packages do
resources :package_crews
end

resources :function_rooms

reservation.rb
class Reservation < ActiveRecord::Base
has_one :reservation_package
belongs_to :service
has_many :reservation_function_rooms
has_many :package_line_items
has_many :menus , :through => :package_line_items, :uniq => true
has_many :function_rooms, :through =>:reservation_function_rooms

def add_function_room(function_room_id)
 current_function_room =

reservation_function_rooms.find_by_function_room_id(function_room_id)
if current_function_room
redirect_to @reservation, :notice => “function room already
added”
else
current_function_room =
reservation_function_rooms.build(:function_room => function_room_id)
current_function_room.price =
current_function_room.function_room.price
end
current_function_room
end

end

if anything is needed feel free to ask thanks in advance :slight_smile:

On 27 March 2012 10:50, ruby LED [email protected] wrote:

def functionroom
<%end%>

class ReservationFunctionRoomsController < InheritedResources::Base

end

has_many :reservation_function_rooms
else
if anything is needed feel free to ask thanks in advance :slight_smile:
The most useful thing you could tell us is which line of code
generates the error. Also post the full error message and stack
trace.

Colin

Colin L. wrote in post #1053624:

On 27 March 2012 10:50, ruby LED [email protected] wrote:

def functionroom
<%end%>

class ReservationFunctionRoomsController < InheritedResources::Base

end

has_many :reservation_function_rooms
else
if anything is needed feel free to ask thanks in advance :slight_smile:
The most useful thing you could tell us is which line of code
generates the error. Also post the full error message and stack
trace.

Colin

uhm i cant find the exact code it tells me an error routing when ever i
route to uninitialized constant Reservations
<%= link_to “add functionrooms”,
reservation_pages_functionroom_path(@reservation) %>
here is my rout

get “pages/menu”
resources :services
resources :reservations do
resources :reservation_function_rooms
get ‘pages/functionroom’
resources :reservation_packages
resources :package_line_items
end

resources :packages do
resources :package_crews
end

resources :function_rooms
resources :crews
resources :menu_categories
resources :menus do
resources :menu_recipes
end

resources :recipe_categories
resources :recipes

class PagesController < ApplicationController

def functionroom
@reservation = Reservation.find(params[:reservation_id])
@function_room = FunctionRoom.all
end
end

Error stack

ActionController::RoutingError (uninitialized constant Reservations):
activesupport (3.2.1) lib/active_support/inflector/methods.rb:229:in
block in constantize' activesupport (3.2.1) lib/active_support/inflector/methods.rb:228:ineach’
activesupport (3.2.1) lib/active_support/inflector/methods.rb:228:in
constantize' actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:62:incontroller_reference’
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:47:in
controller' actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:26:incall’
journey (1.0.3) lib/journey/router.rb:68:in block in call' journey (1.0.3) lib/journey/router.rb:56:ineach’
journey (1.0.3) lib/journey/router.rb:56:in call' actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:incall’
sass (3.1.15) lib/sass/plugin/rack.rb:54:in call' warden (1.1.1) lib/warden/manager.rb:35:inblock in call’
warden (1.1.1) lib/warden/manager.rb:34:in catch' warden (1.1.1) lib/warden/manager.rb:34:incall’
actionpack (3.2.1)
lib/action_dispatch/middleware/best_standards_support.rb:17:in call' rack (1.4.1) lib/rack/etag.rb:23:incall’
rack (1.4.1) lib/rack/conditionalget.rb:25:in call' actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:incall’
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:incall’
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in context' rack (1.4.1) lib/rack/session/abstract/id.rb:200:incall’
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in
call' activerecord (3.2.1) lib/active_record/query_cache.rb:64:incall’
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:inblock in call’
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in
_run__321294476__call__156324443__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:inrun_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:incall’
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:incall’
actionpack (3.2.1)
lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.1) lib/rails/rack/logger.rb:26:incall_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:incall’
rack (1.4.1) lib/rack/methodoverride.rb:21:in call' rack (1.4.1) lib/rack/runtime.rb:17:incall’
activesupport (3.2.1)
lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.1) lib/rack/lock.rb:15:incall’
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in
call' railties (3.2.1) lib/rails/engine.rb:479:incall’
railties (3.2.1) lib/rails/application.rb:220:in call' rack (1.4.1) lib/rack/content_length.rb:14:incall’
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in call' rack (1.4.1) lib/rack/handler/webrick.rb:59:inservice’
/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:inrun’
/home/led/.rvm/rubies/ruby-1.9.3-rc1/lib/ruby/1.9.1/webrick/server.rb:191:in
`block in start_thread’

Rendered
/home/led/.rvm/gems/ruby-1.9.3-rc1/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/routing_error.erb
within rescues/layout (1.2ms)

just a follow up question is it possible that a semi static object
accepts a object thru url paramater like what i did? i suspect my route
is not correct thanks mr collin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs