Hello all.
Can't figure this one out. In rails model, I want to call a method within the same model to manipulate data returned by a find method. This 'filter' method will be called from many custom find method within this model, so I want it to be separate. (and I cannot filter from the SQL it is too complicated)
Here is an example:
#controller
@data = Model.find_current
#model
class Model
def self.find_current
@rows = find(:all)
filter_my_rows
return @rows
end
def filter_my_rows
#do stuff here on @rows
for row in @rows
#basically I remove rows that do not meet certain conditions
end
end
end
The result of this is: undefined method `filter_my_rows'
Thank you for any help!