Displaying 3 results from an estimated 3 matches for "add_ingredient".
2010 Mar 11
4
Call a controller method from a view
...can have many
ingredients. So on my edit form there is a text_field where you type the
ingredient with a link "Add" which is supposed to add the typed
ingredient to the current ingredients list.
this is how i try to call my controller method:
<%=link_to "Add",:action => :add_ingredient,:id => @product %>
This is my method in the controller:
def add_ingredient
if @product.id.blank?
@product = Product.find(params[:id])
end
@product.ingredients <<
Ingredient.find_or_create_by_name(params[:search])
@product.update_attributes(params[:product])
en...
2006 Apr 14
11
Whats the best Ajax way to update a textarea''s text?
I am looking for a way to update the text-value within a textarea from
an Ajax render call inside of a controller. Is there a way to do this
without rendering an the partial containing the textarea?
Thanks,
Andy
--
Posted via http://www.ruby-forum.com/.
2006 Apr 20
0
Clearing text_field_tag -- Help PLEASE
...is that the entry <div> and everything above it on the page is getting wiped out. The code is below. Any ideas?
Thanks in advance,
Bill
--- Here''s _entry_form.rhtml ---
<%= form_remote_tag(:update => ''ingredient_list'',
:url => {:action => :add_ingredient},
:position => ''bottom'',
:after => {:action => :clear_entry}) %>
Name:
<%= text_field_tag :name %>
Amount:
<%= text_field_tag :qty %>
<%= submit_tag ''Add Ingredient'' %>
<%= end_form_tag %>
--...