Ryan, very useful !
Another cool and powerful thing is that you can load (web)session objects straight into your console.
The how-to on this is written on:
http://tektastic.wordpress.com/2006/12/06/ruby-on-rails-how-to-load-session-objects-into-console/
You say your models don't always show up in autocompletion. This is just a case of lazy loading, console doesn't know your classes until you've loaded them (you did Project.new in the beginning, which loaded it). Once console's loaded/required your model, it'll auto-complete
Ryan, app.assigns doesn't seem to work with symbols. app.assings['projects'] works!
Great stuff -- I had no idea that 'y' method existed, very handy!
Re assigns -- you can use a symbol if you call the assigns method: app.assigns(:projects)
You can also do inline logging of SQL right in irb:
http://toolmantim.com/article/2007/2/6/system_wide_script_console_logging
If you think exiting and re-entering the console sucks, try
>> reload!
Nice tips! :D
A great source of knowledge (and magic tricks!) for my irbrc has been dotfiles.org
There are a bunch of nice .irbrc posted there, as there are some sweet .bashrc and .vimrc files, which might come in handy to some of you :)
I have a link to this screencast in http://thinkingeek.com/index.php?/archives/17-Customizing-IRB.html because I think it's a great one! :)
script/console isn't being "flaky" -- I believe the reason why your "name" method on your project didn't autocomplete until you accessed it because the method is created in the class by ActiveRecord::Base when it notices it doesn't exist (through a call to method_missing) See ActiveRecord::Base define_read_methods.
Often I just want to assign something to a variable, but I don't want to see tons of output, e.g. actors = Actor.find_all.
I discovered that I can eliminate the (large) output by appending a "dummy" command that returns nil or something short like 1.
E.g.
actors = Actor.find_all ; 1
or
actors = Actor.find_all ; actors.size
Mike
Mike
Don't forget Wirble!
It's my favorite console trick.
Hey,
Just wanted to point out that script/console production --sandbox can be dangerous. Any models objects you load up that way will lock the database for those rows (assuming your db's transactions use a certain form of lock), effectively stopping your site from running. Use with care!
Just an FYI, I had to add
require 'rubygems'
at the top of my .irbrc file before this would work.
Thank you for sharing your admin would prepare a really useful article I congratulate
here is lot of console trip n trick in rails
http://madhukaudantha.blogspot.com/2009/12/ruby-on-rails-part-3-console-tips.html
PS2 games will not work in a PS1 but all PS1 games will work in a PS2. No tricks, you just put it in and it'll load up. What you can also do is, before closing the disc tray, on the 'browser' screen press triangle for system info, and on Playstation driver press it again for options.
<a href="http://www.anaheimwhitehousewedding.com/">rehearsal dinner</a>
Thanks for the good info, your site is so cool.
Thanks for sharing. I enjoy this site. Keep it up.
Many thanks for all the great screencasts. I really enjoy watching the RailsCasts. I think type of site that is useful in sharing information and it is important to share.
It doesn't have better games right now because it's "new" still and developers will get better acquainted and will produce WAY better games then 360 can even dream of having.
What you can also do is, before closing the disc tray, on the 'browser' screen press triangle for system info, and on Playstation driver press it again for options.
Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets
I think type of site that is useful in sharing information and it is important to share.






