<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>{ height: 1%; } - Ruby on Rails and User Interface Design: On acts_as_paranoid</title>
    <link>http://height1percent.com/articles/2006/02/13/on-acts_as_paranoid</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>CSS, UI Design, Ruby on Rails and cheese ... lots of cheese</description>
    <item>
      <title>On acts_as_paranoid</title>
      <description>Installed the &lt;a href="http://ar-paranoid.rubyforge.org/"&gt;acts_as_paranoid&lt;/a&gt; plugin today for a top secret project I am working on. The documentation is quite lacking so I&amp;#8217;ll fill in a few holes here. This may be obvious to everyone else out there but in order for it to work you need to add the following to the end of your &lt;em&gt;environment.rb&lt;/em&gt; file:
&lt;pre&gt;require_gem 'acts_as_paranoid'&lt;/pre&gt;
Doing this got rid of the 500 error I was encountering, but my objects were still being outright deleted, instead of having the &lt;strong&gt;deleted_at&lt;/strong&gt; field set. A checked of the &lt;em&gt;development.log&lt;/em&gt; showed that &lt;strong&gt;tasks.deleted_at &lt;span class="caps"&gt;IS NULL&lt;/span&gt;&lt;/strong&gt; was being injected into &lt;span class="caps"&gt;SQL&lt;/span&gt; queries. So obviously the plugin was working on some level. My class looked like the following:
&lt;pre&gt;class Task
  acts_as_taggable
  &amp;lt;strong&amp;gt;acts_as_paranoid&amp;lt;/strong&amp;gt;
&lt;/pre&gt;For grins I tried swapping those two acts_* statements:
&lt;pre&gt;class Task
  &amp;lt;strong&amp;gt;acts_as_paranoid&amp;lt;/strong&amp;gt;
  acts_as_taggable
&lt;/pre&gt;And it started working correctly! Not sure the cause of this I&amp;#8217;ll try and ping the developers for &lt;a href="http://ar-paranoid.rubyforge.org/"&gt;acts_as_paranoid&lt;/a&gt;.

Also, while for the most part I wanted deleted items to not show up in any associations there were a few where I still wanted the deleted association to be retrieved. I solved this by adding the following:
&lt;pre&gt;class TimeEntry &amp;lt; ActiveRecord::Base
  belongs_to :task

  def task
    &amp;lt;strong&amp;gt;Task.find_with_deleted(task_id) if task_id != 0&amp;lt;/strong&amp;gt;
  end&lt;/pre&gt;
If you know of a more elegant way to do this, drop me a line and let me know.</description>
      <pubDate>Mon, 13 Feb 2006 02:06:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b41944d74e0fc9917c7cb99ac111edaf</guid>
      <author>Richard White</author>
      <link>http://height1percent.com/articles/2006/02/13/on-acts_as_paranoid</link>
      <category>rails</category>
      <trackback:ping>http://height1percent.com/articles/trackback/4</trackback:ping>
    </item>
    <item>
      <title>"On acts_as_paranoid" by Richard White</title>
      <description>&lt;p&gt;Mark: Interesting, I had actually just dropped my usage of the plugin a few days ago when I found that it didn&amp;#8217;t work for Rails 1.1. I don&amp;#8217;t really need its functionality currently so I just dropped it without much research, but I&amp;#8217;ll look into your workaround. Have you passed your work along to the developers of acts_as_paranoid?&lt;/p&gt;</description>
      <pubDate>Tue, 25 Apr 2006 07:49:21 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:</guid>
      <link>http://height1percent.com/articles/2006/02/13/on-acts_as_paranoid#comment-538</link>
    </item>
    <item>
      <title>"On acts_as_paranoid" by Mark J</title>
      <description>&lt;p&gt;Hi, i would like to add the following that the existing version doesn&amp;#8217;t work with Rails 1.1, due to the assumption on the part that scoped_methods is not an array (scope up to one level onf nesting only). With the added support to nested scope in Rails 1.1, the part of the code where it tries to work around the scope method no longer works.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve created a simple work-around to this problem, and i&amp;#8217;ve outlined it on my website. I thought you might be interested to take a look:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://cebu.palmade.net/blog/ruby-on-rails/acts_as_paranoid-fix-for-rails-11-and-beyond/"&gt;http://cebu.palmade.net/blog/ruby-on-rails/acts_as_paranoid-fix-for-rails-11-and-beyond/&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 25 Apr 2006 04:31:18 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:</guid>
      <link>http://height1percent.com/articles/2006/02/13/on-acts_as_paranoid#comment-537</link>
    </item>
  </channel>
</rss>
