Hi, I was developping an application and everything was working properely, until I decided to migrate to RoR 2.0. I was using Scriptaculous to add new itens to a list using Highlight visual effect. But in RoR 2.0 when I press submit button in the form, only the partial is rendered to the browser, not the entire page, with the new item added with highlight effect. What should I do to correct this? Here the code: The partial: _area.html.erb <li id="area_<%= area.id %>"> <div class="nome_item"> <%= area.nome -%> </div> <small> <%= link_to "Editar", :action => "editar", :id => area.id %> <%= link_to_remote "[x]", :url=> {:action => "excluir", :id => area.id} %> </small> </li> The list in the mais view page: lista.html.erb ... <!-- Lista areas existentes --> <ul id="item_lista"> <%= render :partial => ''area/area'', :collection => @areas %> </ul> ... The criar.js.rjs: if @area.new_record? page.alert @area.errors.full_messages.join("\n") else page.insert_html :top, ''item_lista'', :partial => ''area'' page.visual_effect :highlight, "area_#{@area.id}" page.form.reset ''area_form'' end The controller: area_controller.rb ... def lista @areas = Area.find(:all, :conditions => ["conta_id = ?", session[:usuario].conta], :order => "id DESC") end def criar @area = Area.new(params[:area]) @area.conta = session[:usuario].conta if @area.save return if request.xhr? render :partial => ''area'', :object => @area else flash.now[:notice] = "Não deu certo. Tente novamente." render :controller => ''area'', :action => ''lista'' end end ... Thanks a lot. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, how did you migrate from Rails version X to Rails 2.0.2? For example, did you switch the Rails version information in the environment.rb? If this is the case, you''ll also need to update the configuration file by doing the following in the root of your rails application: rake rails:update Otherwise, please provide more detail as to what steps you performed to do the migration from Rails X to Rails 2.0.2. -Conrad On Thu, May 15, 2008 at 7:00 PM, Franklin <valadares-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, I was developping an application and everything was working > properely, until I decided to migrate to RoR 2.0. I was using > Scriptaculous to add new itens to a list using Highlight visual > effect. But in RoR 2.0 when I press submit button in the form, only > the partial is rendered to the browser, not the entire page, with the > new item added with highlight effect. What should I do to correct > this? > > Here the code: > > The partial: _area.html.erb > <li id="area_<%= area.id %>"> > <div class="nome_item"> > <%= area.nome -%> > </div> > <small> > <%= link_to "Editar", :action => "editar", :id => area.id %> > <%= link_to_remote "[x]", :url=> {:action => "excluir", :id => > area.id} %> > </small> > </li> > > The list in the mais view page: lista.html.erb > ... > <!-- Lista areas existentes --> > <ul id="item_lista"> > <%= render :partial => ''area/area'', :collection => @areas %> > </ul> > ... > > The criar.js.rjs: > if @area.new_record? > page.alert @area.errors.full_messages.join("\n") > else > page.insert_html :top, ''item_lista'', :partial => ''area'' > page.visual_effect :highlight, "area_#{@area.id}" > page.form.reset ''area_form'' > end > > The controller: area_controller.rb > ... > def lista > @areas = Area.find(:all, :conditions => ["conta_id = ?", > session[:usuario].conta], :order => "id DESC") > end > > def criar > @area = Area.new(params[:area]) > @area.conta = session[:usuario].conta > if @area.save > return if request.xhr? > render :partial => ''area'', :object => @area > else > flash.now[:notice] = "Não deu certo. Tente novamente." > render :controller => ''area'', :action => ''lista'' > end > end > ... > > Thanks a lot. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, I''ve unistalled Ruby, and reinstall everything from scracht. Ruby and gems. I created a new applicatinon, with the same name, and copied pages from models, controllers and views. (as well as plugins) After that, I modified every piece of code that was deprecated. Everything is working perfect, except Ajax effects. Thanks a lot. Franklin. On 18 maio, 11:21, "Conrad Taylor" <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, how did you migrate from Rails version X to Rails 2.0.2? For example, > did you switch the Rails version information in the environment.rb? If this > is the case, you''ll also need to update the configuration file by doing the > following in the root of your rails application: > rake rails:update > > Otherwise, please provide more detail as to what steps you performed to do > the migration from Rails X to Rails 2.0.2. > > -Conrad > > > > On Thu, May 15, 2008 at 7:00 PM, Franklin <valada...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, I was developping an application and everything was working > > properely, until I decided to migrate to RoR 2.0. I was using > > Scriptaculous to add new itens to a list using Highlight visual > > effect. But in RoR 2.0 when I press submit button in the form, only > > the partial is rendered to the browser, not the entire page, with the > > new item added with highlight effect. What should I do to correct > > this? > > > Here the code: > > > The partial: _area.html.erb > > <li id="area_<%= area.id %>"> > > <div class="nome_item"> > > <%= area.nome -%> > > </div> > > <small> > > <%= link_to "Editar", :action => "editar", :id => area.id %> > > <%= link_to_remote "[x]", :url=> {:action => "excluir", :id => > > area.id} %> > > </small> > > </li> > > > The list in the mais view page: lista.html.erb > > ... > > <!-- Lista areas existentes --> > > <ul id="item_lista"> > > <%= render :partial => ''area/area'', :collection => @areas %> > > </ul> > > ... > > > The criar.js.rjs: > > if @area.new_record? > > page.alert @area.errors.full_messages.join("\n") > > else > > page.insert_html :top, ''item_lista'', :partial => ''area'' > > page.visual_effect :highlight, "area...-Fk+srORLgIs@public.gmane.org}" > > page.form.reset ''area_form'' > > end > > > The controller: area_controller.rb > > ... > > def lista > > @areas = Area.find(:all, :conditions => ["conta_id = ?", > > session[:usuario].conta], :order => "id DESC") > > end > > > def criar > > @area = Area.new(params[:area]) > > -b+E81i5yoHt3BzW81kjnxQ@public.gmane.org = session[:usuario].conta > > if @area.save > > return if request.xhr? > > render :partial => ''area'', :object => @area > > else > > flash.now[:notice] = "Não deu certo. Tente novamente." > > render :controller => ''area'', :action => ''lista'' > > end > > end > > ... > > > Thanks a lot.- Ocultar texto entre aspas - > > - Mostrar texto entre aspas ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I realized I''ve migrated my forms to form_for, not for remote_form_for. :-S Now is everything fine. Thanks. On 19 maio, 10:27, Franklin <valada...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, I''ve unistalled Ruby, and reinstall everything from scracht. Ruby > and gems. > I created a new applicatinon, with the same name, and copied pages > from models, controllers and views. (as well as plugins) > After that, I modified every piece of code that was deprecated. > Everything is working perfect, except Ajax effects. > Thanks a lot. > Franklin. > > On 18 maio, 11:21, "Conrad Taylor" <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, how did you migrate from Rails version X to Rails 2.0.2? For example, > > did you switch the Rails version information in the environment.rb? If this > > is the case, you''ll also need to update the configuration file by doing the > > following in the root of your rails application: > > rake rails:update > > > Otherwise, please provide more detail as to what steps you performed to do > > the migration from Rails X to Rails 2.0.2. > > > -Conrad > > > On Thu, May 15, 2008 at 7:00 PM, Franklin <valada...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, I was developping an application and everything was working > > > properely, until I decided to migrate to RoR 2.0. I was using > > > Scriptaculous to add new itens to a list using Highlight visual > > > effect. But in RoR 2.0 when I press submit button in the form, only > > > the partial is rendered to the browser, not the entire page, with the > > > new item added with highlight effect. What should I do to correct > > > this? > > > > Here the code: > > > > The partial: _area.html.erb > > > <li id="area_<%= area.id %>"> > > > <div class="nome_item"> > > > <%= area.nome -%> > > > </div> > > > <small> > > > <%= link_to "Editar", :action => "editar", :id => area.id %> > > > <%= link_to_remote "[x]", :url=> {:action => "excluir", :id => > > > area.id} %> > > > </small> > > > </li> > > > > The list in the mais view page: lista.html.erb > > > ... > > > <!-- Lista areas existentes --> > > > <ul id="item_lista"> > > > <%= render :partial => ''area/area'', :collection => @areas %> > > > </ul> > > > ... > > > > The criar.js.rjs: > > > if @area.new_record? > > > page.alert @area.errors.full_messages.join("\n") > > > else > > > page.insert_html :top, ''item_lista'', :partial => ''area'' > > > page.visual_effect :highlight, "area...-Fk+srORLgIs@public.gmane.org}" > > > page.form.reset ''area_form'' > > > end > > > > The controller: area_controller.rb > > > ... > > > def lista > > > @areas = Area.find(:all, :conditions => ["conta_id = ?", > > > session[:usuario].conta], :order => "id DESC") > > > end > > > > def criar > > > @area = Area.new(params[:area]) > > > -b+E81i5yoHt3BzW81kjnxQ@public.gmane.org = session[:usuario].conta > > > if @area.save > > > return if request.xhr? > > > render :partial => ''area'', :object => @area > > > else > > > flash.now[:notice] = "Não deu certo. Tente novamente." > > > render :controller => ''area'', :action => ''lista'' > > > end > > > end > > > ... > > > > Thanks a lot.- Ocultar texto entre aspas - > > > - Mostrar texto entre aspas -- Ocultar texto entre aspas - > > - Mostrar texto entre aspas ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---