environment: Ruby 1.9.2 Rails 3.0.9 win7-64 MySQL 5.1.53
HI, I’m working on a project.
It has three tables
and there are those name and relations.
"room_type" 1 to many "guest" 1 to many "reservation"
I need to access data from reservation model.
It works on the rails console by following command.
"res =Reservation.find(1).guest.room_type.name"
but in the page, it says "null" result.
Controller:
def show
@res=Reservation.find(params[:id])
end
Views:
<%= @res.guest.room_type.name %>
Could somebody tell me what’s going on ?
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.