forked from bofh/fetsite
thema validations
This commit is contained in:
@@ -16,9 +16,10 @@ class Thema < ActiveRecord::Base
|
|||||||
has_many :attachments
|
has_many :attachments
|
||||||
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
|
belongs_to :themengruppe, :foreign_key => "themengruppe_id"
|
||||||
has_one :gremium
|
has_one :gremium
|
||||||
|
has_many :nlinks, as: :link
|
||||||
validates :themengruppe, :presence => true
|
validates :themengruppe, :presence => true
|
||||||
validates :title, :presence => true
|
validates :title, :presence => true
|
||||||
|
validates :text, :presence => true
|
||||||
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
||||||
has_many :nlinks, as: :link
|
|
||||||
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ class Themengruppe < ActiveRecord::Base
|
|||||||
attr_accessible :text, :title, :picture, :priority
|
attr_accessible :text, :title, :picture, :priority
|
||||||
has_many :themen, class_name: 'Thema'
|
has_many :themen, class_name: 'Thema'
|
||||||
has_many :fragen, through: :themen
|
has_many :fragen, through: :themen
|
||||||
|
|
||||||
mount_uploader :picture, PictureUploader
|
mount_uploader :picture, PictureUploader
|
||||||
|
|
||||||
validates :title, :presence => true
|
validates :title, :presence => true
|
||||||
|
validates :text, :presence => true
|
||||||
|
|
||||||
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user