summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-09-07 15:39:10 +0200
committerhukl <contact@smyck.org>2009-09-07 15:39:10 +0200
commit78391adf0d7c241a6b1385621d98b6972d799d3a (patch)
tree7d12a7ba1876b5b31caaf3d25a1831ff2997bfdc /app/models
parentfa2052b1ed8b51a950d18ed8c620a37dd54c23d3 (diff)
parentbfba5e1da6e890e22e8b7134a94807c5da757d94 (diff)
Merge branch 'featured_articles'
Diffstat (limited to 'app/models')
-rw-r--r--app/models/menu_item.rb26
1 files changed, 24 insertions, 2 deletions
diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb
index e86be0e..054e7ee 100644
--- a/app/models/menu_item.rb
+++ b/app/models/menu_item.rb
@@ -1,6 +1,28 @@
1class MenuItem < ActiveRecord::Base 1class MenuItem < ActiveRecord::Base
2 2
3 translates :title 3 default_scope :conditions => {:type => "MenuItem"}
4 4
5 acts_as_list 5 translates :title
6
7 acts_as_list :scope => :type
8
9 before_save :determine_type_id
10
11
12 private
13
14 def determine_type_id
15 case self.class.name
16
17 when "MenuItem"
18 self.type_id = 1
19 when "FeaturedArticle"
20 self.type_id = 2
21 end
22 end
6end 23end
24
25
26class FeaturedArticle < MenuItem
27 default_scope :conditions => {:type => "FeaturedArticle"}
28end \ No newline at end of file