app/models/georgia/concerns/contentable.rb in georgia-0.7.6 vs app/models/georgia/concerns/contentable.rb in georgia-0.7.7

- old
+ new

@@ -8,14 +8,14 @@ included do has_many :contents, as: :contentable, dependent: :destroy, class_name: Georgia::Content accepts_nested_attributes_for :contents attr_accessible :contents_attributes - scope :with_locale, lambda {|locale| joins(:contents).where(georgia_contents: {locale: locale})} + scope :with_locale, lambda {|locale| joins(:contents).where(georgia_contents: {locale: locale}).uniq} def content(locale=nil) locale ||= I18n.locale.to_s - @content ||= contents.select{|c| c.locale == locale}.first || Georgia::Content.new + @content ||= contents.select{|c| c.locale == locale}.first || Georgia::Content.new(locale: locale) end delegate :title, :text, :excerpt, :keywords, :keyword_list, :image, :locale, to: :content end \ No newline at end of file