<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Software is Crap]]></provider_name><provider_url><![CDATA[https://davmac.wordpress.com]]></provider_url><author_name><![CDATA[davmac]]></author_name><author_url><![CDATA[https://davmac.wordpress.com/author/davmac/]]></author_url><title><![CDATA[Inconsistency in Rails]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>Good ol&#8217; ActiveRecord::Base has a bunch of &#8220;update&#8221; methods with arbitrary semantics in regards to object validation:</p>
<p><strong>update</strong>(id, attributes) &#8211; performs validation<br />
<strong>update_all</strong>(update, conditions, options) &#8211; doesn&#8217;t validate, and reverses the operand order (what attributes to change first, followed by the records to change as specified by &#8220;conditions&#8221;, rather than the other way around). Note also that despite its name it doesn&#8217;t (necessarily) update <em>all</em> records.<br />
<strong>update_counters</strong>(id, counters) &#8211; doesn&#8217;t validate, reverts operand order</p>
<p>instance methods:</p>
<p><strong>update_attribute</strong>(name, value) &#8211; doesn&#8217;t validate<br />
<strong>update_attributes</strong>(attributes) &#8211; does validate<br />
<strong>update_attributes!</strong>(attributes) &#8211; does validate</p>
<p>A bit of consistency wouldn&#8217;t have gone astray. The instance methods are particularly bad &#8211; by what rationale does update_attribute not validate while update_attributes does??</p>
]]></html></oembed>