This post originated from an RSS feed registered with Ruby Buzz
by Robby Russell.
Original Post: Master, console, and servant part two
Feed Title: Robby on Rails
Feed URL: http://www.contegix.com/rss/feed.xml
Feed Description: My reflections on programming with Ruby, Rails, PostgreSQL... and learning how to run a business...
Noradio on IRC pointed out one thing that I did not mention in my previous blog entry… that you can bind a subsession of irb to a specific object. What??
Okay, let me explain this a bit more. Instead of always setting a variable to hold an instance of an object, you can be a bit more creative with irb.
I present…
So, for example. You can perform the following in script/console.
irb Model.find(4)
name
If there is an attribute/method called name in your model, then it will call it there. See my screen shot for some more details of how I used the jobs and fg # commands to switch jobs…. and I even found out what happens when you attempt to switch to the current thread. :-)