-
Notifications
You must be signed in to change notification settings - Fork 235
Troubleshooting
whacao edited this page Dec 8, 2011
·
16 revisions
I get the error: ‘uninitialized constant ShoppingCartCell’ when accessing a page with render_cell
call.
Ensure you have put ‘cells’ under ‘app’ directory, and ‘first_cell.rb’ in: ‘/app/cells’
Include the UrlFor
module into your cell.
class ShoppingCartCell < Cell::Base
include ActionController::UrlFor
Using the *_url
helpers implies accessing the request
instance, which kinda breaks encapsulation. Cells doesn’t support breaking things, that’s why you have to include it manually.
Ensure you are running Rails version 2.2 by checking the line in environment.rb containing: "RAILS_GEM_VERSION = "
Mongrel dies on startup with the error: “/Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in `load_missing_constant’: uninitialized constant Dependencies (NameError)”
cd vendor/plugins
git clone git://github.com/apotonick/cells.git
Mongrel dies on startup with the error: “/vendor/plugins/cells/init.rb:42:in `evaluate_init_rb’: undefined method `engines_available?’ for Cell:Module (NoMethodError)”
- In environment.rb, ensure the line: “require File.join(File.dirname(FILE), ‘../vendor/plugins/cells/boot’)” is ABOVE the Rails::Initializer line.
Add this to an initializer:
Cell::Base.prepend_view_path("/Path/to/whatever")
Add this to your autotest/discover.rb file
Autotest.add_hook :initialize do |at| at.add_mapping %r%^app/cells/(.*)\.rb$% do |_, m| "test/cells/#{m[1]}_test.rb" end at.add_mapping %r%^test/cells/(.*)_test\.rb$% do |filename, _| filename end end
Use `include` with the following additional steps:
include ActionView::Helpers::AssetTagHelper
def star
image_tag("star-#{@rating}.png", alt:"#{@rating}-Star")
end
def controller
parent_controller
end
helper_method :star