browsermedia / browsercms

BrowserCMS: Humane Content Management for Rails
http://browsercms.org
GNU Lesser General Public License v3.0
1.17k stars 260 forks source link

uninitialized constant HtmlBlock (NameError) #529

Closed SakthivelS closed 10 years ago

SakthivelS commented 12 years ago

While performing bcms install, generate cms:template rake gives the error uninitialized constant HtmlBlock (NameError).

Trace:

/home//.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:122:in `block in constantize': uninitialized constant HtmlBlock (NameError)

In Active Support, Inflator module when RAILS_CACHE is encountered, raise this error. Thanks in advance.

peakpg commented 12 years ago

Which version of BrowserCMS and Rails are you working with here? I see a reference to ActiveSupport 3.1 in your error message, and the latest version of BrowserCMS (3.5.0) should be updated to use Rails 3.2.x or later.

SakthivelS commented 12 years ago

Hi peakpg, I'm using rails-3.1.0 and browsercms-3.4.2 and my Gemfile.lock has following dependencies for browsercms browsercms (3.4.2) ancestry (~> 1.2.4) ckeditor_rails (~> 3.6.2.2) jquery-rails (~> 1.0.14) rails (~> 3.1.0) term-ansicolor As I'm using rails 3.1, browsercms version 3.4.2 is compatible I think. The expanded trace may help you identify the issue. /home/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:122:in block in constantize': uninitialized constant HtmlBlock (NameError) from /home/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:121:ineach' from /home/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/inflector/methods.rb:121:in constantize' from /home/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/core_ext/string/inflections.rb:43:inconstantize' from /home/.rvm/gems/ruby-1.9.2-p290/gems/browsercms-3.4.2/lib/cms/route_extensions.rb:14:in rescue in content_blocks' from /home/.rvm/gems/ruby-1.9.2-p290/gems/browsercms-3.4.2/lib/cms/route_extensions.rb:11:incontent_blocks' from /home/.rvm/gems/ruby-1.9.2-p290/gems/browsercms-3.4.2/config/routes.rb:66:in block in <top (required)>' from /home/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:434:ininstance_exec' from /home/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:434:in block in with_default_scope' from /home/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:630:inscope' from /home/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/mapper.rb:433:in with_default_scope' from /home/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:255:ineval_block' from /home/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/routing/route_set.rb:234:in draw' from /home/.rvm/gems/ruby-1.9.2-p290/gems/browsercms-3.4.2/config/routes.rb:4:in<top (required)>'

peakpg commented 12 years ago

I'm not able to duplicate this error when I do the following:

  1. Create a Rails 3.1 application (rails new testapp)
  2. Add ActiveAdmin (to match your dependencies)
  3. Install browsercms into that application (bcms install)

Just to verify, did you just add BrowserCMS to this project for the first time? Or were you upgrading from a previous version?

In reviewing #528, if I understand what may have happened, the bug with also_migrate may have prevented the migrations from being written out to your project. Verify that you have the following files in your project,

You may need to temporarily disable the also_migrate so the rake migrations installation works.

SakthivelS commented 12 years ago

This is the first time I'm adding BrowserCMS to my application. Initially I have my project in rails 3.0.9, to add browsercms I have upgraded my application to rails 3.1.0 and then installed browsercms.

And regarding migration files, after I made changes with also_migrate gem, migrations passed and I have all the five migration files in respective folder.

peakpg commented 12 years ago

Generating the template file is the last step in the installation. Assuming you still get the error when you run it manually like:

$ rails g cms:template default

I might next suggest:

  1. Removing all the generated BrowserCMS files
  2. Rerun the bcms install command.

I'm still working on the theory that one of the earlier installation steps didn't complete cleanly, so the CMS generators won't run.

peakpg commented 10 years ago

Closing as I assume this either worked or isn't relevant anymore.

mimmovele commented 10 years ago

Hi, I'm trying to add browsercms to an existing 3.2.13 rails app. After having added browsercms to my gemfile and successfully executed bundle install, I'm not able to complete the bcms install command due to the uninitialized constant HtmlBlock (NameError) error. I've then reverted the app code, added again the browsercms gem to my Gemfile, successfully executed the bundle install command, and just tried to start the rails console rails c. Got the same error uninitialized constant HtmlBlock (NameError):

