Problems with activerecord associations between tables

Hi all,
i’m developing an application with 40 tables that they have relations
between them, in my
products_list when i render the results in my view everything worked
fine but from one day i i get an error:
NoMethodError in Admin/product#products_list

Showing app/views/admin/product/products_list.rhtml where line #35
raised:

undefined method `re_products_type’ for #<ReproductsSubtype:
0xb731b624>

Extracted source (around line #35):

32: <% for item in @products %>
33:


34: <%= item.id %>
35: <%= item.re_products_subtype.re_products_type.type_name
%></
td>

is strange because never happened since a month that i have started
working on this application but if i restart apache everything is ok
but after 5 minutes i get the same error again. I’m the only developer
that work on this…this thing is driving me crazy.
Any solutions or ideas please?
thanks in advance and sorry about my english!

On 29 Nov 2007, at 19:18, netbomb wrote:

Hi all,
i’m developing an application with 40 tables that they have relations
between them, in my
products_list when i render the results in my view everything worked
fine but from one day i i get an error:
NoMethodError in Admin/product#products_list

Does this only happen in development mode?

Fred

Iam facing the same problem only in the development mode.
If you find the re_products_subtype directly instead of getting it from
item it may work.

netbomb wrote:

Hi all,

32: <% for item in @products %>
33:


34: <%= item.id %>
35: <%= item.re_products_subtype.re_products_type.type_name
%></
td>

is strange because never happened since a month that i have started
working on this application but if i restart apache everything is ok
but after 5 minutes i get the same error again. I’m the only developer
that work on this…this thing is driving me crazy.
Any solutions or ideas please?
thanks in advance and sorry about my english!

Show us app/models/re_products_subtype.rb and
app/models/re_products_type.rb

On 30 Nov 2007, at 08:34, netbomb wrote:

Yes i’m in development mode, i figured out doing as showen below>

I’ve seen some funkiness due to the autoloading stuff. major culprits
include using require to require things that could be autoloaded

Fred

Yes i’m in development mode, i figured out doing as showen below>

ReProductsType.find_by_id(item.re_products_subtype.re_products_type_id).type_name
but i prefer as before…

My models:
class ReProductsSubtype < ActiveRecord::Base
belongs_to :re_products_type
end

class ReProductsType < ActiveRecord::Base
has_one :re_products_subtype
end

I can do an explicit sql query to have better performace, but i would
like to understand whyt this happen!
Thanks to all

On 30 Nov, 05:03, Ayyanar Aswathaman <rails-mailing-l…@andreas-