ruby on rails - undefined method `permit' for "**output omitted**":String -


updated: have link_to set deleting object nested resource. prior destroy, have method checks instance of object based on object_params, params sent keep raising undefined method 'permit' "asdfsadf":string when tries reference object_params.

button:

<%= link_to content_tag('button', '', class: 'btn fa fa-trash-o focus-delete-button'), parent_object_path( :parent_id => focus.z_kf_parent, :id => focus.id, :object => focus), data: {confirm: "are sure want delete '#{focus.name}'"}, method: :delete %> 

params:

 {"_method"=>"delete",  "authenticity_token"=>"gmlvyhy230y1lqy=",  "object"=>"6c1367b1-1d63-4545-bbdb-b8ac9bd39422",  "action"=>"destroy",  "controller"=>"objects",  "parent_id"=>"fa100073-4a0c-4ee0-8fb1-3ec39c61ad39",  "id"=>"5-bbdb-b8ac9"} 

object_params:

def object_params     params.require(:set_list).permit(:id, :photographer, :digital_tech, :photo_production, :stylist, :stylist_assistant, :hair_makeup, :photographer_assistant, :name, :t_start, :t_finish, :z_kf_parent)   end 

method:

def set_object   binding.pry   @object = object.(object_id: object_params[:id]).first end 

am not setting parameters right in link_to?

your object_params method requiring there param called set_list. there no such parameter in params.

this work you:

def set_object   binding.pry   @object = object.where(object_id: params[:id]).first end 

you don't need wrap params[:id] lookup through permit you're not mass-assigning anything.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -