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

Editable columns in table #4

Open
burtondav opened this issue Jan 11, 2013 · 4 comments
Open

Editable columns in table #4

burtondav opened this issue Jan 11, 2013 · 4 comments

Comments

@burtondav
Copy link

I'm trying to use a table created with an index do.
So the same column gets repeated in each row.
The first row is editable, the rest aren't.

Is there a way for me to fix this?

UPDATE - I see this is the same as the other issue

@tkawa
Copy link
Member

tkawa commented Jan 11, 2013

Would you show me the code (HTML) you wrote?

@burtondav
Copy link
Author

Sure,
I would appreciate the help!!

Cost Answers

<% @costproject.costdetails.each_with_index do |costdetail, i| %> <% if costdetail.contact_id != nil %> <% else %> <% end %> <% end %>
Question Answer Contact Submit Date
<%= costdetail.costline.line_name %> <%= textarea_format(costdetail.answer) %> <%= costdetail.contact.contact_full_name %><%= costdetail.submit_date %>

This is the js.coffee

$(document).ready ->
$(".costdetail_body").editable params: (params) ->
params[$(this).data("resource") + "[id]"] = $(this).data("id")
params

Thanks,
David Burton

On Jan 10, 2013, at 8:45 PM, Toru KAWAMURA [email protected] wrote:

Would you show me the code (HTML) you wrote?


Reply to this email directly or view it on GitHub.

@tkawa
Copy link
Member

tkawa commented Jan 11, 2013

Since this seems not to be "nested attributes" according to data-url="/costdetails/<%= costdetail.id %> ", please do not use the method of #1.
If it is "nested attributes", it should have written in this way.

class Costproject < ActiveRecord::Base
  accepts_nested_attributes_for :costdetails
end

@burtondav
Copy link
Author

Toru,
Thanks for the help!!
I'm sorry to be a bother.

I have changed my costproject model to contain accepts_nested_attributes_for :cost details

Now, when I edit a column, it adds a new record instead of replacing the one I'm trying to edit.

David Burton

On Jan 10, 2013, at 9:16 PM, Toru KAWAMURA [email protected] wrote:

Since this is not "nested attributes" according to data-url="/costdetails/<%= costdetail.id %> ", please do not use the method of #1.
If it is "nested attributes", it should have written in this way.

class Costproject < ActiveRecord::Base
accepts_nested_attributes_for :costdetails
end

Reply to this email directly or view it on GitHub.

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

2 participants