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

My Git activity

Showing posts with label globalize. Show all posts
Showing posts with label globalize. Show all posts

27 May 2009

Update: 2.0.x to 2.3.2

Updating to 2.3.2 to get nice features ?
Thanks to all Rails Core team,

Now my own experience upgrating from 2.1.2 to 2.3.2:

Lets begin:
1/
READ THIS !!! MUST !!

2/
To update has_many_polymorphs go to here.

3/
To update output_compression plugin (output_compression.rb):
replace ActionController to Rack
replace class AbstractRequest to ActionController::Request

4/
To patch Globalize:
in vendor/pligins/globalize/lib/globalize/rails/action_view.rb
update:
alias_method :globalize_old_render_file, :render_file
to
alias_method :globalize_old_render_file, :render
AND
in /pligins/globalize/lib/globalize/localization/db_translate.rb
add :having key to options array
VALID_FIND_OPTIONS = ...
line 794 approximately.

x/
RUN:
rake rails:update

x/
Replace all render_file => "foo" to render :file => "foo" if any.

x/
Instead of config.action_controller.session = { :session_key => 'foo', ... use config.action_controller.session = { :key => 'foo', ....

x/
Use:
class ActionController::Request
instead of:
ActionController::AbstractRequest

and ruby script/server !
if anything ok, run your tests ..

Useful:
Rack module

Let me know if you encounter more "bugs" while patching to 2.3.2 ..

13 August 2008

acts_as_taggable_on_steroids + Globalize

Okay, situation is:

Parties involved: Rails 2.0.2, Globalize plugin, acts_as_taggable_on_steroids, ME.
(clickables) :)

Having model Event that translates :name, :body, :description with Globalize plugin.
Also Event are acts_as_taggable with acts_at_taggable_on_steroids ...

Ok for now, model works well, translated well, adding/removing/editing tags as well !

The problem is raise when we trying to @tags = Event.tag_cloud
we got :select option not allowed on translatable models (DISTINCT * FROM events .... !! THAT IS BADD !!!

Solution:
Open /ventor/plugin/acts_as_tabbable_on_steroids/lib/acts_as_taggable.rb
FIND:


LINE: 66
def find_tagged_with(*args)
options = find_options_for_find_tagged_with(*args)
options.blank? ? [] : find(:all, options)
end

CHANGE TO:

def find_tagged_with(*args)
options = find_options_for_find_tagged_with(*args)
options.blank? ? [] : untranslated_find(:all, options)
end


Restart server and you're done !

p.s. More info about great acts_as_taggable_on_steroid plugin is here.

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