Super inplace controls in_place_select displays incorrectly

Posted by Magicked on Stack Overflow See other posts from Stack Overflow or by Magicked
Published on 2010-05-13T18:38:04Z Indexed on 2010/05/13 18:44 UTC
Read the original article Hit count: 222

Filed under:

I'm using the super_inplace_controls plugin to allow users to edit fields on the "show" page. However, I'm running into an issue with the in_place_select function. Here is my view:

<p>
    <b>Status:</b>
    <%= in_place_select :incident, :incident_status, :choices => @statuses.map { |e| [e.name, e.id] } %>
</p>

This is in the 'Incident' view. IncidentStatus is a separate table that has_many Incidents. In the Incident controller, I retrieve @statuses like so:

@statuses = IncidentStatus.find(:all)

Everything works fine for the in_place_select, except the original display. In my browser, it shows:

Status:  #<IncidentStatus:0x1033147d8>

Which means it's not grabbing the current incident_status.name, but it's just changing the object to a string. I'm not sure how to fix this! When I click on the "IncidentStatus:0x1033147d8", everything works properly and I can select the proper fields.

Thanks for any help!

© Stack Overflow or respective owner

Related posts about ruby-on-rails