<?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: On the Existence of Struct::Group in&#160;Rails</title>
	<atom:link href="http://almosteffortless.com/2008/11/15/on-the-existence-of-structgroup-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://almosteffortless.com/2008/11/15/on-the-existence-of-structgroup-in-rails/</link>
	<description></description>
	<lastBuildDate>Wed, 10 Mar 2010 01:15:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Trevor</title>
		<link>http://almosteffortless.com/2008/11/15/on-the-existence-of-structgroup-in-rails/comment-page-1/#comment-66829</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Sun, 16 Nov 2008 07:22:08 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=868#comment-66829</guid>
		<description>Maybe I should say... surprising? In my case, I didn&#039;t expect that calling Group.find from within a Struct would be any different from calling it elsewhere in my app. The fact that Struct::Group already existed came from way out in left field, to me at least.</description>
		<content:encoded><![CDATA[<p>Maybe I should say&#8230; surprising? In my case, I didn&#8217;t expect that calling Group.find from within a Struct would be any different from calling it elsewhere in my app. The fact that Struct::Group already existed came from way out in left field, to me at least.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Todd</title>
		<link>http://almosteffortless.com/2008/11/15/on-the-existence-of-structgroup-in-rails/comment-page-1/#comment-66826</link>
		<dc:creator>Matt Todd</dc:creator>
		<pubDate>Sun, 16 Nov 2008 02:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=868#comment-66826</guid>
		<description>Not weird at all, it&#039;s just a scoping issue... if you&#039;re asking for Group inside of a scope that has it defined, it will return the first one instead of the one outside of the first scope checked (which is usually always the local scope).

When you prefix two colons like ::Group you&#039;re actually saying Object::Group which tells Ruby to look in the scope of the Object class which will see the right class because the other one is only local inside of the Struct class object.

If I can clarify further, let me know.

Matt</description>
		<content:encoded><![CDATA[<p>Not weird at all, it&#8217;s just a scoping issue&#8230; if you&#8217;re asking for Group inside of a scope that has it defined, it will return the first one instead of the one outside of the first scope checked (which is usually always the local scope).</p>
<p>When you prefix two colons like ::Group you&#8217;re actually saying Object::Group which tells Ruby to look in the scope of the Object class which will see the right class because the other one is only local inside of the Struct class object.</p>
<p>If I can clarify further, let me know.</p>
<p>Matt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://almosteffortless.com/2008/11/15/on-the-existence-of-structgroup-in-rails/comment-page-1/#comment-66825</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Sat, 15 Nov 2008 22:20:32 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=868#comment-66825</guid>
		<description>I believe if you did it that way, you&#039;d need to &lt;a href=&quot;http://www.ruby-doc.org/docs/UsersGuide/rg/objinitialization.html&quot; rel=&quot;nofollow&quot;&gt;define the initialize method&lt;/a&gt; as well, so that you could pass in your variables. That&#039;s fine, but it would be a bit more code.</description>
		<content:encoded><![CDATA[<p>I believe if you did it that way, you&#8217;d need to <a href="http://www.ruby-doc.org/docs/UsersGuide/rg/objinitialization.html" rel="nofollow">define the initialize method</a> as well, so that you could pass in your variables. That&#8217;s fine, but it would be a bit more code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Wilden</title>
		<link>http://almosteffortless.com/2008/11/15/on-the-existence-of-structgroup-in-rails/comment-page-1/#comment-66824</link>
		<dc:creator>Mark Wilden</dc:creator>
		<pubDate>Sat, 15 Nov 2008 21:38:22 +0000</pubDate>
		<guid isPermaLink="false">http://almosteffortless.com/?p=868#comment-66824</guid>
		<description>Thanks for the heads-up.

How is

 class NewsletterJob &lt; Struct.new(:text, :emails)
 end

different from

 class NewsletterJob
   attr_accessor :text, :emails
 end

?</description>
		<content:encoded><![CDATA[<p>Thanks for the heads-up.</p>
<p>How is</p>
<p> class NewsletterJob &lt; Struct.new(:text, :emails)<br />
 end</p>
<p>different from</p>
<p> class NewsletterJob<br />
   attr_accessor :text, :emails<br />
 end</p>
<p>?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
