Ruby on Rails Saturday, March 31, 2012

hi im new ruby on rails development currently im working with a
reservation system to start learning but im currently having a problem
with controllers and view

first i listed all the menu that the guest added inside the package that
he also added i listed them with this

_menuadded.html.erb

<h1>menu you added</h1>
<% @reservation_package.package_line_items.each do |menu|%>
<p><%= link_to menu.menu.name,
menu_reservation_reservation_package_reservation_package_pages_path(@reservation,@reservation_package,menu)
%></p>
<p><%= link_to "delete item"
,reservation_package_package_line_item_path(@reservation_package,menu),
:method => :delete%></p>
<%end%>

then i try to route to the next static page with this ` <p><%=
link_to menu.menu.name,
menu_reservation_reservation_package_reservation_package_pages_path(@reservation,@reservation_package,menu)
%></p>`

and the it produce this URL
`http://localhost:3000/reservations/10/reservation_packages/39/reservation_package_pages/menu.29`

im just wondering if how can i catch the menu that he opened i mean how
to catch this
**localhost:3000/reservations/10/reservation_packages/39/reservation_package_pages/`menu.29`**

in my menu semi static page controller where this route to,i tried this

@reservation_package =
ReservationPackage.find(params[:reservation_package_id])
@menu = Menu.find(params[:id])

but didn't work at all im just wondering if im doing it right or if im
wrong can you give me a advice how to implement this kind of module?
thanks more power


**ROUTES:**

resources :services

resources :reservations do

resources :pages do
collection do
get :functionroomlist
get :packagelist
get :package
# get :menu
end
end
resources :reservation_packages do
resources :reservation_package_pages do
collection do
get :menulist
get :menu
end
end
resources :package_line_items
end
resources :reservation_function_rooms
end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment