OSDN Git Service

Hidden private actions
authornangxiang <nangxiang@users.sourceforge.jp>
Sun, 18 Sep 2011 09:14:07 +0000 (18:14 +0900)
committernangxiang <nangxiang@users.sourceforge.jp>
Sun, 18 Sep 2011 09:14:07 +0000 (18:14 +0900)
hanMorph/app/controllers/application_controller.rb
hanMorph/app/controllers/daxu_controller.rb
hanMorph/app/controllers/sbgy_controller.rb
hanMorph/app/views/hanmorph/index.html.erb

index 85a7f2e..f5e7e78 100644 (file)
@@ -9,6 +9,10 @@ class ApplicationController < ActionController::Base
   # Scrub sensitive parameters from your log
   # filter_parameter_logging :password
 
+#  rescue_from NoMethodError, :with => :no_method_error
+#  rescue_from NameError, :with => :no_method_error
+  
+  protected
   def ucs2char(ucs)
     return nil unless ucs =~ CODEPOINT
     code = ucs.slice(2, ucs.size)
@@ -60,4 +64,9 @@ class ApplicationController < ActionController::Base
     end
     return doc.to_s
   end
+
+  private
+  def no_method_error
+    render :text => "不正なアクションです", :status => 404
+  end
 end
index 3500da0..e20aad7 100644 (file)
@@ -19,6 +19,9 @@ class DaxuController < ApplicationController
     @wordheads = DxWordhead.find(:all, :conditions => ["radical_id = ?", radical_id])
   end
   def word
+    redirect_to(:controller => 'hanmorph', :action => 'index')
+
+    # no action
     c = params[:char]
     return nil unless c
     (@ucs, @char) = process_char(c)
index 3c9e349..90a0c2b 100644 (file)
@@ -30,10 +30,14 @@ class SbgyController < ApplicationController
   end
   def rhyme
     rhyme_id = params[:id]
+    if request.post? and !rhyme_id then
+      redirect_to(:controller => 'hanmorph', :action => 'index')
+    end
     @rhyme = Rhyme.find(:first, :conditions => ["id = ?", rhyme_id])
     @volume = Volume.find(:first, :conditions => ["id = ?", @rhyme.volume_id])
     @voices = Voice.find(:all, :conditions => ["rhyme_id = ?", rhyme_id])
   end
+
   # TODO: piece -> leaf
   def show
     @vol = params[:vol]
@@ -65,6 +69,7 @@ class SbgyController < ApplicationController
     @wordheads = 
       Wordhead.find(:all, :conditions => ["voice_id = ?", @voice.id])
   end
+  protected
   def setup
     @wordheads = 0
     @voices = 0
index 4176b3e..051ab3a 100644 (file)
@@ -71,6 +71,7 @@
   </p>
   <div style="float: right; padding: 0px 20px">
     <%=  image_tag("swjz-v02-trans.jpg", :size => "300x170") %>
+    <!-- %=  image_tag("shuowenjiezi-part.jpg", :size => "300x170") % -->
   </div>
   <p>
     本システムは「HOME」頁を中心に構成されていて、