cldwalker / hirb

A mini view framework for console/irb that's easy to use, even while under its influence. Console goodies include a no-wrap table, auto-pager, tree and menu.
http://tagaholic.me/hirb/
MIT License
1.65k stars 72 forks source link

rails 3 AR not compatible? #20

Closed bitflorist closed 14 years ago

bitflorist commented 14 years ago

Table output broken, when using new Rails 3 way:

what works: Tag.all :limit=>3, :order=>"id DESC"

but: Tag.limit(3).order("id DESC")

doesn't work yet?

iain commented 14 years ago

This is because, in Rails 3, Tag.limit(3) returns a ActiveRecord::Relation object, which Hirb doesn't know. Calling all or to_a on it, will convert it to an array, which Hirb will understand

cldwalker commented 14 years ago

Closing as your example isn't querying but just creating a relation

cldwalker commented 14 years ago

I was wrong. Relations do query the db. Added support for Relation objects: http://github.com/cldwalker/hirb/commit/cb7fc8f09713a6dd918e5be10ef1275f56aed507