I'm trying to figure out a good way to go about this.
Lets say I have a table that has posts, with titles, and different status IDs.
In my controller index, I have:
@posts = Post.all
Then in my model I have:
def check_status(posts)
posts.each do |post|
# logic here
end
end
So in my controller I have:
@posts.check_status(@posts)
but I'm getting the following error when loading the index:
undefined method check_status for <ActiveRecord::Relation:>
Any ideas?