jr3 (63K)

Surely not...

Posted by closetmaster Mon, 13 Feb 2006 18:21:00 GMT

Ever since I put my first web page up, I have struggled to find fulfilling things to develop. Unlike so many others, I started messing with computers because I had a fascination with how computers do what they do (rather than with making them do cool stuff). I am so much of an introvert that I have avoided trying to get this and my other sites (Readings in Analytic Philosophy, Extracurriculars, my comcast home page) advertisement. Steve Pavlina has some good words about moving out of extreme introvertedness here. One heuristic he had that appealed especially to my philosophical side was imaging how I would act if it were the case that there weren’t real people reading my sites. So, all of this is to say that I am really going to make an honest attempt to network and build my online relationships.

Still a Ruby Newbie

Posted by closetmaster Sun, 12 Feb 2006 05:27:00 GMT

I am not sure why, but the following code generated errors for me: @pieces = Piece.find(:all, :conditions =>”user = ’#{@session[:user].id}’”)

I had to save the @session[:user].id, like this… tmp = @session[:user].id @pieces = Piece.find(:all, :conditions =>”user = ’#{tmp}’”)

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’s Guide, the author notes that,

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’t need to supply the braces when the expression is simply a global, instance, or class variable.

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.


designed by jowensbysandifer