OSDN Git Service

mrg
[pettanr/pettanr.git] / app / controllers / application_controller.rb
index f1da1ce..bbdd2e8 100644 (file)
@@ -106,7 +106,7 @@ class ApplicationController < ActionController::Base
   def set_model
     @my_controller = Manifest.manifest.controllers[params[:controller].to_s]
     @my_action = @my_controller.actions[params[:action].to_s]
-    @my_model = Manifest.manifest.models[@my_controller.item_name]
+    @my_model = Manifest.manifest.models[@my_action.item_name]
     @my_model_class = @my_model.classify
   end
   
@@ -143,7 +143,10 @@ class ApplicationController < ActionController::Base
   
   def set_play
     set_list
-    @item = @my_model_class.show(params[:id], @operators)
+    @binder_controller = Manifest.manifest.controllers[params[:controller].to_s]
+    @binder_model = Manifest.manifest.models[@binder_controller.item_name]
+    @binder_model_class = @binder_model.classify
+    @item = @binder_model_class.show(params[:id], @operators)
   end
   
   def play_list
@@ -165,7 +168,7 @@ class ApplicationController < ActionController::Base
   def show_prof_format format
     format.prof {
       self.formats = [:html]
-      @profiler = Locmare::Profiler.new @my_model.model_name, @item, @operators
+      @profiler = Locmare::Profiler.new @my_model_class.item_name, @item, @operators
       render @profiler.template_name, :locals => {
         :profiler => @profiler
       }
@@ -177,7 +180,7 @@ class ApplicationController < ActionController::Base
   end
   
   def show_json_format_for_root format
-    format.json { render json: @item.attributes.to_json(@my_model_class.show_json_opt_for_root) }
+    format.json { render json: @item.to_json(@my_model_class.show_json_opt_for_root) }
   end
   
   def set_new