bootstrap-ruby / bootstrap-editable-rails

In-place editing with Twitter Bootstrap for Rails
http://rubygems.org/gems/bootstrap-editable-rails
MIT License
216 stars 52 forks source link

Rails4 strong parameter issue #28

Closed burtondav closed 8 years ago

burtondav commented 8 years ago

I'm trying to use the type=select in Rails4. But, I'm getting an error in the strong parameters code.

This is the accessory view code:

<td>
  <a href="#" class="xeditable" data-emptytext="Type" data-type="select" data-pk="1" data-resource="accessories" data-source="/accessorytypes" data-name="accessorytype_id" data-url="/accessories/<%= accessory.id %>" data-original-title="Select Type">
    <%= accessory.accessorytype.name if accessory.accessorytype_id != nil %>
  </a>

This is the javascript (coffee) and it works for type=text

$(".xeditable").editable
    placement: 'bottom'

This is the error:

ActionController::ParameterMissing at /accessories/5
====================================================

> param is missing or the value is empty: accessory

app/controllers/accessories_controller.rb, line 88

This is line 88 (strong parameter):

 params.require(:accessory).permit(:user_id, :manufacturer,:manufacture_year, :model, :accessorytype_id, :description, :sold, :count, :bow_id, :note, :sold_id, :archive)
burtondav commented 8 years ago

I had to change:

From: data-resource="accessories"

To: data-resource="accessory"

On Fri, Apr 29, 2016 at 12:47 AM, Sambhav Sharma notifications@github.com wrote:

Hi, did you solve this issue?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/bootstrap-ruby/bootstrap-editable-rails/issues/28#issuecomment-215639077

Regards, David Burton

burtondav commented 8 years ago

I had to change:

From: data-resource="accessories" To: data-resource="accessory"