summaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-12-20 07:10:46 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2013-12-20 07:10:46 +0000
commit9b5ce4b7b44beadc00c80f1e8ab24b6e487a462b (patch)
tree097664e27da31cf860571ce225c644f7b9c8121b /db/migrate
parent5c5ba0c61af44bdbd8931c131192963179cca9ac (diff)
downloadredmine-9b5ce4b7b44beadc00c80f1e8ab24b6e487a462b.tar.gz
redmine-9b5ce4b7b44beadc00c80f1e8ab24b6e487a462b.zip
Rails4: db migrate: replace "Permission.find_by_controller_and_action"
git-svn-id: http://svn.redmine.org/redmine/trunk@12422 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/018_set_doc_and_files_notifications.rb16
-rw-r--r--db/migrate/025_add_search_permission.rb2
-rw-r--r--db/migrate/030_add_projects_feeds_permissions.rb2
-rw-r--r--db/migrate/033_add_timelog_permissions.rb2
-rw-r--r--db/migrate/043_add_relations_permissions.rb4
-rw-r--r--db/migrate/047_add_boards_permissions.rb6
-rw-r--r--db/migrate/049_add_wiki_destroy_page_permission.rb2
-rw-r--r--db/migrate/050_add_wiki_attachments_permissions.rb4
-rw-r--r--db/migrate/056_add_repositories_changes_permission.rb2
9 files changed, 20 insertions, 20 deletions
diff --git a/db/migrate/018_set_doc_and_files_notifications.rb b/db/migrate/018_set_doc_and_files_notifications.rb
index 8c1d054c1..f260bebc6 100644
--- a/db/migrate/018_set_doc_and_files_notifications.rb
+++ b/db/migrate/018_set_doc_and_files_notifications.rb
@@ -3,16 +3,16 @@ class SetDocAndFilesNotifications < ActiveRecord::Migration
class Permission < ActiveRecord::Base; end
def self.up
- Permission.find_by_controller_and_action("projects", "add_file").update_attribute(:mail_option, true)
- Permission.find_by_controller_and_action("projects", "add_document").update_attribute(:mail_option, true)
- Permission.find_by_controller_and_action("documents", "add_attachment").update_attribute(:mail_option, true)
- Permission.find_by_controller_and_action("issues", "add_attachment").update_attribute(:mail_option, true)
+ Permission.where(:controller => "projects", :action => "add_file").each {|p| p.update_attribute(:mail_option, true)}
+ Permission.where(:controller => "projects", :action => "add_document").each {|p| p.update_attribute(:mail_option, true)}
+ Permission.where(:controller => "documents", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, true)}
+ Permission.where(:controller => "issues", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, true)}
end
def self.down
- Permission.find_by_controller_and_action("projects", "add_file").update_attribute(:mail_option, false)
- Permission.find_by_controller_and_action("projects", "add_document").update_attribute(:mail_option, false)
- Permission.find_by_controller_and_action("documents", "add_attachment").update_attribute(:mail_option, false)
- Permission.find_by_controller_and_action("issues", "add_attachment").update_attribute(:mail_option, false)
+ Permission.where(:controller => "projects", :action => "add_file").each {|p| p.update_attribute(:mail_option, false)}
+ Permission.where(:controller => "projects", :action => "add_document").each {|p| p.update_attribute(:mail_option, false)}
+ Permission.where(:controller => "documents", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, false)}
+ Permission.where(:controller => "issues", :action => "add_attachment").each {|p| p.update_attribute(:mail_option, false)}
end
end
diff --git a/db/migrate/025_add_search_permission.rb b/db/migrate/025_add_search_permission.rb
index a942b01b3..7f1c5c6fc 100644
--- a/db/migrate/025_add_search_permission.rb
+++ b/db/migrate/025_add_search_permission.rb
@@ -7,6 +7,6 @@ class AddSearchPermission < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action('projects', 'search').destroy
+ Permission.where(:controller => "projects", :action => "search").each {|p| p.destroy}
end
end
diff --git a/db/migrate/030_add_projects_feeds_permissions.rb b/db/migrate/030_add_projects_feeds_permissions.rb
index 7f97035bf..866cc39ae 100644
--- a/db/migrate/030_add_projects_feeds_permissions.rb
+++ b/db/migrate/030_add_projects_feeds_permissions.rb
@@ -7,6 +7,6 @@ class AddProjectsFeedsPermissions < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action('projects', 'feeds').destroy
+ Permission.where(:controller => "projects", :action => "feeds").each {|p| p.destroy}
end
end
diff --git a/db/migrate/033_add_timelog_permissions.rb b/db/migrate/033_add_timelog_permissions.rb
index ab9c809e6..58e2c436a 100644
--- a/db/migrate/033_add_timelog_permissions.rb
+++ b/db/migrate/033_add_timelog_permissions.rb
@@ -7,6 +7,6 @@ class AddTimelogPermissions < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action('timelog', 'edit').destroy
+ Permission.where(:controller => "timelog", :action => "edit").each {|p| p.destroy}
end
end
diff --git a/db/migrate/043_add_relations_permissions.rb b/db/migrate/043_add_relations_permissions.rb
index 32d464a58..3c86d7e60 100644
--- a/db/migrate/043_add_relations_permissions.rb
+++ b/db/migrate/043_add_relations_permissions.rb
@@ -8,7 +8,7 @@ class AddRelationsPermissions < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action("issue_relations", "new").destroy
- Permission.find_by_controller_and_action("issue_relations", "destroy").destroy
+ Permission.where(:controller => "issue_relations", :action => "new").each {|p| p.destroy}
+ Permission.where(:controller => "issue_relations", :action => "destroy").each {|p| p.destroy}
end
end
diff --git a/db/migrate/047_add_boards_permissions.rb b/db/migrate/047_add_boards_permissions.rb
index 5b1f6f779..1a9f095f7 100644
--- a/db/migrate/047_add_boards_permissions.rb
+++ b/db/migrate/047_add_boards_permissions.rb
@@ -9,8 +9,8 @@ class AddBoardsPermissions < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action("boards", "new").destroy
- Permission.find_by_controller_and_action("boards", "edit").destroy
- Permission.find_by_controller_and_action("boards", "destroy").destroy
+ Permission.where(:controller => "boards", :action => "new").each {|p| p.destroy}
+ Permission.where(:controller => "boards", :action => "edit").each {|p| p.destroy}
+ Permission.where(:controller => "boards", :action => "destroy").each {|p| p.destroy}
end
end
diff --git a/db/migrate/049_add_wiki_destroy_page_permission.rb b/db/migrate/049_add_wiki_destroy_page_permission.rb
index c82152388..803d357a1 100644
--- a/db/migrate/049_add_wiki_destroy_page_permission.rb
+++ b/db/migrate/049_add_wiki_destroy_page_permission.rb
@@ -7,6 +7,6 @@ class AddWikiDestroyPagePermission < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action('wiki', 'destroy').destroy
+ Permission.where(:controller => "wiki", :action => "destroy").each {|p| p.destroy}
end
end
diff --git a/db/migrate/050_add_wiki_attachments_permissions.rb b/db/migrate/050_add_wiki_attachments_permissions.rb
index c0697be9c..e87a46bb3 100644
--- a/db/migrate/050_add_wiki_attachments_permissions.rb
+++ b/db/migrate/050_add_wiki_attachments_permissions.rb
@@ -8,7 +8,7 @@ class AddWikiAttachmentsPermissions < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action('wiki', 'add_attachment').destroy
- Permission.find_by_controller_and_action('wiki', 'destroy_attachment').destroy
+ Permission.where(:controller => "wiki", :action => "add_attachment").each {|p| p.destroy}
+ Permission.where(:controller => "wiki", :action => "destroy_attachment").each {|p| p.destroy}
end
end
diff --git a/db/migrate/056_add_repositories_changes_permission.rb b/db/migrate/056_add_repositories_changes_permission.rb
index 0d9b13b59..00252db43 100644
--- a/db/migrate/056_add_repositories_changes_permission.rb
+++ b/db/migrate/056_add_repositories_changes_permission.rb
@@ -7,6 +7,6 @@ class AddRepositoriesChangesPermission < ActiveRecord::Migration
end
def self.down
- Permission.find_by_controller_and_action('repositories', 'changes').destroy
+ Permission.where(:controller => "repositories", :action => "changes").each {|p| p.destroy}
end
end