2008-04-15 12:08:32 +0000
Face it, you use Ruby, you use Rails, you are going to use the shell, either in the console or directly, here are some shortcuts I can’t live without.
Have you ever done this?
baci:~/rails_app mikel$ ./script/generate user first_name:string mid_name:string last_name:string address1:string address2:string address3:string suburb:string state:string country:string post_code:string home_phone:string work_phone:string mobile_phone:string email:string Couldn't find 'users' generator baci:~/rails_app mikel$
Grr… of course, you forgot to put the word “model” before the word “user”.
You can hit the up arrow and get all the text back, but if you were like me, you used to hit the left arrow and hold it down for about half an hour to get to the start of the line. Well, no more. Shell Shortcuts are your friend!
Simply type up arrow and then “Ctrl-A” and you are at the start of the line.
Hit “Ctrl-E” and you will be at the end of the line.
Or, if you want a clean screen, “Ctrl-L” will do it for you.
If you make a mistake, “Ctrl-_” will undo it.
And you also have cut and paste on the command line.
“Ctrl-U” cuts the beginning of the line to the cursor
“Ctrl-K” cuts from the cursor to the end of the line
and “Ctrl-Y” pastes whatever you have cut out back into the screen at the cursor.
The cool thing is, all of these work within the Rails console as well!.
So, you are in the console and type:
>> User.find(:all, :conditions => ["user_name = ? AND first_name = ?", "mikel", "Mikel"])
And forget that you want to assign it to the “user” variable? Well, type “Ctrl-A” and then “*user = *” and hit return and you are done.
Nice, handy time saving short cuts.
You can also find out other ones by Googling Bash shell short cuts
Of course, the above assumes you are using Bash, Ksh or other SH like shells on Mac or *nix
- Rails Security Alert
- Encrypting Another Partition Using FileVault 2 on OSX Lion
- Installing Home Folder on Second Drive on OSX Lion
- undefined local variable or method `version_requirements'
- A New World of Resources
- Rails Static Pages
- Twitter Replacing Rails? So?
- Engine Yard Cloud Backups Generating Zero Length Backups
- Our Rails Rumble Entry - StillAlive.com
- Renaming a controller and redirection in Rails 3
- Updating RailsPlugins.org to Rails 3 - Part 1
- A new protocol for social interaction
- What is a distributed social network?
- Bundler and Public Git Sources
- Getting Heroku, memcached and Rails 3 working
- Why Bundler?
- Rails Commit Access
- Introducing TellThemWhen
- rake RSpec & Cucumber uninitialized constant Rails::Boot::Bundler
- This Relationship is Worth Nothing
- Thank YOU...
- Inline Attachments for ActionMailer
- Upgrading RailsPlugins.org to Rails 3 - Part 1
- Stripping dollar signs and commas from a string
- Getting Rails 3 Edge with jQuery, RSpec and Cucumber using RVM
- Action Mailer, go Proc thyself
- The Real News Donation Drive
- ActionMailer ScreenCast and Article
- Installing RSpec for Rails 3
- I am speaking at RailsConf 2010
- Rails 3 Session Secret and Session Store
- If you're lazy and you know it write your specs!
- Bundler - uninitialized constant ActionController
- Bundle Me Some Sanity
- How to use Mail / ActionMailer 3 with GMail SMTP
- Put your mailer where the action is!
- Why Force a Choice?
- How to make an RSS feed in Rails
- Rails 3 Routing with Rack
- Bundle me some Rails
- Helping out in Haiti
- Watch your self
- Is Rails 3.0 a Game Changer?
- Where did the scripts go?
- validates :rails_3, :awesome => true
- New Rails Version 3.0 Guides Online
- New ActionMailer API in Rails 3.0
- Mail gem version 2 released
- How to rename a Rails 3 Application
- Rails 3.0 Examples
- November 2009 (1)
- October 2009 (2)
- September 2009 (2)
- August 2009 (0)
- July 2009 (1)
- June 2009 (0)
- May 2009 (1)
- April 2009 (0)
- March 2009 (0)
- February 2009 (0)
- January 2009 (2)
- December 2008 (0)
- November 2008 (5)
- October 2008 (0)
- September 2008 (1)
- August 2008 (0)
- July 2008 (2)
- June 2008 (13)
- May 2008 (7)
- April 2008 (18)
- March 2008 (8)
- February 2008 (5)
- January 2008 (7)
- December 2007 (20)
- November 2007 (22)