Rails:undefined method `model_params' for nil:NilClass

it says here that I don"t define that the method, problem lies in the app/views/model/show.html.haml file.

I tried to find out what"s wrong with the def show in controller, but I didn"t find anything wrong.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
.show-param

.tabs-content
    .parameter
        .table-wrapper
            %table
                %caption
                    %strong Parameters
                %thread
                    %td  Name
                    %td  DataType
                %tbody
                    - @model.model_params.each do |p| 
                        %tr
                            %td.font-bold{:width => "30%"}
                                = p.name

                            %td{:width=>"10%"}
                                = p.data_type
        .row 
            = link_to "Edit API Endpoint information", edit_project_model_path(), class: "button tiny right small-margin-right-10"
            

related codes

/ / Please paste the code text below (do not replace the code with pictures)

def show 
    @hostname = request.host 
    @hostport = request.port.to_s
    @model = Model.find(get_id)
    @params =@model.model_params.all.order(name: :asc)
    @p_id =get_project_id
end
            

related codes

/ / Please paste the code text below (do not replace the code with pictures)

def m_params
    params.require(:model).permit(:name,:description,:response,
    model_params_attributes: [:id, :name, :data_type, :_destroy])
end
    


what result do you expect? What is the error message actually seen?

Nov.10,2021

so.

what are you trying to say?

Menu