<?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: state_machine: One machine to rule them all?</title>
	<atom:link href="http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/</link>
	<description>Plugins worth their weight in rubies.</description>
	<lastBuildDate>Mon, 14 Jun 2010 01:03:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: aaron</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-92</link>
		<dc:creator>aaron</dc:creator>
		<pubDate>Sun, 14 Mar 2010 21:25:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-92</guid>
		<description>Aaron Cohen - Please ask questions like this on the mailing list if you still need help. Thanks :)</description>
		<content:encoded><![CDATA[<p>Aaron Cohen &#8211; Please ask questions like this on the mailing list if you still need help. Thanks <img src='http://www.pluginaweek.org/wp-content/plugins/smilies-themer/adiumicons/happy.png' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aaron Cohen</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-91</link>
		<dc:creator>Aaron Cohen</dc:creator>
		<pubDate>Fri, 19 Feb 2010 23:53:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-91</guid>
		<description>If a transition fails due to a validation on the state being transitioned to, how can one determine which validation caused the failure?

I have a very simple case (everything non-essential has been trimmed) -

state_machine :status, :initial =&gt; :unpublished do
  event :publish do
    transition :unpublished =&gt; :published
  end
  state :published do
    validate :start_at_in_future
  end
end

def start_at_in_future
  errors.add(:start_at, &#039;must be in the future&#039;) unless start_at &gt; Time.zone.now
end

should &quot;validate that the start_at is in the future to perform a publish transition&quot; do
  @deal.start_at = Time.zone.now - 1.second
  assert @deal.can_publish? # wish this would return false, but understand why it doesn&#039;t
  assert !@deal.publish
  assert !@deal.published?
  pp @deal.errors.inspect # no errors; how to tell the web GUI what went wrong?
end

Thanks for any advice/recommendation you have!!</description>
		<content:encoded><![CDATA[<p>If a transition fails due to a validation on the state being transitioned to, how can one determine which validation caused the failure?</p>
<p>I have a very simple case (everything non-essential has been trimmed) -</p>
<p>state_machine :status, :initial =&gt; :unpublished do<br />
  event :publish do<br />
    transition :unpublished =&gt; :published<br />
  end<br />
  state :published do<br />
    validate :start_at_in_future<br />
  end<br />
end</p>
<p>def start_at_in_future<br />
  errors.add(:start_at, &#8216;must be in the future&#8217;) unless start_at &gt; Time.zone.now<br />
end</p>
<p>should &#8220;validate that the start_at is in the future to perform a publish transition&#8221; do<br />
  @deal.start_at = Time.zone.now &#8211; 1.second<br />
  assert @deal.can_publish? # wish this would return false, but understand why it doesn&#8217;t<br />
  assert !@deal.publish<br />
  assert !@deal.published?<br />
  pp @deal.errors.inspect # no errors; how to tell the web GUI what went wrong?<br />
end</p>
<p>Thanks for any advice/recommendation you have!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fisons</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-90</link>
		<dc:creator>fisons</dc:creator>
		<pubDate>Thu, 24 Sep 2009 08:05:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-90</guid>
		<description>I watch you! (@github)</description>
		<content:encoded><![CDATA[<p>I watch you! (@github)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cies</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-89</link>
		<dc:creator>cies</dc:creator>
		<pubDate>Fri, 18 Sep 2009 13:25:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-89</guid>
		<description>this code is soooo pretty -- it nearly made me cry..

thanks! im gonna use it with dm tomorrow (ok, i lie: monday).</description>
		<content:encoded><![CDATA[<p>this code is soooo pretty &#8212; it nearly made me cry..</p>
<p>thanks! im gonna use it with dm tomorrow (ok, i lie: monday).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ennuyer.net &#187; Blog Archive &#187; I am way behind on my rails link blogging. Link dump and reboot.</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-83</link>
		<dc:creator>Ennuyer.net &#187; Blog Archive &#187; I am way behind on my rails link blogging. Link dump and reboot.</dc:creator>
		<pubDate>Sat, 09 May 2009 10:48:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-83</guid>
		<description>[...]  state_machine: One machine to rule them all? &#124; PluginAWeek  [...]</description>
		<content:encoded><![CDATA[<p>[...]  state_machine: One machine to rule them all? | PluginAWeek  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ennuyer.net &#187; Blog Archive &#187; 2009-05-09- Today’s Ruby/Rails Reading</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-82</link>
		<dc:creator>Ennuyer.net &#187; Blog Archive &#187; 2009-05-09- Today’s Ruby/Rails Reading</dc:creator>
		<pubDate>Sat, 09 May 2009 09:55:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-82</guid>
		<description>[...]  state_machine: One machine to rule them all? &#124; PluginAWeek  [...]</description>
		<content:encoded><![CDATA[<p>[...]  state_machine: One machine to rule them all? | PluginAWeek  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aaron</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-81</link>
		<dc:creator>aaron</dc:creator>
		<pubDate>Thu, 07 May 2009 00:13:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-81</guid>
		<description>@Phillip You can post messages on the &lt;a href=&quot;http://groups.google.com/group/pluginaweek-talk&quot; rel=&quot;nofollow&quot;&gt;PluginAWeek-Talk&lt;/a&gt; Google Group.  It looks like your error message didn&#039;t quite make it through the filters.  My guess based on what made it through is that the library wasn&#039;t loaded properly (assuming you&#039;re loading it via a gem).  If you post something up on the Google Group, myself or others would be more than happy to help out there.  Best of luck! :)</description>
		<content:encoded><![CDATA[<p>@Phillip You can post messages on the <a href="http://groups.google.com/group/pluginaweek-talk" rel="nofollow">PluginAWeek-Talk</a> Google Group.  It looks like your error message didn&#8217;t quite make it through the filters.  My guess based on what made it through is that the library wasn&#8217;t loaded properly (assuming you&#8217;re loading it via a gem).  If you post something up on the Google Group, myself or others would be more than happy to help out there.  Best of luck! <img src='http://www.pluginaweek.org/wp-content/plugins/smilies-themer/adiumicons/happy.png' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phillip Med</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-80</link>
		<dc:creator>Phillip Med</dc:creator>
		<pubDate>Wed, 06 May 2009 19:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-80</guid>
		<description>Actually i read above..and found it.......

I keep getting this:

undefined method `state_machine&#039; for #</description>
		<content:encoded><![CDATA[<p>Actually i read above..and found it&#8230;&#8230;.</p>
<p>I keep getting this:</p>
<p>undefined method `state_machine&#8217; for #</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phillip Med</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-79</link>
		<dc:creator>Phillip Med</dc:creator>
		<pubDate>Wed, 06 May 2009 19:08:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-79</guid>
		<description>is there a group out there for support and for installation instructions? Thanks</description>
		<content:encoded><![CDATA[<p>is there a group out there for support and for installation instructions? Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aaron</title>
		<link>http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/comment-page-1/#comment-65</link>
		<dc:creator>aaron</dc:creator>
		<pubDate>Sun, 05 Apr 2009 20:36:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.pluginaweek.org/?p=35#comment-65</guid>
		<description>@John - You&#039;re exactly right... I misinterpreted the question as a list of states that are allowed to be transitioned to from the current state.  Thanks for helping out!

@Scott - Great feedback!  Glad to hear it&#039;s helped :)</description>
		<content:encoded><![CDATA[<p>@John &#8211; You&#8217;re exactly right&#8230; I misinterpreted the question as a list of states that are allowed to be transitioned to from the current state.  Thanks for helping out!</p>
<p>@Scott &#8211; Great feedback!  Glad to hear it&#8217;s helped <img src='http://www.pluginaweek.org/wp-content/plugins/smilies-themer/adiumicons/happy.png' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
