tables in one view.
I have three models
class TypeEvent < ActiveRecord::Base
end
class Event < ActiveRecord::Base
belongs_to :type_event
belongs_to :computer
end
class Computer < ActiveRecord::Base
belongs_to :room
has_many :events, :dependent => :delete_all
end
The show action in the Computer controller is written like this :
def show
@computer = Computer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @computer }
end
end
I would like to display the following fields in the show.html.erb view
type_events.name from the type_events table
events.information from the type_events table
events.state , events.created_at , envents.updated_at from the events
table
Can anybody help me ?
--
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.