How to show data in included class?

Dear All.

Sorry I am noob here, I want to ask how to show data in included class.
this is my detail :


class Kamar < ActiveRecord::Base
belongs_to :hotel, :foreign_key => ‘id_hotel’

class Hotel < ActiveRecord::Base
has_many :kamars, :foreign_key => ‘id_hotel’

class HotelController < ApplicationController


def list
@hotels = Hotel.find (:all, :include=> :kamars ,
:conditions => [“kamars.id_tipe_kamar = ?”,
‘6’])

I want to show all data in kamars that corresponding with @hotels and
the condition. Please Help me.

Thanks.

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