We Recommend

Beginning Ruby: From Novice to Professional Beginning Ruby: From Novice to Professional
Beginning Ruby is a thoroughly contemporary guide for every type of reader wanting to learn Ruby, from novice programmers to web developers to Ruby newcomers. It starts by explaining the principles behind object-oriented programming and within a few chapters builds toward creating a genuine Ruby application.


Posted By

vanne on 02/12/07


Tagged

rails ruby irb


Versions (?)


shortcut method for display table schema


Published in: Ruby 


Add this inside your .irbrc file to call "show Model" in your console instead of "y Model.column_names"

  1. #add this inside .irbrc
  2. #shortcut for y model.column_names
  3. def show(obj)
  4. y(obj.send("column_names"))
  5. end

Report this snippet 

You need to login to post a comment.