ruby on rails - Params hash element sent from form is nil in the controller -
i have table called part columns "mp3_link", "caption", "translation", "position", , "lesson_id".
"position" refers order of part instance in list of part instances.
i created edit view part model, above attributes can changed. includes "position" attribute:
<div class="control-group"> <%= f.label :position, class: 'control-label' %> <div class="controls"> <%= f.text_field :position %> </div> </div>
the problem in update controller, code part_params[:position] gives me nil.
i used "debug params" see content of hash. "position" element has value (in case '4'):
mp3_link: https://w.soundcloud.com caption: 不借認這多把樣去利是 translation: non eaque natus aliquid @ rerum sequi quibusdam necessitatibus doloribus position: '4' commit: save action: update controller: parts id: '5'
so "position" value being sent form, reason, in update controller, part_params[:position] gives me nothing. can see printing out in update view.
in controller:
@out = part_params[:position]
in view:
<%= @out %>
nothing prints out. when try element of hash, example
@out = part_params[:mp3_link]
then works fine.
going on here?
Comments
Post a Comment