I am currently looking for a software/web development job preferably as a Rails-based developer.
Please email me at email@example.com. Thanks in advance for any leads!
How To Create Aliases And Functions For IRB & Rails Console
Posted by Weston Ganger
Sometimes you might want to create aliases or functions for your rails console or irb. To do it you just need to create or edit ~/.irbrc
# ~/.irbrc # If the command already exists and you want to create an alias for it alias q exit # Usage: q # Create a class that contains methods that do work. class SwissKnife def list_tables ActiveRecord::Base.connection.tables end end # Usage: SwissKnife.list_tables # OR If you want to create a base level method / command that does a few things at once you create a method on the kernel module. # ** Note this can be UNSAFE if you overwrite any of the kernels methods class Kernel def tables ActiveRecord::Base.connection.tables end end # Usage: tables
Related External Links: