Skip to content
This repository was archived by the owner on Aug 21, 2019. It is now read-only.
This repository was archived by the owner on Aug 21, 2019. It is now read-only.

Use with a not yet saved object #13

@duffyjp

Description

@duffyjp

I'm trying to use the editable_field method with a new object. I've setup my controller/routes to handle it, and it works fine except for one gotcha. I'm using "Tagging.new" for the object passed to editable_field, and since it doesn't have an id, the "data-id" in the span and jquery line is blank. So when I list a bunch of editable_fields on the same page, only the first one is POSTed to. The new Tagging object I'm using isn't actually saved, so I thought throwing some other value into it's id would be a work around, but you can't actually do that, as it's restricted.

Could the "data-id" be something available in the options hash, akin to the :update_url? My understanding is that it doesn't actually matter what the data-id is, so long as it's unique to the object on the page.

I'll play around with it myself, but I thought I'd throw that out there to see what you think. Maybe the data-id does more than I realize.

For the sake of example, here is my call to editable_field:

editable_field Tagging.new, :tag_id, :type => 'select', :data => @tags_json, :update_url => person_taggings_path(person), :method => 'POST', :onblur => 'submit'

My controller then creates a new Tagging with the person_id and tag_id sent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions