comparison app/models/wiki.rb @ 931:ec1c49528f36 cannam_integration

Merge from branch "redmine-1.3"
author Chris Cannam
date Wed, 27 Jun 2012 15:04:58 +0100
parents 5e80956cc792 5f33065ddc4b
children bb32da3bea34
comparison
equal deleted inserted replaced
930:027cc0f5d4a2 931:ec1c49528f36
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 class Wiki < ActiveRecord::Base 18 class Wiki < ActiveRecord::Base
19 include Redmine::SafeAttributes
19 belongs_to :project 20 belongs_to :project
20 has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title' 21 has_many :pages, :class_name => 'WikiPage', :dependent => :destroy, :order => 'title'
21 has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all 22 has_many :redirects, :class_name => 'WikiRedirect', :dependent => :delete_all
22 23
23 acts_as_watchable 24 acts_as_watchable
24 25
25 validates_presence_of :start_page 26 validates_presence_of :start_page
26 validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/ 27 validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/
28
29 safe_attributes 'start_page'
27 30
28 def visible?(user=User.current) 31 def visible?(user=User.current)
29 !user.nil? && user.allowed_to?(:view_wiki_pages, project) 32 !user.nil? && user.allowed_to?(:view_wiki_pages, project)
30 end 33 end
31 34