]> source.dussan.org Git - redmine.git/commitdiff
shorten long line of app/models/wiki_page.rb
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 10 Dec 2020 13:34:23 +0000 (13:34 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 10 Dec 2020 13:34:23 +0000 (13:34 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20612 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/wiki_page.rb

index 7011bdf9799694c8b75b57d982fd86b7f89589c9..fe0419fdd0cfa764a465109fea2a124bb244c523 100644 (file)
@@ -23,18 +23,25 @@ class WikiPage < ActiveRecord::Base
   include Redmine::SafeAttributes
 
   belongs_to :wiki
-  has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id', :dependent => :destroy
-  has_one :content_without_text, lambda {without_text.readonly}, :class_name => 'WikiContent', :foreign_key => 'page_id'
+  has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id',
+          :dependent => :destroy
+  has_one :content_without_text, lambda {without_text.readonly},
+          :class_name => 'WikiContent', :foreign_key => 'page_id'
 
   acts_as_attachable :delete_permission => :delete_wiki_pages_attachments
   acts_as_tree :dependent => :nullify, :order => 'title'
 
   acts_as_watchable
-  acts_as_event :title => Proc.new {|o| "#{l(:label_wiki)}: #{o.title}"},
-                :description => :text,
-                :datetime => :created_on,
-                :url => Proc.new {|o| {:controller => 'wiki', :action => 'show', :project_id => o.wiki.project, :id => o.title}}
-
+  acts_as_event(
+    :title => proc {|o| "#{l(:label_wiki)}: #{o.title}"},
+    :description => :text,
+    :datetime => :created_on,
+    :url =>
+      proc do |o|
+        {:controller => 'wiki', :action => 'show',
+         :project_id => o.wiki.project, :id => o.title}
+      end
+  )
   acts_as_searchable :columns => ['title', "#{WikiContent.table_name}.text"],
                      :scope => joins(:content, {:wiki => :project}),
                      :preload => [:content, {:wiki => :project}],