Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create_table :channels_displays, :id => false do |t|
- t.integer :display_id
- t.integer :channel_id
- t.integer :position
- end
- class Channel < OrganisationData
- has_many :displays, :through => :channel_display
- end
- # this join table has attribute "position"
- class ChannelsDisplay < ActiveRecord::Base
- belongs_to :channel
- belongs_to :display
- end
- class Display < OrganisationData
- has_many :channels_display
- has_many :channels, :through => :channels_display, :order => :position
- end
- # but how set the position?
- # display = Display.first
- # display.channels << Channel.first
- # ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement