When i write a Controller Class, it's possible to use methods like:
@article.update(article_params)
The method update comes from the class ActiveRecord::Base :
http://api.rubyonrails.org/v2.3/classes/ActiveRecord/Base.html#M001966
My questions:
How can I use the
updatemethod from a Controller class that does not inherit fromActiveRecord::Base? It looks likeApplicationControllerinherits only fromActionController::BaseAre there any resources available to read up on this?
Thanks for help, Cheers B
Rails follow the MVC architecture. In that architecture, your models interact with the database and your controllers interact with incoming requests (usually by orchestrating some models and then passing those off to some views that render the content). Rails achieves reuse through inheritance, so you can't (and probably wouldn't want to) mix concerns
I recommend checking out the official Rails guides. I think it's some of the best written documentation in the industry:
http://guides.rubyonrails.org/