Reputation: 638
i installed a x-editable-rails demo, that is possíble to find here:
https://github.com/diogowernik/x_editable_rails_demo
It works fine in the index view (site.com/articles) it is possible to edit title and description
but i would like also to have it active in the show view (Ex: site.com/articles/1, articles/2, etc..)
in the index view, that is the code:
<td><%= editable article, :title %></td>
<td><%= editable article, :content, type: "textarea" %></td>
in the show view, that is the code:
<h3> <%= @article.title %> </h3>
<p> <%= @article.content %> </p>
I tryed without success some thing like that:
<h3> <%= editable article, @article.title %> </h3>
<p> <%= editable article, @article.content %> </p>
i get this error
NameError in Articles#show
thank a lot
Upvotes: 0
Views: 500
Reputation: 638
After while i found the answer:
in the show view that is the sintaxe:
<h3> <%= editable @article, :title %> </h3>
<p> <%= editable @article, :content" %> </p>
the github link is just updated with this sample working, for those who want to check it:
https://github.com/diogowernik/x_editable_rails_demo
Upvotes: 1