I am working on a rails app that on the view side makes an Ajax call every 5 minutes or so to a controller to check if there are any new messages that were created for a particular user. Now I know the way of Rails (or MVC for that matter) is to use Fat Models/Skinny Controllers, how would I call my model from my controller so that the data is being returned in the model?
Here is my controller:
def get_all_notes_by_page
if request.xhr?
return Note.where("page_id = ?", params[:page_id]).count
end
end
Thanks in advance for all of the help!