OSDN Git Service

fix:err dialog
[pettanr/pettanr.git] / app / controllers / original_picture_licenses_controller.rb
index 9a6543e..dec43bf 100644 (file)
@@ -1,6 +1,6 @@
 class OriginalPictureLicensesController < ApplicationController
-  before_filter :authenticate_user, :only => [:new, :create]
-  before_filter :authenticate_artist, :only => [:new, :create]
+  before_action :authenticate_user, :only => [:new, :create]
+  before_action :authenticate_artist, :only => [:new, :create]
   
   def new
     # use @item, @original_picture, @form
@@ -15,19 +15,24 @@ class OriginalPictureLicensesController < ApplicationController
     
     @item = @my_model_class.new
     @my_model_class.fold_extend_settings params[@my_model_class.item_name]
-    @item.attributes = params[@my_model_class.item_name]
+    @item.attributes = @item.permit_params params
     @item.overwrite 
     @item.boosts 'post'
     @original_picture = OriginalPicture.show @item.original_picture, @operators
     
     if @item.valid?
       # switch my_model_class
-      @item = OriginalPictureLicense.build_resource_picture @item, @original_picture, params[@my_model_class.item_name]
+      @item = OriginalPictureLicense.build_resource_picture @item, @original_picture, @item.permit_params(params)
       respond_to do |format|
         format.html {
           render main_app.new_resource_picture_path
         }
         format.json {
+          # response contains credits template
+          #
+          # confirm page need show credit
+          # however, building resource picture has not credit
+          # 
           r = {
             :item => @item,
             :credits => render_to_string('credits', :formats => :html, :layout => false)