This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@notification = Notification.find(11) | |
@notification.cohabitant_ids | |
# => [2, 3, 6] | |
@notification.cohabitants.each { |c| puts c.contact_name } | |
# => Cool Lady | |
# => Cool Guy | |
# => Super Awesome Dude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateCohabitantsNotifications < ActiveRecord::Migration | |
def change | |
create_join_table :cohabitants, :notifications | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateCohabitantsNotifications < ActiveRecord::Migration | |
def change | |
create_table :cohabitants_notifications, :id => false do |t| | |
t.string :cohabitant_id, :null => false | |
t.string :notification_id, :null => false | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Resource < ActiveRecord::Base | |
module Types | |
ACTIVE = 'active' | |
CANCELLED = 'cancelled' | |
CEASED = 'ceased' | |
DITCHED = 'ditched' | |
MEDIA = 'media' | |
ONE_TIME = 'one time' | |
ARCHIVED = 'archived' | |
end |
NewerOlder