calentry dauer
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
class Calentry < ActiveRecord::Base
|
class Calentry < ActiveRecord::Base
|
||||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids, :calendar
|
attr_accessible :ende, :start, :summary, :typ,:calendar_ids, :calendar, :dauer
|
||||||
belongs_to :calendar
|
belongs_to :calendar
|
||||||
belongs_to :neuigkeit
|
belongs_to :neuigkeit
|
||||||
validates :start, :presence => true
|
validates :start, :presence => true
|
||||||
@@ -38,6 +38,12 @@ validate do |entry|
|
|||||||
def start1
|
def start1
|
||||||
start.to_date
|
start.to_date
|
||||||
end
|
end
|
||||||
|
def dauer
|
||||||
|
self.start-self.ende
|
||||||
|
end
|
||||||
|
def dauer=(dauer)
|
||||||
|
self.ende=self.start+dauer.to_i.hours
|
||||||
|
end
|
||||||
def name
|
def name
|
||||||
unless self.object.nil?
|
unless self.object.nil?
|
||||||
self.object.name
|
self.object.name
|
||||||
|
|||||||
Reference in New Issue
Block a user