Commit 1a6ac2de822e4e263e428aae0f4c10f1155b67c9
1 parent
19945d2e
Exists in
master
and in
27 other branches
rails3: use settings_items for limit on rss_feed
Showing
1 changed file
with
6 additions
and
6 deletions
Show diff stats
app/models/rss_feed.rb
... | ... | @@ -28,16 +28,16 @@ class RssFeed < Article |
28 | 28 | self.body[:feed_item_description] = feed_item_description |
29 | 29 | end |
30 | 30 | |
31 | - # The maximum number of articles to be displayed in the RSS feed. Default: 10 | |
32 | - def limit | |
33 | - settings[:limit] || 10 | |
34 | - end | |
35 | - def limit=(value) | |
31 | + settings_items :limit, :type => :integer, :default => 10 | |
32 | + | |
33 | + def limit_with_body_change=(value) | |
36 | 34 | #UPGRADE Leandro: I add this line to save the serialize attribute |
37 | 35 | self.body_will_change! |
38 | - settings[:limit] = value | |
36 | + self.limit_without_body_change= value | |
39 | 37 | end |
40 | 38 | |
39 | + alias_method_chain :limit=, :body_change | |
40 | + | |
41 | 41 | # FIXME this should be validates_numericality_of, but Rails 2.0.2 does not |
42 | 42 | # support validates_numericality_of with virtual attributes |
43 | 43 | validates_format_of :limit, :with => /^\d+$/, :if => :limit | ... | ... |