refinerycms 0.9.8.5 → 0.9.8.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +15 -21
- data/bin/refinerycms +9 -12
- data/changelog.md +164 -154
- data/db/migrate/20100913234704_create_refinery_schema.rb +151 -0
- data/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb +9 -0
- data/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb +11 -0
- data/db/schema.rb +5 -1
- data/db/seeds/pages.rb +0 -39
- data/db/seeds/pages_for_inquiries.rb +40 -0
- data/vendor/refinerycms/authentication/app/models/roles_users.rb +6 -0
- data/vendor/refinerycms/authentication/features/lost_password.feature +1 -0
- data/vendor/refinerycms/authentication/features/manage_users.feature +1 -1
- data/vendor/refinerycms/authentication/features/step_definitions/lost_password.rb +2 -2
- data/vendor/refinerycms/authentication/features/support/factories.rb +1 -0
- data/vendor/refinerycms/authentication/spec/models/user_spec.rb +52 -0
- data/vendor/refinerycms/core/app/views/admin/_head.html.erb +1 -4
- data/vendor/refinerycms/core/app/views/shared/_menu.html.erb +11 -5
- data/vendor/refinerycms/core/app/views/shared/_menu_branch.html.erb +8 -8
- data/vendor/refinerycms/core/app/views/shared/admin/_make_sortable.html.erb +3 -2
- data/vendor/refinerycms/core/app/views/shared/admin/_sortable_list.html.erb +2 -3
- data/vendor/refinerycms/core/lib/core.rb +5 -5
- data/vendor/refinerycms/core/lib/generators/refinery_engine/refinery_engine_generator.rb +2 -2
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/admin/plural_name/index.html.erb +11 -9
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/db/seeds/plural_name.rb +1 -1
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/lib/generators/refinerycms_plural_name_generator.rb +3 -3
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/lib/plural_name.rb +1 -1
- data/vendor/refinerycms/core/lib/refinery/crud.rb +48 -28
- data/vendor/refinerycms/core/lib/refinery/helpers/menu_helper.rb +34 -4
- data/vendor/refinerycms/core/lib/refinery/plugin.rb +5 -5
- data/vendor/refinerycms/core/public/javascripts/rails.js +152 -0
- data/vendor/refinerycms/core/public/javascripts/refinery/admin.js +33 -13
- data/vendor/refinerycms/core/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +191 -175
- data/vendor/refinerycms/core/public/stylesheets/refinery/refinery.css +80 -12
- data/vendor/refinerycms/dashboard/features/dashboard.feature +3 -1
- data/vendor/refinerycms/images/features/support/factories.rb +5 -0
- data/vendor/refinerycms/images/lib/images.rb +7 -35
- data/vendor/refinerycms/images/spec/models/image_spec.rb +50 -0
- data/vendor/refinerycms/images/spec/uploads/beach.jpeg +0 -0
- data/vendor/refinerycms/pages/features/manage_pages.feature +1 -1
- data/vendor/refinerycms/pages/features/step_definitions/page_steps.rb +19 -3
- data/vendor/refinerycms/pages/features/support/paths.rb +9 -1
- data/vendor/refinerycms/pages/features/visit_pages.feature +45 -0
- data/vendor/refinerycms/pages/spec/models/page_spec.rb +134 -4
- data/vendor/refinerycms/refinery.rb +1 -1
- data/vendor/refinerycms/resources/features/manage_files.feature +5 -1
- data/vendor/refinerycms/resources/features/step_definitions/file_steps.rb +2 -2
- data/vendor/refinerycms/resources/lib/resources.rb +8 -37
- data/vendor/refinerycms/resources/spec/models/resource_spec.rb +45 -0
- data/vendor/refinerycms/resources/spec/uploads/refinery_is_awesome.txt +1 -0
- data/vendor/refinerycms/settings/app/models/refinery_setting.rb +26 -12
- data/vendor/refinerycms/settings/features/manage_refinery_settings.feature +1 -1
- data/vendor/refinerycms/settings/spec/models/refinery_setting_spec.rb +101 -0
- metadata +37 -56
- data/db/migrate/20091109012126_add_missing_indexes.rb +0 -25
- data/db/migrate/20091130040711_add_down_for_maintenance_page.rb +0 -15
- data/db/migrate/20091207033335_add_superuser_to_users.rb +0 -12
- data/db/migrate/20100114092849_add_themes_table.rb +0 -19
- data/db/migrate/20100125003944_rename_title_to_name_on_user_plugins.rb +0 -9
- data/db/migrate/20100125033146_migrate_old_plugin_titles_to_plugin_names_for_users.rb +0 -61
- data/db/migrate/20100127004649_add_reset_code_to_users.rb +0 -9
- data/db/migrate/20100202034802_remove_custom_title_image_id_and_image_id_from_pages.rb +0 -13
- data/db/migrate/20100204011654_change_part_titles_to_titleized_version_for_new_format.rb +0 -13
- data/db/migrate/20100223211536_remove_themes_table.rb +0 -17
- data/db/migrate/20100305023036_change_users_columns_for_authlogic.rb +0 -54
- data/db/migrate/20100305023037_remove_unused_users_columns.rb +0 -15
- data/db/migrate/20100312155331_make_user_perishable_token_nullable.rb +0 -13
- data/db/migrate/20100312160327_make_user_persistence_token_nullable.rb +0 -13
- data/db/migrate/20100315203301_remove_state_from_users.rb +0 -9
- data/db/migrate/20100419001048_change_image_grid_thumbnail_size_and_regenerate.rb +0 -13
- data/db/migrate/20100522020225_rename_permissions_for_resources_plugin_to_files.rb +0 -15
- data/db/migrate/20100525084518_remove_take_down_for_maintenance_page.rb +0 -19
- data/db/migrate/20100525110237_add_small_and_large_thumbnail_sizes.rb +0 -14
- data/db/migrate/20100530205942_update_link_url_on_pages_from_inquiries_new_to_contact.rb +0 -31
- data/db/migrate/20100605132138_convert_resource_to_dragonfly.rb +0 -41
- data/db/migrate/20100605132208_convert_image_to_dragonfly.rb +0 -51
- data/db/migrate/20100606135207_change_thumbnail_sizes_for_dragonfly.rb +0 -17
- data/db/migrate/20100608062447_add_scoping_to_refinery_settings.rb +0 -9
- data/db/migrate/20100623220402_add_restricted_to_refinery_settings.rb +0 -9
- data/db/migrate/20100624024501_add_roles.rb +0 -24
- data/db/migrate/20100629081543_add_callback_proc_as_string_to_refinery_settings.rb +0 -9
- data/db/migrate/20100701053151_remove_superuser_from_users.rb +0 -20
- data/db/migrate/20100702022630_add_spam_to_inquiries.rb +0 -11
- data/db/migrate/20100708014636_ensure_user_plugins_use_name_and_not_title.rb +0 -9
- data/db/migrate/20100729221735_remove_page_translations_if_present.rb +0 -12
- data/db/migrate/20100826232810_move_inquiry_settings_to_refinery_settings.rb +0 -23
- data/db/migrate/20100831122919_move_page_to_nested_set.rb +0 -28
- data/db/migrate/20100913234704_add_cached_slug_to_pages.rb +0 -12
- data/db/seeds/inquiry_settings.rb +0 -2
@@ -1,17 +0,0 @@
|
|
1
|
-
class RemoveThemesTable < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
drop_table :themes
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.down
|
7
|
-
create_table "themes", :force => true do |t|
|
8
|
-
t.integer "size"
|
9
|
-
t.string "content_type"
|
10
|
-
t.string "filename"
|
11
|
-
t.string "title"
|
12
|
-
t.text "description"
|
13
|
-
t.text "license"
|
14
|
-
t.timestamps
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
class ChangeUsersColumnsForAuthlogic < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
# Change users table to use Authlogic-compatible schema
|
4
|
-
change_table "users" do |t|
|
5
|
-
User.all(:conditions => "`users`.reset_code IS NULL").each do |user|
|
6
|
-
new_code = Authlogic::Random.friendly_token
|
7
|
-
user.update_attribute(:reset_code, new_code)
|
8
|
-
end
|
9
|
-
User.all(:conditions => "`users`.remember_token IS NULL").each do |user|
|
10
|
-
new_code = Authlogic::Random.friendly_token
|
11
|
-
user.update_attribute(:remember_token, new_code)
|
12
|
-
end
|
13
|
-
t.change :login , :string , :null => false # optional , you can use email instead , or both
|
14
|
-
t.change :email , :string , :null => false # optional , you can use login instead , or both
|
15
|
-
t.change :crypted_password , :string , :null => false # optional , see below
|
16
|
-
t.rename :salt, :password_salt
|
17
|
-
t.change :password_salt , :string , :null => false # optional , but highly recommended
|
18
|
-
t.rename :remember_token, :persistence_token
|
19
|
-
t.change :persistence_token , :string , :null => false # required
|
20
|
-
t.remove :remember_token_expires_at # appears to be handled by perishable_token_valid_for setting in Authlogic
|
21
|
-
t.rename :reset_code, :perishable_token
|
22
|
-
t.change :perishable_token , :string , :null => false # optional , see Authlogic::Session::Perishability
|
23
|
-
t.remove :activation_code # perishable_token used for both activation_code and reset_code
|
24
|
-
|
25
|
-
# Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
|
26
|
-
#t.integer :login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
|
27
|
-
#t.integer :failed_login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
|
28
|
-
#t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
|
29
|
-
#t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
|
30
|
-
#t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
|
31
|
-
#t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
|
32
|
-
#t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.down
|
37
|
-
# Revert back to restful_authentication-compatible users table
|
38
|
-
create_table "users", :force => true do |t|
|
39
|
-
t.string "login"
|
40
|
-
t.string "email"
|
41
|
-
t.string "crypted_password", :limit => 40
|
42
|
-
t.string "salt", :limit => 40
|
43
|
-
t.string "remember_token" # this would be persistence_token in Authlogic
|
44
|
-
t.datetime "remember_token_expires_at" # appears to be handled by perishable_token_valid_for setting in Authlogic
|
45
|
-
t.string "activation_code", :limit => 40 # this would be perishable_token in Authlogic
|
46
|
-
t.datetime "activated_at" # appears to not be used
|
47
|
-
t.string "state", :default => "passive" # appears to not be used
|
48
|
-
t.datetime "deleted_at" # appears to not be used
|
49
|
-
t.timestamps
|
50
|
-
t.boolean "superuser", :default => false
|
51
|
-
t.string "reset_code"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class RemoveUnusedUsersColumns < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
change_table "users" do |t|
|
4
|
-
t.remove :activated_at
|
5
|
-
t.remove :deleted_at
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
change_table "users" do |t|
|
11
|
-
t.datetime "activated_at"
|
12
|
-
t.datetime "deleted_at"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class MakeUserPerishableTokenNullable < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
change_table "users" do |t|
|
4
|
-
t.change :perishable_token , :string , :null => true # optional
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
change_table "users" do |t|
|
10
|
-
t.change :perishable_token , :string , :null => false # optional
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class MakeUserPersistenceTokenNullable < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
change_table "users" do |t|
|
4
|
-
t.change :persistence_token , :string , :null => true # optional
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
change_table "users" do |t|
|
10
|
-
t.change :persistence_token , :string , :null => false # optional
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class ChangeImageGridThumbnailSizeAndRegenerate < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
image_thumbnails = RefinerySetting.find_or_set(:image_thumbnails, {})
|
4
|
-
RefinerySetting.image_thumbnails = image_thumbnails.merge({:grid => "c124x124"})
|
5
|
-
system("rake images:regenerate RAILS_ENV=#{Rails.env}")
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
image_thumbnails = RefinerySetting.find_or_set(:image_thumbnails, {})
|
10
|
-
RefinerySetting.image_thumbnails = image_thumbnails.merge({:grid => "c135x135"})
|
11
|
-
system("rake images:regenerate RAILS_ENV=#{Rails.env}")
|
12
|
-
end
|
13
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class RenamePermissionsForResourcesPluginToFiles < ActiveRecord::Migration
|
2
|
-
|
3
|
-
def self.up
|
4
|
-
UserPlugin.find_all_by_title("Resources").each do |up|
|
5
|
-
up.update_attribute(:title, "Files")
|
6
|
-
end if UserPlugin.column_names.include?('title')
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
UserPlugin.find_by_title("Files").each do |up|
|
11
|
-
up.update_attribute(:title, "Resources")
|
12
|
-
end if UserPlugin.column_names.include?('title')
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class RemoveTakeDownForMaintenancePage < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
if (page = Page.find_by_menu_match("^/maintenance$")).present?
|
4
|
-
page.destroy!
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
down_for_maintenance_page = Page.create(:title => "Down for maintenance",
|
10
|
-
:menu_match => "^/maintenance$",
|
11
|
-
:show_in_menu => false,
|
12
|
-
:position => (Page.maximum(:position) + 1))
|
13
|
-
down_for_maintenance_page.parts.create({
|
14
|
-
:title => "Body",
|
15
|
-
:body => "<p>Our site is currently down for maintenance. Please try back later.</p>",
|
16
|
-
:position => 0
|
17
|
-
})
|
18
|
-
end
|
19
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class AddSmallAndLargeThumbnailSizes < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
image_thumbnails = RefinerySetting.find_or_set(:image_thumbnails, {})
|
4
|
-
RefinerySetting.image_thumbnails = image_thumbnails.merge({
|
5
|
-
:small => '110x110>',
|
6
|
-
:medium => '225x255>',
|
7
|
-
:large => '450x450>'
|
8
|
-
})
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.down
|
12
|
-
# don't really need to reverse it, it's not destructive if you run it multiple times.
|
13
|
-
end
|
14
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class UpdateLinkUrlOnPagesFromInquiriesNewToContact < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
Page.find_all_by_link_url('/inquiries/new').each do |page|
|
4
|
-
page.update_attributes({
|
5
|
-
:link_url => '/contact',
|
6
|
-
:menu_match => "^/(inquiries|contact).*$"
|
7
|
-
})
|
8
|
-
end
|
9
|
-
Page.find_all_by_menu_match('^/inquiries/thank_you$').each do |page|
|
10
|
-
page.update_attributes({
|
11
|
-
:link_url => '/contact/thank_you',
|
12
|
-
:menu_match => '^/(inquiries|contact)/thank_you$'
|
13
|
-
})
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.down
|
18
|
-
Page.find_all_by_link_url('/contact/thank_you').each do |page|
|
19
|
-
page.update_attributes({
|
20
|
-
:link_url => nil,
|
21
|
-
:menu_match => '^/inquiries/thank_you$'
|
22
|
-
})
|
23
|
-
end
|
24
|
-
Page.find_all_by_link_url('/contact').each do |page|
|
25
|
-
page.update_attributes({
|
26
|
-
:link_url => '/inquiries/new',
|
27
|
-
:menu_match => '^/inquiries.*$'
|
28
|
-
})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
class ConvertResourceToDragonfly < ActiveRecord::Migration
|
2
|
-
|
3
|
-
# Use a basic model for the migration - otherwise the acts_as_indexed hooks
|
4
|
-
# make copying attributes problematic.
|
5
|
-
# (see: http://guides.rubyonrails.org/migrations.html#using-models-in-your-migrations)
|
6
|
-
class Resource < ActiveRecord::Base; end;
|
7
|
-
|
8
|
-
def self.up
|
9
|
-
# Dragonfly required column
|
10
|
-
add_column :resources, :file_uid, :string
|
11
|
-
|
12
|
-
# Optional Dragonfly columns - persist 'magic' attributes
|
13
|
-
add_column :resources, :file_ext, :string
|
14
|
-
|
15
|
-
# Rename columns to Dragonfly conventions - persist 'magic' attributes
|
16
|
-
rename_column :resources, :filename, :file_name
|
17
|
-
rename_column :resources, :content_type, :file_mime_type
|
18
|
-
rename_column :resources, :size, :file_size
|
19
|
-
|
20
|
-
# Populate the image_uid column for Dragonfly
|
21
|
-
Resource.all.each do |r|
|
22
|
-
r.update_attributes(:file_uid => ("%08d" % r.id).scan(/..../).join('/') << '/' << r.file_name,
|
23
|
-
:file_ext => r.file_name.split('.').last)
|
24
|
-
end
|
25
|
-
|
26
|
-
# Remove child records, used by attachment_fu only
|
27
|
-
Resource.delete_all('parent_id is not null')
|
28
|
-
remove_column :resources, :parent_id
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.down
|
32
|
-
remove_column :resources, :file_uid
|
33
|
-
remove_column :resources, :file_ext
|
34
|
-
|
35
|
-
rename_column :resources, :file_name, :filename
|
36
|
-
rename_column :resources, :file_mime_type, :content_type
|
37
|
-
rename_column :resources, :file_size, :size
|
38
|
-
|
39
|
-
add_column :resources, :parent_id, :integer
|
40
|
-
end
|
41
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
class ConvertImageToDragonfly < ActiveRecord::Migration
|
2
|
-
|
3
|
-
# Use a basic model for the migration - otherwise the acts_as_indexed hooks
|
4
|
-
# make copying attributes problematic.
|
5
|
-
# (see: http://guides.rubyonrails.org/migrations.html#using-models-in-your-migrations)
|
6
|
-
class Image < ActiveRecord::Base; end;
|
7
|
-
|
8
|
-
def self.up
|
9
|
-
# Dragonfly required column
|
10
|
-
add_column :images, :image_uid, :string
|
11
|
-
|
12
|
-
# Optional Dragonfly columns - persist 'magic' attributes
|
13
|
-
add_column :images, :image_ext, :string
|
14
|
-
|
15
|
-
# Rename columns to Dragonfly conventions - persist 'magic' attributes
|
16
|
-
rename_column :images, :filename, :image_name
|
17
|
-
rename_column :images, :content_type, :image_mime_type
|
18
|
-
rename_column :images, :size, :image_size
|
19
|
-
rename_column :images, :width, :image_width
|
20
|
-
rename_column :images, :height, :image_height
|
21
|
-
|
22
|
-
# Remove non-Dragonfly columns
|
23
|
-
remove_column :images, :thumbnail
|
24
|
-
remove_column :images, :image_type
|
25
|
-
|
26
|
-
# Populate the image_uid column for Dragonfly
|
27
|
-
Image.all.each do |i|
|
28
|
-
i.update_attributes(:image_uid => ("%08d" % i.id).scan(/..../).join('/') << '/' << i.image_name,
|
29
|
-
:image_ext => i.image_name.split('.').last)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Remove child records, used by attachment_fu only
|
33
|
-
Image.delete_all('parent_id is not null')
|
34
|
-
remove_column :images, :parent_id
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.down
|
38
|
-
remove_column :images, :image_uid
|
39
|
-
remove_column :images, :image_ext
|
40
|
-
|
41
|
-
rename_column :images, :image_name, :filename
|
42
|
-
rename_column :images, :image_mime_type, :content_type
|
43
|
-
rename_column :images, :image_size, :size
|
44
|
-
rename_column :images, :image_width, :width
|
45
|
-
rename_column :images, :image_height, :height
|
46
|
-
|
47
|
-
add_column :images, :thumbnail, :string
|
48
|
-
add_column :images, :parent_id, :integer
|
49
|
-
add_column :images, :image_type, :string
|
50
|
-
end
|
51
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class ChangeThumbnailSizesForDragonfly < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
RefinerySetting.set(:image_thumbnails, {
|
4
|
-
:dialog_thumb => '106x106#c',
|
5
|
-
:grid => '135x135#c',
|
6
|
-
:preview => '96x96#c'
|
7
|
-
})
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.down
|
11
|
-
RefinerySetting.set(:image_thumbnails, {
|
12
|
-
:dialog_thumb => 'c106x106',
|
13
|
-
:grid => 'c135x135',
|
14
|
-
:preview => 'c96x96'
|
15
|
-
})
|
16
|
-
end
|
17
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
class AddRoles < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :roles do |t|
|
4
|
-
t.string :title
|
5
|
-
end
|
6
|
-
|
7
|
-
create_table :roles_users, :id => false do |t|
|
8
|
-
t.integer :user_id
|
9
|
-
t.integer :role_id
|
10
|
-
end
|
11
|
-
|
12
|
-
# All users at this point will be Refinery admin users,
|
13
|
-
# so we add the Refinery role to each of them.
|
14
|
-
User.all.each do |user|
|
15
|
-
user.roles << Role['Refinery']
|
16
|
-
user.save!
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.down
|
21
|
-
drop_table :roles
|
22
|
-
drop_table :roles_users
|
23
|
-
end
|
24
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class RemoveSuperuserFromUsers < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
superusers = User.find_all_by_superuser(true)
|
4
|
-
superusers.each do |user|
|
5
|
-
user.add_role(:superuser)
|
6
|
-
user.save(:validate => false)
|
7
|
-
end
|
8
|
-
|
9
|
-
remove_column :users, :superuser
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.down
|
13
|
-
add_column :users, :superuser, :boolean, :default => false
|
14
|
-
|
15
|
-
User.reset_column_information
|
16
|
-
Role[:superuser].users.each do |user|
|
17
|
-
user.update_attribute(:superuser, true)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class EnsureUserPluginsUseNameAndNotTitle < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
rename_column :user_plugins, :title, :name if UserPlugin.table_exists? and UserPlugin.column_names.include?('title') and !UserPlugin.column_names.include?('name')
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.down
|
7
|
-
# We don't need to go backwards, there already is one that should handle that..
|
8
|
-
end
|
9
|
-
end
|