1 class FeedItem
< ActiveRecord
::Base
4 where('feed_name = ?', name
)
7 def self.entitled(title
)
8 where('title = ?', title
)
11 validates_presence_of
:feed_name, :title, :description
12 validates_uniqueness_of
:title, :scope => :feed_name
13 validate
:feed_name_must_be_legal
15 def FeedItem
.valid_feed_name
?(feed_name
)
16 Rack
::Utils::escape(feed_name
) == feed_name
and
17 Rack
::Utils::unescape(feed_name
) == feed_name
and
18 feed_name
!= 'index' and
19 feed_name
!= 'show' and
20 feed_name
!= 'update' and
26 def feed_name_must_be_legal
27 unless FeedItem
.valid_feed_name
?(feed_name
)
28 errors
.add(:feed_name, 'is invalid')