Relationship Calentry,Calendar

This commit is contained in:
2013-08-08 09:08:43 +02:00
parent 6bb35c110a
commit ae75459d58
3 changed files with 22 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
class Calendar < ActiveRecord::Base
attr_accessible :name, :public
has_and_belongs_to_many :calentries
end

View File

@@ -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

View File

@@ -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