public
Description: Rails Plugin - a RailsEngines-based CMS extension for any Rails project
Homepage: http://6brand.com
Clone URL: git://github.com/JackDanger/simple_pages.git
Search Repo:
works without acts_as_revisioned

git-svn-id: http://svn.6brand.com/projects/plugins/simple_pages@290 
7491b73d-821b-0410-9297-ad1f6b5b4194
studioda (author)
Tue Feb 20 14:52:32 -0800 2007
commit  28886df21b99b11fb452a8ad929ea7fc77da2f6e
tree    ddad99ad52c9635218697bceacd8017730c11c1a
parent  1aa1cfb1b026aebd5fe58b59809a0643ddc1a23c
...
5
6
7
8
 
9
10
11
 
12
13
14
15
16
17
 
18
19
20
...
38
39
40
41
 
42
43
44
45
 
46
47
48
...
5
6
7
 
8
9
10
 
11
12
13
14
15
16
 
17
18
19
20
...
38
39
40
 
41
42
43
44
 
45
46
47
48
0
@@ -5,16 +5,16 @@ class SimplePagesController < ApplicationController
0
                                            :update,
0
                                            :destroy]
0
   before_filter :find_or_initialize, :except => :index
0
- before_filter :set_title
0
+ before_filter :set_title, :except => :index
0
   
0
   def index
0
- @pages = Page.find(:all)
0
+ @pages = SimplePage.find(:all)
0
   end
0
   
0
   # render show
0
   
0
   def edit
0
- @page.revert_to(params[:version]) if params[:version] && @page.respond_to(:revert_to)
0
+ @page.revert_to(params[:version]) if params[:version] && @page.respond_to?(:revert_to)
0
   end
0
   
0
   def create
0
@@ -38,11 +38,11 @@ class SimplePagesController < ApplicationController
0
   protected
0
   
0
     def find_or_initialize
0
- @page = params[:id] ? Page.find_by_filename(params[:id]) : Page.new
0
+ @page = params[:id] ? SimplePage.find_by_filename(params[:id]) : SimplePage.new
0
     end
0
     
0
     def set_title
0
- @title = @page.title if @page.respond_to(:title)
0
+ @title = @page.title if @page.respond_to?(:title)
0
     end
0
     
0
     def rescue_action(exception)
...
1
2
3
 
4
5
6
 
7
8
9
...
1
2
 
3
4
5
 
6
7
8
9
0
@@ -1,9 +1,9 @@
0
 class SimplePage < ActiveRecord::Base
0
 
0
- # make sure to install the acts_as_versioned plugin to make simple_pages work!
0
+ # make sure to install the acts_as_versioned plugin to make simple_pages revisioning work!
0
   # $ ruby script/plugin source http://svn.techno-weenie.net/projects/plugins
0
   # $ ruby script/plugin install -x acts_as_versioned
0
- acts_as_versioned
0
+ acts_as_versioned if respond_to?(:acts_as_versioned)
0
 
0
   validates_presence_of :filename, :title
0
   validates_uniqueness_of :filename, :title
...
7
8
9
10
 
11
12
13
14
15
 
16
17
...
7
8
9
 
10
11
12
13
14
 
15
16
17
0
@@ -7,11 +7,11 @@ class CreateSimplePages < ActiveRecord::Migration
0
       t.column :created_at, :datetime
0
       t.column :updated_at, :datetime
0
     end
0
- SimplePage.create_versioned_table
0
+ SimplePage.create_versioned_table if SimplePage.respond_to?(:create_versioned_table)
0
   end
0
 
0
   def self.down
0
     drop_table :simple_pages
0
- SimplePage.drop_versioned_table
0
+ SimplePage.drop_versioned_table if SimplePage.respond_to?(:drop_versioned_table)
0
   end
0
 end

Comments

    No one has commented yet.