so you have a button that increments the number of packages, but the number of packages displayed does not update when the button is clicked to add another package?
give the element in which you write the number of packages an id, for example id=“<%= ‘wood’ + wood.id.to_s %>”.
then in your controller
def incrementing_function
wood = Wood.find(params[:wood_id]
wood.packages += 1
wood.save
render(update) do |page|
page.replace_html
“wood” + wood.id.to_s, :partial => ‘partial you mentioned’, :locals => {:wood => wood}
end
end
if you use the partial you mentioned to render the original number of packages then you will replace the partial with the same partial, populated with the updated wood object.
hope that helps, if not, elaborate on your problem and maybe someone else will be able to help.
Can you pls elaborate on your idea? How the current one is posting
twice?
Look observe_form() up.
Your current plan makes the user click their mouse on the check-box,
then click on the Submit button.
If you instead observe the form, it will post each time the user
changes it. In some usability contexts, such as voting, the post
should be instant. Consider the Rating button on Google Groups posts.
In other usability contexts, the users should make many changes and
send them all at once. That's what Submit buttons are for.