[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

uninitialized constant error

doolittle

7/2/2006 3:15:00 AM

Hello all, I have a few models:

class Collection < ActiveRecord::Base

has_many :collection_images
has_many :images, :through => :collection_images, :order => "id desc"

end


class CollectionImage < ActiveRecord::Base

belongs_to :image
belongs_to :collection

end



class Image < Resource

has_many :collection_images
has_many :collections, :through => :collection_images

end


.... which seems to be the typical "has_many through" situation. Now
where my error occurs is when I call something like this from the
controller:


@images = Image.find(:all, :limit => 15, :order => "resources.id
desc", :include => :collections)


and it bombs when the view calls:

<% @images.each_with_index do |i, j| %>


This is just one example of a few places I've found this (revolving
around the same models in different situations) error in a number of
places in my app after uploading to textdrive. What I'm confused of
most is if the problem is my code (since it worked for me in dev) or
the production enviroment.

Much thanks in advanced,
Paul

1 Answer

doolittle

7/2/2006 3:37:00 AM

0

Sorry, here are the error messages:

Message: uninitialized constant 'Image'

Trace:

/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:100:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in
`const_missing'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in
`const_missing'
/app/controllers/content_controller.rb:40:in `recent_images'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in
`perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
`perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
`process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:71:in
`process_with_components'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:137:in
`component_response'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:108:in
`render_component_as_string'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:169:in
`component_logging'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:107:in
`render_component_as_string'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:44:in
`render_component'
/app/views/layouts/content.rhtml:151:in `_run_rhtml_layouts_content'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:314:in
`compile_and_render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:290:in
`render_template'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/base.rb:249:in
`render_file'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/layout.rb:249:in
`render_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
`render'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:53:in
`render'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:911:in
`perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
`perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
`perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
`process_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
`process'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:150:in
`process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:54:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:600:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
`process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:in
`process!'
/users/home/openairstereo/web/public/dispatch.fcgi:24




doolittle@gmail.com wrote:
> Hello all, I have a few models:
>
> class Collection < ActiveRecord::Base
>
> has_many :collection_images
> has_many :images, :through => :collection_images, :order => "id desc"
>
> end
>
>
> class CollectionImage < ActiveRecord::Base
>
> belongs_to :image
> belongs_to :collection
>
> end
>
>
>
> class Image < Resource
>
> has_many :collection_images
> has_many :collections, :through => :collection_images
>
> end
>
>
> ... which seems to be the typical "has_many through" situation. Now
> where my error occurs is when I call something like this from the
> controller:
>
>
> @images = Image.find(:all, :limit => 15, :order => "resources.id
> desc", :include => :collections)
>
>
> and it bombs when the view calls:
>
> <% @images.each_with_index do |i, j| %>
>
>
> This is just one example of a few places I've found this (revolving
> around the same models in different situations) error in a number of
> places in my app after uploading to textdrive. What I'm confused of
> most is if the problem is my code (since it worked for me in dev) or
> the production enviroment.
>
> Much thanks in advanced,
> Paul