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

How do you use the type = select #10

Closed burtondav closed 11 years ago

burtondav commented 11 years ago

I'm trying to use the type = select

The field pops up and there is a select box, but the values don't show up.

The Task record has a foreign key = rating_id and the value I want to show from the rating table is = ratingname

This is my view code:

      <a href="#" class="answer" data-type="select" data-placement="right" data-resource="task" data-source="/ratings" data-name="ratingname" data-url="/tasks/<%= task.id %>" data-original-title="Select Rating">
        <%= textarea_format(task.rating.ratingname) %>
      </a>
burtondav commented 11 years ago

error pic I've almost got it to work.

My RABL:

object @rating
attributes :ratingname => :text, :id => :value

I get the ratingname as the dropdown list ! I have the following happen when a value is selected !!

UPDATE "tasks" SET "rating_id" = 2, "updated_at" = '2013-03-28 08:21:36.869872' WHERE "tasks"."id" = 36

So, the dropdown list is good, the update is good.

BUT, the popup box with the rating select list turns red and doesn't go away! And there are no errors in the browser console.

burtondav commented 11 years ago

Made it work. I had to change the controller for tasks in the update section.

From: format.json { head :ok } To: format.json { render json: @task }

burtondav commented 11 years ago

all done