<?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>a.muse: Still a Ruby Newbie</title>
    <link>http://www.jessirae.com/blog/articles/2006/02/11/still-a-ruby-newbie</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Still a Ruby Newbie</title>
      <description>&lt;p&gt;I am not sure why, but the following code generated errors for me: 
@pieces = Piece.find(:all, :conditions =&amp;gt;&amp;#8221;user = &amp;#8217;#{@session[:user].id}&amp;#8217;&amp;#8221;)&lt;/p&gt;


	&lt;p&gt;I had to save the @session[:user].id, like this&amp;#8230; tmp = @session[:user].id @pieces = Piece.find(:all, :conditions =&amp;gt;&amp;#8221;user = &amp;#8217;#{tmp}&amp;#8217;&amp;#8221;)&lt;/p&gt;


	&lt;p&gt;This probabaly has something to do with ruby saving @session[:user].id as an string instead of an integer. I am having a similar problem right now in another portion of my code, I think. In order to show an image, I had to save the instance variable in the controller and then access it in the view rhtml file using piece3.picture. Update: In the Progamming Ruby: The Pragmatic Programmer&amp;#8217;s Guide, the author notes that,&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;When Ruby constructs this string object, it looks at the current value of name and substitutes it into the string. Arbitrarily complex expressions are allowed in the #{...} construct. As a shortcut, you don&amp;#8217;t need to supply the braces when the expression is simply a global, instance, or class variable.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;I am guessing that @session[:user].id returns a value, so that when you try to take the value of the value @session[:user].id, you get some garbage.&lt;/p&gt;
</description>
      <pubDate>Sat, 11 Feb 2006 23:27:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:aec8d664-691e-4688-a8be-e670716d9f09</guid>
      <author>closetmaster</author>
      <link>http://www.jessirae.com/blog/articles/2006/02/11/still-a-ruby-newbie</link>
      <category>ruby &amp; rails</category>
      <category>technology</category>
      <trackback:ping>http://www.jessirae.com/blog/articles/trackback/33</trackback:ping>
    </item>
  </channel>
</rss>
