botvector.net domain for sale $2k usd (negotiable). Em@il me t0: alex DOT creopolis at gmail DOT com

My Git activity

13 May 2008

Globalize in Rails 2.0 BUG

Using Globalize is great, however if you planning / using Globalize (ModelTranslation) in application with Rails 2.0 you may impair this problem:
Argument error "wrong number of arguments (2 for 1)
while you updating your model data, like @order.update_attributes(params[:order])

All what you need to do is go to /vendor/plugins/globalize/lib/globalize/localization directory, open db_translate.rb file, goto line ~675 (of find def attributes_with_quotes method)
and replace whole def with that:


def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true)
if Locale.base?
quoted = attributes.inject({}) do |quoted, (name, value)|
if column = column_for_attribute(name)
quoted[name] = quote_value(value, column) unless !include_primary_key && column.primary
end
quoted
end
else
quoted = attributes.inject({}) do |quoted, (name, value)|
if !self.class.globalize_facets_hash.has_key?(name) &&
column = column_for_attribute(name)
quoted[name] = quote_value(value, column) unless !include_primary_key && column.primary
end
quoted
end
end
include_readonly_attributes ? quoted : remove_readonly_attributes(quoted)
end


Original fix by artemv

5 comments:

jim7 said...

thank you!!

Alexey said...

i glad that its helps :)

Anonymous said...

thanks a lot -- you saved my sunday :-)

savitha said...

Using rails development how to localize or globalize models field names, table names, and error messages.

Alexey said...

Do you asking ?