I am on Rails 2.3.5 and am trying to figure out the syntax to select in some columns with a look for loading. For instance,
class Organizer < ActiveRecord::Base
has_many :events
end
class Event < ActiveRecord::Base
belongs_to :organizer
has_many :bookings
end
class Booking < ActiveRecord::Base
belongs_to :event
end
Say, in the Show OrganizerController method, I want to use loading to grab specific columns from the Organizer, Event, and Booking models. I believe that here is a code that captures all columns from all three models
Organizer.find(params[:id], :include => {:event => {:booking}})
But let me say that I only want to capture organizer.id, event.id and booking.id, what is this syntax?
source
share