1 class FeedItem
< ActiveRecord
::Base
3 # require 'cgi' # needed for url decoding
5 validates_presence_of
:feed_name, :title, :description
6 validates_uniqueness_of
:title, :scope => :feed_name
7 validate
:feed_name_must_be_legal
9 def FeedItem
.valid_feed_name
?(feed_name
)
10 Rack
::Utils::escape(feed_name
) == feed_name
and
11 Rack
::Utils::unescape(feed_name
) == feed_name
and
12 feed_name
!= 'index' and
13 feed_name
!= 'show' and
14 feed_name
!= 'update' and
20 def feed_name_must_be_legal
21 unless FeedItem
.valid_feed_name
?(feed_name
)
22 errors
.add(:feed_name, 'is an invalid feed name')