activeadmin / inherited_resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange error in url helpers

nilcolor opened this issue · comments

I'm migrating my app from Rails 3 to Rails 4. And one of the strange thing is:

ActionView::CompiledTemplates#_app_views_opportunities__grid_html_haml__2524147197740546774_70243438221900:

 => 1: - require 'pry'; binding.pry

[1] pry(#<#<Class:0x007fc5a2b9d358>>)> new_resource_path
ArgumentError: arguments passed to url_for can't be handled. Please require routes or provide your own implementation
from vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_view/helpers/url_helper.rb:38:in `url_for'

[2] pry(#<#<Class:0x007fc5a2b9d358>>)> collection.class
=> ActiveRecord::Relation::ActiveRecord_Relation_Opportunity

[3] pry(#<#<Class:0x007fc5a2b9d358>>)> collection.count
   (1.3ms)  SELECT COUNT(*) FROM "opportunities" WHERE "opportunities"."created_in_branch_id" = 2
=> 1506

[4] pry(#<#<Class:0x007fc5a2b9d358>>)> new_opportunity_path
=> "/opportunities/new"

[5] pry(#<#<Class:0x007fc5a2b9d358>>)> opportunities_path
=> "/opportunities"

So I've got ArgumentError: arguments passed to url_for can't be handled. Please require routes or provide your own implementation message when calling IR path helpers. What's wrong here?
IR included like this:

class ApplicationController < ActionController::Base
  inherit_resources
end

Stack trace (up from template):

  vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_view/helpers/url_helper.rb:38:in `url_for'
  vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:209:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:178:in `call'
  vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:249:in `block (2 levels) in define_url_helper'
  vendor/bundle/ruby/2.0.0/bundler/gems/inherited_resources-58f81b47f948/lib/inherited_resources/url_helpers.rb:222:in `new_resource_path'
  vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/abstract_controller/helpers.rb:53:in `new_resource_path'
  app/views/opportunities/_grid.html.haml:7:in `block in _app_views_opportunities__grid_html_haml__2524147197740546774_70243438221900'

Ups. Problem found: it wasn't IR fault. It was other gem.

What gem was causing this problem? I'm getting this message when using activeadmin and can't find any information about it.

In my case it was Gretel (https://github.com/lassebunk/gretel)
Not new one… It was our fork btw.