.../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in `block in constantize': uninitialized constant HtmlBlock (NameError)
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in `each'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in `constantize'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/browsercms-3.5.7/lib/cms/route_extensions.rb:13:in `rescue in content_blocks'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/browsercms-3.5.7/lib/cms/route_extensions.rb:10:in `content_blocks'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/browsercms-3.5.7/config/routes.rb:66:in `block in <top (required)>'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:420:in `instance_exec'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:420:in `block in with_default_scope'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:618:in `scope'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:419:in `with_default_scope'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:287:in `eval_block'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in `draw'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/browsercms-3.5.7/config/routes.rb:4:in `<top (required)>'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/bundler/gems/rails-dev-boost-3e25b06c5c53/lib/rails_development_boost/loadable_patch.rb:14:in `load'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `each'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application.rb:108:in `reload_routes!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/bundler/gems/active_admin-37adda1d1491/lib/active_admin/reloader.rb:34:in `reload!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/bundler/gems/active_admin-37adda1d1491/lib/active_admin/reloader.rb:61:in `block in attach!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:429:in `_run__1665489279689352385__prepare__1124784796608961793__callbacks'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from  .../RubymineProjects/mater/config/environment.rb:196:in `<top (required)>'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
    from  .../.rvm/gems/ruby-1.9.3-p374@mater/gems/railties-3.2.13/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

This is my Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.2.13'

gem 'mysql2'

group :assets do
  gem 'coffee-rails', "~> 3.2.2"
  gem 'uglifier'
  gem 'yui-compressor', :github => 'sstephenson/ruby-yui-compressor'  # Using the master branch till issue "undefined method `exitstatus' for nil:NilClass" is resolved
end

gem 'activeadmin', '~> 0.6.0', github: 'gregbell/active_admin'
gem 'sass-rails'
gem 'meta_search'

gem 'rails3-jquery-autocomplete'

group :production, :staging do
  gem 'therubyracer'
  gem "daemons", "~> 1.1.8"
end

gem 'yajl-ruby'
gem 'typhoeus', '0.4.2'

gem 'routing-filter', '0.3.1'
gem 'i18n_routing'

gem 'authlogic'
gem 'rails3-generators'

gem 'exception_notification', '~> 3.0.1', :git => "git://github.com/smartinez87/exception_notification.git", :require => 'exception_notifier'

gem 'i18n-js', :github => 'fnando/i18n-js'

gem "delayed_job", '3.0.5'
gem 'delayed_job_active_record', '0.3.2'

gem "rmagick", :require => "RMagick"

gem 'rest-client'

gem 'version'

gem 'bitly'

gem 'gibbon', "~> 0.3.5"

gem 'geoip'

group :test, :development, :darwin do
  gem 'factory_girl'

  gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git'

  gem 'turn', :require => false

  gem "guard-less", :git => "git://github.com/dwt/guard-less.git"
  gem 'guard-rails-assets', :git => "git://github.com/andiug/guard-rails-assets.git"
  gem 'guard-livereload', require: false
  gem 'rack-livereload'

  gem 'rails-dev-tweaks'
  gem "bundle_outdated"

  gem 'thin'
end

gem 'less-rails'
gem 'therubyracer'

gem 'sitemap_generator', "~> 3.4"

gem 'activemerchant'

gem 'aasm', '~> 3.0.18'

gem 'newrelic_rpm'

gem "premailer", :git => "git://github.com/king724/premailer.git"
gem 'hpricot'

gem 'whenever', "~> 0.8.2", :require => false

gem 'gibberish'

gem 'mixpanel', '~> 4.0.0'

gem 'snogmetrics'

gem 'multi_db'

gem "strip_attributes", "~> 1.0"

gem 'dkim'

gem 'countries'

gem 'localized_country_select', '>= 0.9.2'

gem 'mailjet'

gem 'tumblr_client'

gem 'valvat'

gem 'browsercms', '3.5.7'

and this is the resulting Gemfile.lock:

GIT
  remote: git://github.com/smartinez87/exception_notification.git
  revision: 11d61df3cb435381929757b8d7e47209b5ab2b14
  specs:
    exception_notification (3.0.1)
      actionmailer (>= 3.0.4)
      activesupport (>= 3.0.4)

GIT
  remote: git://github.com/thedarkone/rails-dev-boost.git
  revision: 5d4d34aeff928c45dda4be40623411ed5acb18c2
  specs:
    rails-dev-boost (0.2.1)
      listen (>= 0.5)
      railties (>= 3.0)

