small medium large xlarge

Generic-user-small
06 Oct 2009, 12:19
Mitchell Gould (2 posts)

In chapter 13 they mention using the fourth normal form to create a table for summaries in many languages. I have followed this for my Rails project but am stuck.

I have two models.

One is called Manufacturer. One is called Description.

Manufacturer has_many :descriptions

Description belongs_to :manufacturer

The database is set up so that the descriptions contain the foreign key of the manufacturers.

In the manufacturers model I have the following method to look up all of the manufacturers for the given locale.

def self.find_all find(:all, :order => “name”, :conditions => {:locale => I18n.locale}) end

This produces the following error

Mysql::Error: Unknown ‘manufacturers.locale’ in ‘where clause’: SELECT * FROM ‘manufacturers’ where (‘manufacturers’.’locale’ = ‘en’)

how can I fix the sql statement in Rails?

Thank you in advance

You must be logged in to comment