Doug Jolley wrote:
[...]
> Do we only use models with databases or do they have other uses?

They certainly have other uses. Models represent any domain object that 
you need.  Sometimes these objects will correspond to DB records, 
sometimes not.

> 
> Models descend from ActiveRecord::Base.  That certainly gives rise to
> a notion that models are used exclusively with databases.
[...]

The Rails community often gives the impression that models have to 
descend from ActiveRecord::Base, but that's only true *if you need 
ActiveRecord features*.  True, most models in Rails apps tend to inherit 
from AR.  However, if you're modeling something that doesn't interact 
with the DB, there's generally no need to inherit from AR, but the class 
is still a model because it represents a domain object.
In other words, whether a class is considered a model has to do with the 
*conceptual* niche that it fills within the app, not with whether it 
inherits from AR.

Does that help?

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to