Rails isolated engine model associations -


i have engine namespace 'shop'. great except if don't add class_name: 'shop::myassociatedmodel' in association declarations errors. example product has many product_images if product model looks ok:

module shop   class product < activerecord::base     has_many :product_images, :class_name => 'shop::productimage'   end end 

in case don't use class_name error:

uninitialized constant productimage  

on line:

@products.in_groups_of(3) |products|   ... 

this engine.rb file:

module shop   class engine < rails::engine     isolate_namespace shop     ...   end end 

the engine created rails generator on rails v 3.1.something , upgraded rails 3.2.5

based on rails guides - engines section in link, if don't add namespace, class in parent application's models, not want.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -