<div dir="ltr">Does this new feature in active record change things?<div><br></div><div><a href="http://edgeapi.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html">http://edgeapi.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 February 2015 at 08:34, Tom Stuart <span dir="ltr"><<a href="mailto:tom@codon.com" target="_blank">tom@codon.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 18 Feb 2015, at 11:33, Thomas Buckley-Houston <<a href="mailto:tom@tombh.co.uk">tom@tombh.co.uk</a>> wrote:<br>
> My problem with poking around the console is that it's counter to the<br>
> MVC philosophy of using the Model to describe your domain.<br>
<br>
</span>I’m surprised nobody’s come out with the obvious-but-unhelpful smartarse answer yet, so I’ll just say it to clear the air:<br>
<br>
The underlying problem is that Active Record is fit for use as a persistence layer, but not as your domain model. Ideally you would use it for the single concern of trafficking data between the database and a genuine layer of domain objects, which of course can be as rich, descriptive and documented as you like, being the single source of truth for model concerns. In this arrangement the only role of Active Record instances is to map directly onto the database tables and fields, so it makes sense for them to not re-represent this information in code; they’re simply the database reflected in a Ruby mirror. Your actual model objects can be much more than this.<br>
<br>
Of course experience has shown that this is very difficult to achieve in practice because of the way that Rails and AR work, but hey, why let reality spoil our fun?<br>
<br>
Cheers,<br>
-Tom<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Chat mailing list<br>
<a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br>
Archives: <a href="http://lists.lrug.org/pipermail/chat-lrug.org" target="_blank">http://lists.lrug.org/pipermail/chat-lrug.org</a><br>
Manage your subscription: <a href="http://lists.lrug.org/options.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/options.cgi/chat-lrug.org</a><br>
List info: <a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org" target="_blank">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br>
</div></div></blockquote></div><br></div>