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

Wrong number of arguments error with certain SELECT statements #69

Closed leppert closed 11 years ago

leppert commented 11 years ago

I'm getting the following error with Hirb.enable. Switching to Hirb.disable allows it to run properly.

>> Post.joins(:user).select("posts.*, users.*").limit(10)
  Post Load (0.9ms)  SELECT posts.*, users.* FROM "posts" INNER JOIN "users" ON "users"."id" = "posts"."user_id" LIMIT 10
Hirb Error: wrong number of arguments (1 for 2)
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:306:in `ln'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:1640:in `link'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/object_table.rb:10:in `block (2 levels) in render'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/object_table.rb:10:in `each'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/object_table.rb:10:in `inject'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/object_table.rb:10:in `block in render'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/object_table.rb:9:in `each'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/object_table.rb:9:in `inject'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/object_table.rb:9:in `render'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/helpers/auto_table.rb:22:in `render'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/formatter.rb:73:in `_format_output'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/formatter.rb:56:in `format_output'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/view.rb:204:in `render_output'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/view.rb:123:in `view_output'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/irbtools-1.4.0/lib/irbtools/libraries.rb:145:in `view_or_page_output'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/hirb-0.7.1/lib/hirb/view.rb:186:in `output_value'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:160:in `block (2 levels) in eval_input'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/fancy_irb-0.7.3/lib/fancy_irb/irb_ext.rb:104:in `signal_status'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:70:in `block in start'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:69:in `catch'
    /Users/leppert/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:69:in `start'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
    /Users/leppert/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
    script/rails:6:in `require'
    script/rails:6:in `<main>'
cldwalker commented 11 years ago

Thanks for reporting your issue! You're #6 in my list of open issues. Use that link to check how soon your issue will be answered. Thanks for your patience.

cldwalker commented 11 years ago

Guessing from the offending line, it looks like one of your fields or ActiveRecord objects has an unexpected name that collides with a core class. I can debug if you give me a sample repository with data that recreates the problem. Alternatively, you can modify hirb locally and report with pp what you see for rows and options in that method.

cldwalker commented 11 years ago

Closing. I can reopen if you answer the above

w-A-L-L-e commented 10 years ago

Have same issue my model is following :

  1 class MaProspectAction < ActiveRecord::Base
  2   set_table_name "ma_prospect_action"
  3   attr_accessible :action_id, :date_created, :date_deadline, :date_deleted, :imported_id, :open, :prospect_id, :remarks, :user_id
  4   
  5 end

So it's either action_id, or open column (my first guesses) that breaks hirb here...