-
-
Save DriesS/be96a361727931c771d7 to your computer and use it in GitHub Desktop.
How to overwrite method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'acts_as_indexed' | |
module Refinery | |
module News | |
class Item < Refinery::Core::BaseModel | |
class << self | |
# rejects any page that has not been translated to the current locale. | |
def translated | |
includes(:translations).where( | |
translation_class.arel_table[:locale].eq(::Globalize.locale) | |
).where( | |
arel_table[:id].eq(translation_class.arel_table[:refinery_news_item_id]) | |
) | |
end | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refinery::News::Item.class_eval do | |
def translated | |
puts "overwritten" | |
# includes(:translations).where( | |
# translation_class.arel_table[:locale].eq(::Globalize.locale) | |
# ).where( | |
# arel_table[:id].eq(translation_class.arel_table[:refinery_news_item_id]) | |
# ) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment