Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating nested attributes #1

Open
ingithub opened this issue Dec 23, 2012 · 3 comments
Open

Updating nested attributes #1

ingithub opened this issue Dec 23, 2012 · 3 comments

Comments

@ingithub
Copy link

Hi,

this gem is working great and nice tutorial how to implement it, but how can I update nested attributes?

Thanks

@ghost
Copy link

ghost commented Dec 24, 2012

How can I access to value? I need assign it to name:

%a{href: '#', class: "editable_#{post.id}", 'data-url' => post_path(post)}= post.name
:javascript
  $(".editable_#{post.id}").editable({
      type: 'text',
      title: 'Enter username',
      params: {
        post: {
          post_translations_attributes:{
            id: "#{post.translation.id}",
            name: 'This value'
          }
        }
      }
  });

@tkawa
Copy link
Member

tkawa commented Dec 25, 2012

Thank you for using!
I update the repo to enable to overwrite params yesterday. (not released yet)

With a head of the repo, how about this:

gem 'bootstrap-editable-rails', github: 'tkawa/bootstrap-editable-rails'
<% @member.posts.each_with_index do |post, i| %>
  <a href="#" class="post_body" data-type="text" data-resource="member[posts_attributes][<%= i %>]" data-id="<%= post.id %>" data-name="body" data-url="/members/1" data-original-title="Enter body">body</a>
<% end %>
$(".post_body").editable({
  params: function(params) { // for ovewrite params
    params[$(this).data('resource') + '[id]'] = $(this).data('id');
    return params;
  }
});

I'm going to think of a better spec for nested attributes.

@burtondav
Copy link

tkawa - I don't understand the status of this issue. Are we supposed to be able to use the above code to fix the issue of editable columns in tables? It doesn't fix it for me.

I used the code above. I now get a popup for every row. I can change the data. But, the record doesn't get changed in the database.

@bytheway875
Copy link

Hi! Was there ever a feature added that allowed for editing nested attributes? It's working great for everything but my nested attributes. :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants