This project is archived and is in readonly mode.

#1343 ✓stale
ru_rails

plugins and attributes_with_quotes on update

Reported by ru_rails | November 7th, 2008 @ 03:53 PM | in 3.x

How I find it (on example with globalize and better_nested_set plugins):

On using these 2 plugins, update on translation is wrong (it updates "base language" with wrong value), and be sure, this bug not only globalize relative :)

Both of these plugins handle update actions, and some stuff for it, like "attributes_with_quotes", and both of them not want to write some fields with some conditions. What I have now - globalize override the attributes_with_quotes to remove "translatable" fields, if language not "base", and store there fields on own table. In the same time better_nested_set want to remove own fields (left and right borders), to check them and update later if necessary. Both plugins have a copy of base attributes_with_quotes, with own conditions, and I lose some changes on attributes, will get only last changes with attributes, like - only nested_set attributes will be deleted, so globalize attributes will be wrong.

I fixed this with changes in plugins, but think that this is little wrong, because any other plugins will have same story if they use attributes_with_quotes method to make changes in attributes (maybe exists some pretty way to do this, but like we see - 2 popolar plugins use "bad" way to make theirs things).

I suggest small changes in ActiveRecord::base.update (2489 line here) -

def update(attribute_names = @attributes.keys) quoted_attributes = attributes_with_quotes(false, false, attribute_names) ....

to make something like here (just a quickly idea) -

def update(attribute_names = @attributes.keys) attribs = attributes_to_update quoted_attributes = quote_hash_values(attribs) ....

this will allow to other plugins handle attributes_to_update action, and make its own things with copy of attributes. We should get attributes that was changed with all plugins that want some changes, not only last plugin's, like we see now.

Comments and changes to this ticket

  • Pratik

    Pratik March 12th, 2009 @ 03:59 PM

    • State changed from “new” to “incomplete”

    Patch please!

  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • rails

    rails May 4th, 2011 @ 01:00 AM

    • State changed from “incomplete” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails May 4th, 2011 @ 01:00 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Tags

Pages