Created
June 9, 2013 20:46
-
-
Save bplexico/5745147 to your computer and use it in GitHub Desktop.
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
#removed from update_index | |
table_name = "#{observer_search_data.object_name}_search_data" | |
foreign_key = "#{observer_search_data.object_name}_id" | |
#new ObserverSearchData class | |
class ObserverSearchData | |
attr_reader :search_data | |
def initialize(obj, search_data) | |
@obj = obj | |
@search_data = search_data | |
end | |
def id | |
@obj.id | |
end | |
def table_name | |
"#{object_name}_search_data" | |
end | |
def foreign_key | |
"#{object_name}_id" | |
end | |
private | |
def object_name | |
@obj.class.name.downcase | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment