<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Attributes not saving for models with attachments</title>
	<atom:link href="http://www.motionstandingstill.com/attributes-not-saving-for-models-with-attachments/2008-11-05/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.motionstandingstill.com/attributes-not-saving-for-models-with-attachments/2008-11-05/</link>
	<description>high performance ruby on rails</description>
	<lastBuildDate>Tue, 31 Aug 2010 17:47:57 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kostas</title>
		<link>http://www.motionstandingstill.com/attributes-not-saving-for-models-with-attachments/2008-11-05/comment-page-1/#comment-4520</link>
		<dc:creator>Kostas</dc:creator>
		<pubDate>Wed, 08 Jul 2009 07:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.motionstandingstill.com/?p=170#comment-4520</guid>
		<description>I believe that the best course of action is to comment out the line from the plugin and add it manually to whichever model actually needs it.
This way you keep security and control on your code.</description>
		<content:encoded><![CDATA[<p>I believe that the best course of action is to comment out the line from the plugin and add it manually to whichever model actually needs it.<br />
This way you keep security and control on your code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lex</title>
		<link>http://www.motionstandingstill.com/attributes-not-saving-for-models-with-attachments/2008-11-05/comment-page-1/#comment-4152</link>
		<dc:creator>Lex</dc:creator>
		<pubDate>Sun, 31 May 2009 04:29:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.motionstandingstill.com/?p=170#comment-4152</guid>
		<description>I had a similar issue where I had set an attribute (id) that was not a model accessor.  I chose to manually set the id attribute and then remove it from the hash -- rather than make the id an accessor:

   1. def image_attributes=(image_attributes)
   2.     image_attributes.each do &#124;attributes&#124;
   3.       if attributes[:id].blank?
   4.         photos.build(attributes)
   5.       else
   6.         photo = photos.detect { &#124;t&#124; t.id == attributes[:id].to_i}
   7.         photo.id = attributes[:id]
   8.         attributes.delete(&quot;id&quot;)
   9.         photo.attributes = attributes
  10.       end
  11.     end
  12.   end

We get alot of speed with the Rails framework, e.g., Mass Assignment Hashes...but can spend alot of time debugging it, too.</description>
		<content:encoded><![CDATA[<p>I had a similar issue where I had set an attribute (id) that was not a model accessor.  I chose to manually set the id attribute and then remove it from the hash &#8212; rather than make the id an accessor:</p>
<p>   1. def image_attributes=(image_attributes)<br />
   2.     image_attributes.each do |attributes|<br />
   3.       if attributes[:id].blank?<br />
   4.         photos.build(attributes)<br />
   5.       else<br />
   6.         photo = photos.detect { |t| t.id == attributes[:id].to_i}<br />
   7.         photo.id = attributes[:id]<br />
   8.         attributes.delete(&#8220;id&#8221;)<br />
   9.         photo.attributes = attributes<br />
  10.       end<br />
  11.     end<br />
  12.   end</p>
<p>We get alot of speed with the Rails framework, e.g., Mass Assignment Hashes&#8230;but can spend alot of time debugging it, too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nahum</title>
		<link>http://www.motionstandingstill.com/attributes-not-saving-for-models-with-attachments/2008-11-05/comment-page-1/#comment-2871</link>
		<dc:creator>nahum</dc:creator>
		<pubDate>Mon, 16 Feb 2009 03:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.motionstandingstill.com/?p=170#comment-2871</guid>
		<description>Doing that is still a huge pain to maintain though as the same situation could occur later when someone else adds a new field to the model.  I&#039;m not working for that client anymore, so I&#039;ve told them what I did and left some hard to miss comments but ....

When it comes down to it I don&#039;t think a plugin should be doing that as it&#039;s business logic which should lie on the model itself rather than hidden somewhere else.</description>
		<content:encoded><![CDATA[<p>Doing that is still a huge pain to maintain though as the same situation could occur later when someone else adds a new field to the model.  I&#8217;m not working for that client anymore, so I&#8217;ve told them what I did and left some hard to miss comments but &#8230;.</p>
<p>When it comes down to it I don&#8217;t think a plugin should be doing that as it&#8217;s business logic which should lie on the model itself rather than hidden somewhere else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dw</title>
		<link>http://www.motionstandingstill.com/attributes-not-saving-for-models-with-attachments/2008-11-05/comment-page-1/#comment-2858</link>
		<dc:creator>dw</dc:creator>
		<pubDate>Sat, 14 Feb 2009 22:21:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.motionstandingstill.com/?p=170#comment-2858</guid>
		<description>Instead of commenting out the line, just list the attributes that you want to be set via mass assignment. This protects the rest of the stuff (parent_id, height, etc). Restart your server afterwards to make sure the file is initialized with your changes.

Line 179:
base.attr_accessible :uploaded_data, :your_colum_name, etc</description>
		<content:encoded><![CDATA[<p>Instead of commenting out the line, just list the attributes that you want to be set via mass assignment. This protects the rest of the stuff (parent_id, height, etc). Restart your server afterwards to make sure the file is initialized with your changes.</p>
<p>Line 179:<br />
base.attr_accessible :uploaded_data, :your_colum_name, etc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://www.motionstandingstill.com/attributes-not-saving-for-models-with-attachments/2008-11-05/comment-page-1/#comment-2497</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Mon, 17 Nov 2008 07:17:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.motionstandingstill.com/?p=170#comment-2497</guid>
		<description>Hey thanks for this insight I was having the same issue and I commented out line 171 in the file attchment_fu.rb located in the vendor plugin folder.  Seems to have done the trick, I am only uploading images and I haven&#039;t run into any problems yet with that one line commented out.  I will post here if I do run into any troubles.  Thanks again</description>
		<content:encoded><![CDATA[<p>Hey thanks for this insight I was having the same issue and I commented out line 171 in the file attchment_fu.rb located in the vendor plugin folder.  Seems to have done the trick, I am only uploading images and I haven&#8217;t run into any problems yet with that one line commented out.  I will post here if I do run into any troubles.  Thanks again</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.312 seconds -->
