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

Add table_name_prefix support #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion db/migrate/004_convert_next_issues_to_stuff_to_dos.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/stuff_to_do_issue_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
{
Expand Down
2 changes: 1 addition & 1 deletion lib/stuff_to_do_user_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down