neuigkeit no fallback for editor

This commit is contained in:
Andreas Stephanides
2015-05-24 13:43:37 +02:00
parent 020e46c2cc
commit 7c668809dc
4 changed files with 27 additions and 5 deletions

View File

@@ -41,7 +41,24 @@ class Neuigkeit < ActiveRecord::Base
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
before_validation :sanitize
after_save :update_cache
attr_accessor :no_fallbacks
def globalize_fallbacks(locale)
if self.no_fallbacks
[locale]
else
super
end
end
def read_attribute(name,options={})
if translated?(name)
a=super(name,options)
a=self.translation_for(options[:locale] || I18n.locale).read_attribute(name) if self.no_fallbacks
a
else
super(name)
end
end
def picture_robust
unless self.picture.url.nil?
return self.picture