From 535c40bacbe241efbf94dcd5cdf969d930bc5d5c Mon Sep 17 00:00:00 2001 From: Paul Eipper Date: Fri, 4 Feb 2011 19:21:17 -0200 Subject: [PATCH] Add table_name_prefix support --- db/migrate/004_convert_next_issues_to_stuff_to_dos.rb | 4 +++- lib/stuff_to_do_issue_patch.rb | 2 +- lib/stuff_to_do_user_patch.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/db/migrate/004_convert_next_issues_to_stuff_to_dos.rb b/db/migrate/004_convert_next_issues_to_stuff_to_dos.rb index fae457a2..d0510de8 100644 --- a/db/migrate/004_convert_next_issues_to_stuff_to_dos.rb +++ b/db/migrate/004_convert_next_issues_to_stuff_to_dos.rb @@ -1,6 +1,8 @@ # Compatibiliy class used by migrations class NextIssue < ActiveRecord::Base - set_table_name 'next_issues' + set_table_name do + "#{table_name_prefix}next_issues" + end end class ConvertNextIssuesToStuffToDos < ActiveRecord::Migration diff --git a/lib/stuff_to_do_issue_patch.rb b/lib/stuff_to_do_issue_patch.rb index 4d48a389..eccfe429 100644 --- a/lib/stuff_to_do_issue_patch.rb +++ b/lib/stuff_to_do_issue_patch.rb @@ -11,7 +11,7 @@ def self.included(base) # :nodoc: after_save :update_next_issues has_many :stuff_to_dos, :as => :stuff - has_and_belongs_to_many :time_grid_users, :class_name => 'User', :join_table => 'time_grid_issues_users' + has_and_belongs_to_many :time_grid_users, :class_name => 'User', :join_table => "#{table_name_prefix}time_grid_issues_users" named_scope :with_time_entries_for_user, lambda {|user_id| { diff --git a/lib/stuff_to_do_user_patch.rb b/lib/stuff_to_do_user_patch.rb index 408ec8d9..b7103630 100644 --- a/lib/stuff_to_do_user_patch.rb +++ b/lib/stuff_to_do_user_patch.rb @@ -3,7 +3,7 @@ module StuffToDoUserPatch def self.included(base) # :nodoc: base.class_eval do unloadable - has_and_belongs_to_many :time_grid_issues, :class_name => 'Issue', :join_table => 'time_grid_issues_users' + has_and_belongs_to_many :time_grid_issues, :class_name => 'Issue', :join_table => "#{table_name_prefix}time_grid_issues_users" end end end