ruby - Strong Params Unpermitted parameters -


i know there alot of questions on this, after looking @ dozen or none of them appear same problem. have "action" model trying edit , update. (fyi, isn't nested form, i'm not using devise, , isn't activeadmin problem...like virtually other questions topic are). i'm getting

error:

unpermitted parameters: utf8, _method, authenticity_token when this. 

action params in actions_controller:

def action_params     params.permit(:id, :call_answered, :is_customer, :category_id, :actiontype_id, :why,   :reviewer_id, :reviewed, :spam, :lead) end 

if change to:

    params.require(:action).permit(:id, :call_answered, :is_customer, :category_id, :actiontype_id, :why,   :reviewer_id, :reviewed, :spam, :lead) end 

than below error (and can't find solution this):

undefined method `permit' "update":string 

actions controller:

def edit     @action = action.find(params[:id])     @actiontypes = actiontype.all     @categories = category.all     @lead_categories = @categories.where(lead: true)     @user = current_user     @reviewer = user.find(@action.reviewer_id) if @action.reviewed? end  def update   @action = action.find(params[:id])     if @action.update!(action_params)       binding.pry       flash[:success] = "loop closed!"       redirect_to '/closingloop/actions?reviewed=false'     else       flash[:danger] = "something went wrong! loop not closed!"       render :edit     end  end  def action_params     params.permit(:id, :call_answered, :is_customer, :category_id, :actiontype_id, :why,   :reviewer_id, :reviewed, :spam, :lead) end 

view:

 <%= form_for [:closingloop, @action] |f| %>         <%= f.hidden_field :reviewer_id, :value => @user.id %>         <%= f.hidden_field :reviewed, :value => true %>         <table width="70%" align="center" class="table table-responsive">             <tr>                 <th>tracking number</th>                 <td><%= @action.company.tracking_phone_number %></td>             </tr>             <tr>                 <th>target number</th>                 <td><%= @action.company.phonenumber %></td>             </tr>             <tr>                 <th>opportunity name</th>                 <td><%= @action.opportunity_name %></td>             </tr>             <tr>                 <th>opportunity address</th>                 <td><%= @action.customer_address %></td>             </tr>             <tr>                 <th>opportunity phone</th>                 <td><%= @action.caller_phone_number %></td>             </tr>             <tr>                 <th>call recording</th>                 <td><%= audio_tag(@action.call_recording_link, controls: true) %></td>             </tr>             <tr>                 <th>duration</th>                 <td><%= @action.duration %></td>             </tr>             <tr>                 <th>call status</th>                 <td><%= @action.call_status %></td>             </tr>             <tr>                 <th>date & time</th>                 <td><%= @action.created_at.to_formatted_s(:long) %></td>             </tr>             <% if @action.reviewed? %>                 <tr id="row_reviewed_by">                     <th>reviewed by</th>                     <td><%= @reviewer.first_name %> <%= @reviewer.last_name %></td>                 </tr>             <% end %>             <tr><td colspan="2">&nbsp;</td></tr>                     <tr id="q_call_answered">                         <th>call answered?</th>                         <td>                             <div class="radio-toolbar">                                 <%= f.radio_button :call_answered, true, class: 'call_answered_true' %>                                 <%= f.label :call_answered, "yes" %>                                 <%= f.radio_button :call_answered, false, class: 'call_answered_false' %>                                 <%= f.label :call_answered, "no" %>                             </div>                         </td>                     </tr>                     <tr id="why_not_answered" style="display:none;">                         <th>why wasn't answered?</th>                         <td>                             <%= f.select :why, options_for_select([["no answer", "n"], ["abandoned", "a"], ["after business hours", "h"]], @action.why), { include_blank: true } %>                         </td>                     </tr>                     <tr id="q_opportunity" style="display:none;">                         <th>was opportunity?</th>                         <td>                             <div class="radio-toolbar">                                 <%= f.radio_button :is_customer, true, class: 'opportunity_true' %>                                 <%= f.label :is_customer, "yes" %>                                 <%= f.radio_button :is_customer, false, class: 'opportunity_false' %>                                 <%= f.label :is_customer, "no" %>                             </div>                         </td>                     </tr>                     <tr id="opportunity_type" style="display:none;">                         <th>opportunity type</th>                         <td>                             <%= f.select :actiontype_id, options_from_collection_for_select(@actiontypes, 'id', 'action_type', @action.actiontype_id), { include_blank: true } %>                         </td>                     </tr>                     <tr id="reason_for_call" style="display:none;">                         <th>reason call</th>                         <td><%= f.select :category_id, options_from_collection_for_select(@categories, 'id', 'reason', @action.category_id), { include_blank: true }  %></td>                     </tr>                       <tr>                         <td>&nbsp;</td>                         <td><input type="submit" value="save" id="save" class="btn btn-success" /></td>                     </tr>                   </table> <% end %> 

the main problem here if have model named 'action', params default named in same way, collides actioncontroller default params. simplest solution is, guess, renaming model.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -