Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with replacing source and destination table names with aliases. #2

Open
foresth opened this issue Apr 6, 2011 · 0 comments

Comments

@foresth
Copy link

foresth commented Apr 6, 2011

Hello,
I tried implement acts_as_archive with pgsql and I found a possible problem in mover:

In lines 130 and 131 in mover.rb you gsub table names in conditions string with 't' and 'f', but if the tables are named e.g. articles and archived_articles, you'll get 'archived_t' instead of 'f'. This could be solved with look behind regex, unfortunately it's not supported until ruby 1.9.

I used these gsub blocks to get the correct result... not sure if they are entirely correct or well written:

conditions.gsub!(/([\s`"])(#{to[:table]})/) { "#{$1}t" }
conditions.gsub!(/([\s`"])(#{from[:table]})/) { "#{$1}f" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant