Skip to content

Commit

Permalink
Add the notion of scoping to refinery settings. Right now everything …
Browse files Browse the repository at this point in the history
…is just using nil to maintain backward compatibility.
  • Loading branch information
parndt committed Jun 8, 2010
1 parent aa82d9a commit b5fd2f0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
9 changes: 9 additions & 0 deletions db/migrate/20100608062447_add_scoping_to_refinery_settings.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddScopingToRefinerySettings < ActiveRecord::Migration
def self.up
add_column :refinery_settings, :scoping, :string, :default => nil
end

def self.down
remove_column :refinery_settings, :scoping
end
end
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is auto-generated from the current state of the database. Instead of editing this file,
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
Expand All @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20100530205942) do
ActiveRecord::Schema.define(:version => 20100608062447) do

create_table "images", :force => true do |t|
t.integer "parent_id"
Expand Down Expand Up @@ -86,6 +86,7 @@
t.boolean "destroyable", :default => true
t.datetime "created_at"
t.datetime "updated_at"
t.string "scoping"
end

add_index "refinery_settings", ["name"], :name => "index_refinery_settings_on_name"
Expand Down
6 changes: 5 additions & 1 deletion refinerycms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = %q{refinerycms}
s.version = %q{0.9.7.dev}
s.description = %q{A beautiful open source Ruby on Rails content manager for small business. Easy to extend, easy to use, lightweight and all wrapped up in a super slick UI.}
s.date = %q{2010-06-03}
s.date = %q{2010-06-09}
s.summary = %q{A beautiful open source Ruby on Rails content manager for small business.}
s.email = %q{info@refinerycms.com}
s.homepage = %q{http://refinerycms.com}
Expand Down Expand Up @@ -64,6 +64,7 @@ Gem::Specification.new do |s|
'db/migrate/20100525084518_remove_take_down_for_maintenance_page.rb',
'db/migrate/20100525110237_add_small_and_large_thumbnail_sizes.rb',
'db/migrate/20100530205942_update_link_url_on_pages_from_inquiries_new_to_contact.rb',
'db/migrate/20100608062447_add_scoping_to_refinery_settings.rb',
'db/schema.rb',
'db/seeds',
'db/seeds/inquiry_settings.rb',
Expand Down Expand Up @@ -136,6 +137,7 @@ Gem::Specification.new do |s|
'public/images/refinery/orange_button.png',
'public/images/refinery/page_bg.png',
'public/images/refinery/resolve_digital_footer_logo.png',
'public/images/refinery/text_field_background.png',
'public/images/wymeditor',
'public/images/wymeditor/skins',
'public/images/wymeditor/skins/refinery',
Expand Down Expand Up @@ -188,6 +190,7 @@ Gem::Specification.new do |s|
'public/javascripts/jquery',
'public/javascripts/jquery/GPL-LICENSE.txt',
'public/javascripts/jquery/jquery.corner.js',
'public/javascripts/jquery/jquery.html5-placeholder-shim.js',
'public/javascripts/jquery/jquery.textTruncate.js',
'public/javascripts/jquery/MIT-LICENSE.txt',
'public/javascripts/jquery-min.js',
Expand Down Expand Up @@ -509,6 +512,7 @@ Gem::Specification.new do |s|
'vendor/plugins/images/app/views',
'vendor/plugins/images/app/views/admin',
'vendor/plugins/images/app/views/admin/images',
'vendor/plugins/images/app/views/admin/images/_existing_image.erb',
'vendor/plugins/images/app/views/admin/images/_form.html.erb',
'vendor/plugins/images/app/views/admin/images/_grid_view.html.erb',
'vendor/plugins/images/app/views/admin/images/_list_view.html.erb',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ def self.method_missing(method, *args)
end
end

def self.find_or_set(name, the_value)
find_or_create_by_name(:name => name.to_s, :value => the_value).value
def self.find_or_set(name, the_value, options={})
options = {:scoping => nil}.merge(options)
find_or_create_by_name_and_scoping(:name => name.to_s, :value => the_value, :scoping => options[:scope]).value
end

def self.[](name)
Expand Down

0 comments on commit b5fd2f0

Please sign in to comment.