I’ve got a helper in my ApplicationHelper file that works just fine:
def latest_issue
@issue = Issue.find(:all, :order => "id DESC", :limit => 1)
return @issue
end
After that, using @issue works just fine in any view, but considering that @issue has a column named message using @issue.message returns a No Method Error.
Any help would be fantastic! Cheers.
The issue instance variable is returning an array of objects not an instance. If you would like to select an attribute of an Issue object you need to return an instance of the object.
You may be trying to output all the message attributes of the Issue object, if that is the case you need to pass the @issue to an block