I just wanted to ping this off the list to get some advice since I’m
now pulling my hair out. Thanks in advance for taking any time to look
at this. It’s much appreciated. Now, my problem is my RJS is working
but it’s not inserting how I want it to insert. I have a partial I’m
rendering in my view that looks like this:
- id="meal_names">
- <%= item.name %> <%= link_to "delete", { :controller => 'meal_names', :action => 'destroy', :id => item.id}, :confirm => "are you sure you want to delete #{ item.name}?" %> do |item| -%>
- <%= item.name %> <%= link_to "delete", { :controller => 'meal_names', :action => 'destroy', :id => item.id}, :confirm => "are you sure you want to delete #{ item.name}?" %>
- <%= item.name %> <%= link_to "delete", { :controller => 'meal_names', :action => 'destroy', :id => item.id}, :confirm => "are you sure you want to delete #{ item.name}?" %>
<% @meal_names.each do |item| -%>
<% end %>end %>
and this does give me a list of names but when i submit a new name, it
gets added to the list as just
so it doesn’t have the formatting or the delete button like the other
items. Whenm I refresh the page, then it looks proper. Here’s my
controller add method:
def add
@name = MealName.create( params[:meal_name] )
@meal_names = MealName.find(:all)
@meal_names << @name
render :update do |page|
page.insert_html :bottom, ‘meal_names’, "
page.visual_effect :highlight, ‘meal_names’, :duration => 3
end
end
I thought I could get around this by doing a @meal_names << @name and
that didn’t work. I’m thinking I’m just not doing this properly. Help!