Commit 0bee68c899672bf5c8c0a53464a870169d08b359

Authored by AntonioTerceiro
1 parent 65b230c5

ActionItem18: using Article instead of Comatose::Page



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@419 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/cms_controller.rb
1 1 class CmsController < ComatoseAdminController
  2 + define_option :page_class, Article
2 3 end
... ...
app/controllers/content_viewer_controller.rb
... ... @@ -4,7 +4,7 @@ class ContentViewerController &lt; ApplicationController
4 4 path = params[:page].clone
5 5 path.unshift(params[:profile])
6 6 @path = path.join('/')
7   - @page = Comatose::Page.find_by_path(@path)
  7 + @page = Article.find_by_path(@path)
8 8 if @page.nil?
9 9 render :action => 'not_found', :status => 404
10 10 end
... ...
app/models/article.rb 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +class Article < Comatose::Page
  2 +end
  3 +class Article < Comatose::Page
  4 +end
... ...
db/migrate/008_add_comatose_support.rb
... ... @@ -22,6 +22,10 @@ class AddComatoseSupport &lt; ActiveRecord::Migration
22 22 t.column "version", :integer
23 23 t.column "updated_on", :datetime
24 24 t.column "created_on", :datetime
  25 +
  26 + # added for STI in noosfero
  27 + t.column 'type', :string
  28 +
25 29 end
26 30 Comatose::Page.create_versioned_table
27 31 puts "Creating the default 'Home Page'..."
... ...
test/functional/content_viewer_controller_test.rb
... ... @@ -17,7 +17,7 @@ class ContentViewerControllerTest &lt; Test::Unit::TestCase
17 17 def test_should_display_homepage
18 18 uses_host 'anhetegua.net'
19 19  
20   - Comatose::Page.expects(:find_by_path).with('aprofile').returns(Comatose::Page.new)
  20 + Article.expects(:find_by_path).with('aprofile').returns(Article.new)
21 21  
22 22 get :view_page, :profile => 'aprofile', :page => []
23 23 assert_response :success
... ...