Administrate: Cannot run rails generate administrate:install

Created on 9 Mar 2016  路  7Comments  路  Source: thoughtbot/administrate

Hi All,

I'm trying gem administrate but I encounter the problem when running the command generate administrate:install.

As I investigated, the problem is because of this lines of code in namespace.rb:

def resources
    namespace_controller_paths.uniq.map do |controller|
      controller.gsub(/^#{namespace}\//, "").to_sym
    end
end

Its returned value includes the symbol that is created from empty string :"" .
Does anyone encounter this error?

Here's the backtrace:

/Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/railties-4.2.4/lib/rails/generators/named_base.rb:102:in block in class_name': undefined methodcamelize' for nil:NilClass (NoMethodError)
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/railties-4.2.4/lib/rails/generators/named_base.rb:102:in map!' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/railties-4.2.4/lib/rails/generators/named_base.rb:102:inclass_name'
from (erb):3:in template' from /Users/bebe/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/erb.rb:863:ineval'
from /Users/bebe/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/erb.rb:863:in result' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:116:inblock in template'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in call' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:inrender'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/create_file.rb:46:in identical?' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/create_file.rb:72:inon_conflict_behavior'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/empty_directory.rb:113:in invoke_with_conflict_check' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/create_file.rb:60:ininvoke!'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions.rb:94:in action' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/create_file.rb:25:increate_file'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:115:in template' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/railties-4.2.4/lib/rails/generators/named_base.rb:26:inblock in template'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/railties-4.2.4/lib/rails/generators/named_base.rb:60:in inside_template' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/railties-4.2.4/lib/rails/generators/named_base.rb:25:intemplate'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/administrate-0.1.4/lib/generators/administrate/dashboard/dashboard_generator.rb:30:in create_dashboard_definition' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/command.rb:27:inrun'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/invocation.rb:133:inblock in invoke_all'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/invocation.rb:133:in each' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/invocation.rb:133:inmap'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/invocation.rb:133:in invoke_all' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/group.rb:232:indispatch'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/thor-0.19.1/lib/thor/base.rb:440:in start' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/railties-4.2.4/lib/rails/generators.rb:157:ininvoke'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/administrate-0.1.4/lib/administrate/generator_helpers.rb:4:in call_generator' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/administrate-0.1.4/lib/generators/administrate/install/install_generator.rb:27:inblock in run_dashboard_generators'
from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/administrate-0.1.4/lib/generators/administrate/install/install_generator.rb:26:in each' from /Users/bebe/.rvm/gems/ruby-2.2.3@administrate/gems/administrate-0.1.4/lib/generators/administrate/install/install_generator.rb:26:inrun_dashboard_generators'

Most helpful comment

502

I opened this issue 4 days ago. Long story short, it seems to occur when you try to install it but don't have models.

All 7 comments

502

I opened this issue 4 days ago. Long story short, it seems to occur when you try to install it but don't have models.

Thank you @coisnepe

I just got this one as well! Came here looking for a possible contribution and this guy nailed!

I already created some models but it still throws an error block in class_name': undefined methodcamelize' for nil:NilClass (NoMethodError)

I think I got it, I just deleted the

namespace :admin do
root to: "#index"
end

that was generated earlier, after that, it works!

this is another fix i think related. it tries not touch rotues.rb at all. when not valid resources are found. #649

Closing as this should be fixed with #713. Please open an issue if that's not the case!

Was this page helpful?
0 / 5 - 0 ratings