forked from bofh/fetsite
Relationship Calentry,Calendar
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
class Calendar < ActiveRecord::Base
|
||||
attr_accessible :name, :public
|
||||
has_and_belongs_to_many :calentries
|
||||
end
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
class Calentry < ActiveRecord::Base
|
||||
attr_accessible :ende, :start, :summary, :typ
|
||||
|
||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids
|
||||
has_and_belongs_to_many :calendar
|
||||
def start_time
|
||||
start
|
||||
end
|
||||
def name
|
||||
summary
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class CreateCalendarCalentriesJoinTable < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :calendars_calentries, :id=>false do |t|
|
||||
t.integer :calentry_id
|
||||
t.integer :calendar_id
|
||||
end
|
||||
add_index :calendars_calentries, [:calentry_id, :calendar_id]
|
||||
add_index :calendars_calentries, :calendar_id
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user