Skip to content

Commit

Permalink
Fixed for Ruby 1.8.7's lack of cool syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
parndt committed Apr 28, 2011
1 parent dcc9571 commit 5dffe7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/lib/refinery/helpers/menu_helper.rb
Expand Up @@ -73,7 +73,8 @@ def selected_page_or_descendant_page_selected?(page, collection = [], selected_i
# Determine whether the supplied page is the currently open page according to Refinery.
# Also checks whether Rails thinks it is selected after that using current_page?
def selected_page?(page)
path = request.path.to_s.force_encoding('utf-8')
path = request.path
path = path.force_encoding('utf-8') if path.respond_to?(:force_encoding)

# Ensure we match the path without the locale, if present.
if defined?(::Refinery::I18n) and ::Refinery::I18n.enabled? and path =~ %r{^/#{::I18n.locale}}
Expand Down
5 changes: 4 additions & 1 deletion pages/app/models/page.rb
Expand Up @@ -25,7 +25,10 @@ def translation
# Instruct the Translation model to have meta tags.
::Page::Translation.send :is_seo_meta

delegate *(::SeoMeta.attributes.keys.map{|a| [a, :"#{a}="]}.flatten), :to => :translation
fields = ::SeoMeta.attributes.keys.reject{|f|
self.column_names.map(&:to_sym).include?(f)
}.map{|a| [a, :"#{a}="]}.flatten
delegate *(fields << {:to => :translation})
after_save proc {|m| m.translation.save}
end
end
Expand Down

0 comments on commit 5dffe7f

Please sign in to comment.