def index @posts = Post.search(params[:search], params[:page]) session.model.update_attribute(:viewing, "Home") end def save_requirement @post = Post.new(params[:post]) if @post.save params[:search] = @post.title redirect_to :action => :index end end the params[:search] from save_requirement doesn''t make it through the redirect, why is this? What can I do to make it work? Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Wed, Jul 30, 2008 at 2:51 PM, Justin To <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > def index > @posts = Post.search(params[:search], params[:page]) > session.model.update_attribute(:viewing, "Home") > end > > def save_requirement > @post = Post.new(params[:post]) > > if @post.save > params[:search] = @post.title > redirect_to :action => :index > end > > end > > the params[:search] from save_requirement doesn''t make it through the > redirect, why is this? What can I do to make it work?You need to include what ever parameters you want after the redirect in the redirect. redirect_to :action => :index, :search => params[:search]> Thanks! > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
this will fix it. if @post.save params[:search] = @post.title redirect_to :action => :index, :search => params[:search] end On Jul 30, 3:51 pm, Justin To <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> def index > @posts = Post.search(params[:search], params[:page]) > session.model.update_attribute(:viewing, "Home") > end > > def save_requirement > @post = Post.new(params[:post]) > > if @post.save > params[:search] = @post.title > redirect_to :action => :index > end > > end > > the params[:search] from save_requirement doesn''t make it through the > redirect, why is this? What can I do to make it work? > > Thanks! > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Use flash[:notice] = @post.title then in the view you can render the string contained in the flash. On Wed, Jul 30, 2008 at 12:51 PM, Justin To < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > def index > @posts = Post.search(params[:search], params[:page]) > session.model.update_attribute(:viewing, "Home") > end > > def save_requirement > @post = Post.new(params[:post]) > > if @post.save >-- http://www.rubyplus.org/ Free Ruby and Rails Screencasts --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christopher Kintner wrote:> On Wed, Jul 30, 2008 at 2:51 PM, Justin To > <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> params[:search] = @post.title >> redirect_to :action => :index >> end >> >> end >> >> the params[:search] from save_requirement doesn''t make it through the >> redirect, why is this? What can I do to make it work? > > You need to include what ever parameters you want after the redirect > in the redirect. > > redirect_to :action => :index, :search => params[:search]Great, thanks guys! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---