weppos/tabs_on_rails

Problem with Rails 3

Opened this issue · 9 comments

Hi,

This might be a trivial problem, I'm new with rails and I've just downloaded release 1.2 of tabs_on_rails. I am using Rails 3. My tabs section is defined as follows:


<% tabs_tag do |tab| %>
  <%= tab.club  'Clubs', clubs_path %>
  <%= tab.users 'Users', users_path %>
<% end %>

The following error is then generated:


wrong number of arguments (2 for 3)
Extracted source (around line #11):

8:   
9: 
10: 
11:   <% tabs_tag do |tab| %>
12:     <%= tab.club  'Clubs', clubs_path, :style => 'float: right;' %>
13:     <%= tab.users 'Users', users_path, :style => 'float: right;' %>
14:   <% end %> 

Stack trace is:



tabs_on_rails-d3f1a3c3a04ceb7efc8f3e2970cd130c638a7bd9-master/lib/tabs_on_rails/tabs.rb:47:in `tab_for'
tabs_on_rails-d3f1a3c3a04ceb7efc8f3e2970cd130c638a7bd9-master/lib/tabs_on_rails/tabs.rb:47:in `method_missing'
tabs_on_rails-d3f1a3c3a04ceb7efc8f3e2970cd130c638a7bd9-master/lib/tabs_on_rails/tabs.rb:64:in `render'
tabs_on_rails-d3f1a3c3a04ceb7efc8f3e2970cd130c638a7bd9-master/lib/tabs_on_rails/tabs.rb:62:in `tap'
tabs_on_rails-d3f1a3c3a04ceb7efc8f3e2970cd130c638a7bd9-master/lib/tabs_on_rails/tabs.rb:62:in `render'
tabs_on_rails-d3f1a3c3a04ceb7efc8f3e2970cd130c638a7bd9-master/lib/tabs_on_rails/controller_mixin.rb:178:in `tabs_tag'
 tab_example/app/views/layouts/application.html.erb:11:in `_render_template_1107390719_2183099680_0'

The reason is that the standard Builder doesn't allow you to pass additional parameters to the tab. In other words, the :style parameter is not allowed.

However, because this is a frequent request, I've added the feature in the release 1.3.0.
Be sure to update the gem.

Added Ability to customize the behavior and the style of the li tab item passing a hash of options (closed by 093f6cc)

Hi, I'm getting the same wrong number of arguments error and I'm using the 1.3.0 gem. Any ideas?

Are you sure you are using the version 1.3.0?
Did you run bundle install again with the updated version?

Yes, I tried using both the 1.3.0 gem and the latest source. Running bundle install didn't fix it either. The stack trace is only slightly different from above:

vendor/plugins/weppos-tabs_on_rails-51bff5b/lib/tabs_on_rails/tabs.rb:47:in `tab_for'
vendor/plugins/weppos-tabs_on_rails-51bff5b/lib/tabs_on_rails/tabs.rb:47:in `method_missing'
vendor/plugins/weppos-tabs_on_rails-51bff5b/lib/tabs_on_rails/tabs.rb:64:in `render'
vendor/plugins/weppos-tabs_on_rails-51bff5b/lib/tabs_on_rails/tabs.rb:62:in `tap'
vendor/plugins/weppos-tabs_on_rails-51bff5b/lib/tabs_on_rails/tabs.rb:62:in `render'
vendor/plugins/weppos-tabs_on_rails-51bff5b/lib/tabs_on_rails/controller_mixin.rb:205:in `tabs_tag'

I am getting the same error:
wrong number of arguments (2 for 3)
27: = tabs_tag do |tab|
28: = tab.organizations "Organisationer", organizations_path if can? :manage, Organization
29: = tab.cms "CMS", pages_path if can? :manage, Organization

I am using the gem version 1.3.0. Rails 3.0.0.rc. Ruby 1.8.7.

I was previously using the fork at http://github.com/atomgas/tabs_on_rails which was working. I am making multiple calls to tabs_tag do |tag| in my application layout

Please try the release 1.3.1. It should work now.

Fixed error "wrong number of arguments (2 for 3)" (closed by 7cc890e)

just a confirmation that it's working for me. Thanks weppos!