Rjs isn't update_page problems


#1

i have a list of, for example, meal_names. Basically, I can submit a
name
and the name I add shows up in the list.I had this working wehn i
created an
actual add.rjs template for it. So feeling good about my self, I
attempted
to move it all to the controller and use some update_page goodness. Now
it
the ajax middle doesn’t happen. I don’t get any errors but the list
doesn’t
update unless I refresh the page. I am not on edge rails (since it broke
my
app) but I am running cody’s RJS plug-in which I believe supports this
behavior. Can anyone provide me any insight into what it’s not working?
It
would be much appreciated. Here’s my view:

meal name: <%= text_field ‘meal_name’, ‘name’ %>
<%= submit_tag ‘Add’ %>
<%= end_form_tag %>

    <% @meal_names.each do |meal_name| -%>
  • <%= meal_name.name %> <%= link_to "delete", { :controller => 'meal_names', :action => 'destroy', :id => meal_name.id}, :confirm => "are you sure you want to delete #{meal_name.name}?" %>
  • <% end -%>

and in my controller

def add
@name = MealName.new
if request.post?
@name = MealName.create( params[:meal_name] )
update_page do |page|
page.insert_html :bottom, ‘name_list’, “

  • #{@name.name}

  • page.visual_effect :highlight, ‘name_list’
        end
    
    end
    

    end


    #2

    Curtis,

    Try changing your call to update_page to:

    render :update do |page|
    page.insert_html :bottom, ‘name_list’, “

  • #{@name.name}

  • page.visual_effect :highlight, ‘name_list’
    end

    Also note that a lot of bleeding edge RJS features are not yet
    available in the plugin, so you may want to try getting Edge working.

    On 3/3/06, Curtis E. removed_email_address@domain.invalid wrote:

    :controller => ‘meal_names’, :action => ‘destroy’, :id => meal_name.id},
    if request.post?
    Rails mailing list
    removed_email_address@domain.invalid
    http://lists.rubyonrails.org/mailman/listinfo/rails


    Cody F.
    http://www.codyfauser.com