forked from bofh/fetsite
Merge branch 'kalender' of https://github.com/andreassteph/fetsite into calendar
Conflicts: app/assets/stylesheets/formtastic-changes.css.scss app/controllers/beispiele_controller.rb app/views/studien/_form.html.erb config/locales/de.yml config/routes.rb
This commit is contained in:
5
app/models/calendar.rb
Normal file
5
app/models/calendar.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class Calendar < ActiveRecord::Base
|
||||
attr_accessible :name, :public, :picture
|
||||
has_and_belongs_to_many :calentries
|
||||
mount_uploader :picture, PictureUploader
|
||||
end
|
||||
17
app/models/calentry.rb
Normal file
17
app/models/calentry.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Calentry < ActiveRecord::Base
|
||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids
|
||||
has_and_belongs_to_many :calendars
|
||||
validates :start, :presence => true
|
||||
validates :typ, :presence => true
|
||||
validate do |entry|
|
||||
if entry.ende.nil?
|
||||
errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
|
||||
end
|
||||
end
|
||||
def start_time
|
||||
start
|
||||
end
|
||||
def name
|
||||
summary
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user