GEM
  remote: http://rubygems.org/
  specs:
    POpen4 (0.1.4)
      Platform (>= 0.4.0)
      open4
    Platform (0.4.0)
    actionmailer (3.2.13)
      actionpack (= 3.2.13)
      mail (~> 2.5.3)
    actionpack (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
    activerecord (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
    activesupport (3.2.13)
      i18n (= 0.6.1)
      multi_json (~> 1.0)
    ancestry (1.2.5)
      activerecord (>= 2.2.2)
    arel (3.0.2)
    browsercms (3.5.7)
      ancestry (~> 1.2.4)
      ckeditor_rails (~> 3.6.4)
      jquery-rails (~> 2.0)
      paperclip (~> 3.0.3)
      rails (>= 3.2.5, < 3.3.0)
      sass-rails (~> 3.2.6)
      term-ansicolor
    builder (3.0.4)
    bullet (4.6.0)
      uniform_notifier
    ckeditor_rails (3.6.4.1)
      railties (~> 3.0)
      thor (~> 0.14)
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.3)
      climate_control (>= 0.0.3, < 1.0)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.3.3)
    commonjs (0.2.6)
    daemons (1.1.9)
    diff-lcs (1.1.3)
    erubis (2.7.0)
    eventmachine (1.0.3)
    execjs (1.4.0)
      multi_json (~> 1.0)
    factory_girl (2.6.4)
      activesupport (>= 2.3.9)
    ffi (1.0.11)
    hike (1.2.2)
    i18n (0.6.1)
    journey (1.0.4)
    jquery-rails (2.0.2)
      railties (>= 3.2.0, < 5.0)
      thor (~> 0.14)
    jquery-ui-rails (1.0.0)
      jquery-rails
      railties (>= 3.1.0)
    json (1.7.7)
    less (2.2.1)
      commonjs (~> 0.2.6)
    less-rails (2.2.3)
      actionpack (>= 3.1)
      less (~> 2.2.0)
    libv8 (3.3.10.4)
    listen (1.2.2)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
      rb-kqueue (>= 0.2)
    mail (2.5.3)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.23)
    multi_db (0.3.1)
      activerecord (>= 2.1.0)
      tlattr_accessors (>= 0.0.3)
    multi_json (1.7.2)
    mysql2 (0.3.11)
    open4 (1.3.0)
    paperclip (3.0.4)
      activemodel (>= 3.0.0)
      activerecord (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (>= 0.0.2)
      mime-types
    polyglot (0.3.3)
    prototype-rails (3.2.1)
      rails (~> 3.2)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.13)
      actionmailer (= 3.2.13)
      actionpack (= 3.2.13)
      activerecord (= 3.2.13)
      activeresource (= 3.2.13)
      activesupport (= 3.2.13)
      bundler (~> 1.0)
      railties (= 3.2.13)
    rails-dev-tweaks (0.6.1)
      actionpack (~> 3.1)
      railties (~> 3.1)
    railties (3.2.13)
      actionpack (= 3.2.13)
      activesupport (= 3.2.13)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.0.4)
    rb-fsevent (0.9.3)
    rb-inotify (0.9.0)
      ffi (>= 0.5.0)
    rb-kqueue (0.2.0)
      ffi (>= 0.5.0)
    rdiscount (1.6.8)
    rdoc (3.12.2)
      json (~> 1.4)
    rspec (2.9.0)
      rspec-core (~> 2.9.0)
      rspec-expectations (~> 2.9.0)
      rspec-mocks (~> 2.9.0)
    rspec-core (2.9.0)
    rspec-expectations (2.9.0)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.9.0)
    rspec-rails (2.9.0)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.9.0)
    sass (3.2.14)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    term-ansicolor (1.2.2)
      tins (~> 0.8)
    therubyracer (0.10.1)
      libv8 (~> 3.3.10)
    thin (1.5.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.18.1)
    tilt (1.4.0)
    tins (0.13.2)
    tlattr_accessors (0.0.3)
    treetop (1.4.12)
      polyglot
      polyglot (>= 0.3.1)
    twitter-bootstrap-rails (2.1.0)
      actionpack (>= 3.1)
      less-rails (~> 2.2.2)
      railties (>= 3.1)
      therubyracer (~> 0.10.1)
    typhoeus (0.4.2)
      ffi (~> 1.0)
      mime-types (~> 1.18)
    tzinfo (0.3.37)
    uglifier (1.2.4)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)
    uniform_notifier (1.2.0)
    yajl-ruby (1.1.0)
    yui-compressor (0.9.6)
      POpen4 (>= 0.1.4)

PLATFORMS
  ruby

DEPENDENCIES
  browsercms (= 3.5.7)
  bullet (= 4.6.0)
  coffee-rails (~> 3.2.2)
  exception_notification (~> 3.0.1)!
  factory_girl
  jquery-rails
  jquery-ui-rails
  multi_db
  mysql2
  prototype-rails
  rails (= 3.2.13)
  rails-dev-boost!
  rails-dev-tweaks
  rdiscount (~> 1.6.8)
  rspec-rails (~> 2.6)
  thin
  twitter-bootstrap-rails
  typhoeus (= 0.4.2)
  uglifier
  yajl-ruby
  yui-compressor

These are a lots of gems, I admit, but any help would be greatly appreciated :)

mimmovele commented 10 years ago

Removing gem 'version' from the Gemfile fixed the issue. Fine :)