Permalink
Browse files

locale string vs. symbol issues

  • Loading branch information...
1 parent 3b99b2f commit 03154d601256db112cb0ed420187d560715816a1 @ehaselwanter ehaselwanter committed Mar 20, 2010
@@ -6,7 +6,7 @@ def self.included(base)
module ClassMethods
def scope_locale(locale, &block)
- with_scope(:find => { :joins => "INNER JOIN asset_translations on asset_translations.asset_id = assets.id", :conditions => ['asset_translations.locale = ?', locale] }) do
+ with_scope(:find => { :joins => "INNER JOIN asset_translations on asset_translations.asset_id = assets.id", :conditions => ['asset_translations.locale = ?', locale.to_s] }) do
yield
end
end
@@ -3,7 +3,7 @@ module TinyPaper::AssetExtensions
def self.included(base)
base.class_eval do
- named_scope :by_title, lambda{ |search_term| { :joins => "INNER JOIN asset_translations on asset_translations.asset_id = assets.id", :conditions => ["LOWER(asset_translations.title) LIKE ? AND asset_translations.locale = ?", "%#{search_term.to_s.downcase}%", I18n.locale]}}
+ named_scope :by_title, lambda{ |search_term| { :joins => "INNER JOIN asset_translations on asset_translations.asset_id = assets.id", :conditions => ["LOWER(asset_translations.title) LIKE ? AND asset_translations.locale = ?", "%#{search_term.to_s.downcase}%", I18n.locale.to_s]}}
end
end
@@ -5,14 +5,14 @@ module Globalize2PaperclippedTags
class TagError < StandardError; end
tag 'if_assets_with_globalize' do |tag|
- result = Asset.scope_locale(I18n.locale) do
+ result = Asset.scope_locale(I18n.locale.to_s) do
send('tag:if_assets_without_globalize', tag)
end
result
end
tag 'unless_assets_with_globalize' do |tag|
- result = Asset.scope_locale(I18n.locale) do
+ result = Asset.scope_locale(I18n.locale.to_s) do
send('tag:unless_assets_without_globalize', tag)
end
result
@@ -21,7 +21,7 @@ class TagError < StandardError; end
tag 'assets:each_with_globalize' do |tag|
with_translated_locales = tag.attr['locale'] == 'false' ? false : true
if with_translated_locales
- result = Asset.scope_locale(I18n.locale) do
+ result = Asset.scope_locale(I18n.locale.to_s) do
send('tag:assets:each_without_globalize', tag)
end
else

0 comments on commit 03154d6

Please sign in to comment.