Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix bug with SEO fields translation #300

Closed
wants to merge 1 commit into from

2 participants

@jerefrer

SEO fields were actually not translated but remained the same for every language.

For example if you set the browser title as "Woot" in the EN language, and then set it in the FR language as "Génial", it would then be "Génial" for every language.

Anyway, it's fixed now ;)

@ugisozols ugisozols commented on the diff
app/models/refinery/blog/post.rb
@@ -26,7 +26,6 @@ class Post < ActiveRecord::Base
validates :title, :presence => true, :uniqueness => true
validates :body, :presence => true
- validates :published_at, :author, :presence => true
@ugisozols Owner

Why did you removed this validation?

Well actually this was not intended ... I messed things up because I first made the changes in the original repo's clone, then forked and CP'd the file in my forked one ... Don't know why this happened though ...

I close this and make a new pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jerefrer jerefrer closed this
@jerefrer

Closed this because of unintended changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 15, 2012
  1. @jerefrer
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 3 deletions.
  1. +7 −3 app/models/refinery/blog/post.rb
View
10 app/models/refinery/blog/post.rb
@@ -26,7 +26,6 @@ class Post < ActiveRecord::Base
validates :title, :presence => true, :uniqueness => true
validates :body, :presence => true
- validates :published_at, :author, :presence => true
@ugisozols Owner

Why did you removed this validation?

Well actually this was not intended ... I messed things up because I first made the changes in the original repo's clone, then forked and CP'd the file in my forked one ... Don't know why this happened though ...

I close this and make a new pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
validates :source_url, :url => { :if => 'Refinery::Blog.validate_source_url',
:update => true,
@@ -39,12 +38,17 @@ class Post < ActiveRecord::Base
attr_accessible :source_url, :source_url_title
attr_accessor :locale
-
class Translation
is_seo_meta
attr_accessible :browser_title, :meta_description, :meta_keywords, :locale
end
+ # Delegate SEO Attributes to globalize3 translation
+ seo_fields = ::SeoMeta.attributes.keys.map{|a| [a, :"#{a}="]}.flatten
+ delegate(*(seo_fields << {:to => :translation}))
+
+ before_save { |m| m.translation.save }
+
self.per_page = Refinery::Blog.posts_per_page
def next
@@ -116,7 +120,7 @@ def previous(item)
end
def uncategorized
- live.includes(:categories).where(Refinery::Categorization.table_name => { :blog_category_id => nil }).with_globalize
+ live.includes(:categories).where(:categories => { Refinery::Categorization.table_name => { :blog_category_id => nil } }).with_globalize
end
def next(current_record)
Something went wrong with that request. Please try again.