In the controller method I have the following: def create @adv = Adv.new(params[:adv]) @adv.save flash[:notice] = "Advertisement successfully created" redirect_to "/advs/#{@adv.id}" end When I create a new "Adv", I DON''T get the message: "Advertisement successfully created" Why is that? What am I missing? 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 21 August 2010 18:35, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> In the controller method I have the following: > > def create > @adv = Adv.new(params[:adv]) > -Zw6Gjz2lNIw@public.gmane.org > flash[:notice] = "Advertisement successfully created" > redirect_to "/advs/#{@adv.id}"The code here is setting up the flash but you have to have code in the view to display it. What have you got in the view that you are showing after the redirect? Colin> end > > When I create a new "Adv", I DON''T get the message: "Advertisement > successfully created" > > Why is that? What am I missing? > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
ajey.potdar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2010-Aug-22 08:08 UTC
Re: Flash message doesn''t show up
In View have you added <%= flash[:notice] %> and <%= javascript_include_tag :defaults %> On Aug 21, 10:35 pm, Abder-Rahman Ali <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> In the controller method I have the following: > > def create > @adv = Adv.new(params[:adv]) > @adv.save > flash[:notice] = "Advertisement successfully created" > redirect_to "/advs...-iu9cO5vkjMY@public.gmane.org}" > end > > When I create a new "Adv", I DON''T get the message: "Advertisement > successfully created" > > Why is that? What am I missing? > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Thanks a lot everyone. You are correct: Yes, I have added "<%= flash[:notice] %>" in "application.html.erb" I just want to ask, how can we make that notice with a different color and background? Should we do this manually by HTML for example? 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Aug 22, 2010 at 8:26 AM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I just want to ask, how can we make that notice with a different color > and background? Should we do this manually by HTML for example?Change the values in the selector in application.css HTH, Bill -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bill Walton wrote:> On Sun, Aug 22, 2010 at 8:26 AM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> I just want to ask, how can we make that notice with a different color >> and background? Should we do this manually by HTML for example? > > Change the values in the selector in application.css > > HTH, > BillI made some changes in "application.html.erb" as follows: <font face="verdana" color="green" ><%= flash[:notice] %></font> And it did what I was looking for. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Aug 22, 2010 at 9:21 AM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Bill Walton wrote: >> On Sun, Aug 22, 2010 at 8:26 AM, Abder-Rahman Ali <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> >> wrote: >>> I just want to ask, how can we make that notice with a different color >>> and background? Should we do this manually by HTML for example? >> >> Change the values in the selector in application.css >> >> HTH, >> Bill > > I made some changes in "application.html.erb" as follows: > > <font face="verdana" color="green" ><%= flash[:notice] %></font> > > And it did what I was looking for.Inline styling will certainly work but it has very much fallen out of favor. You will do yourself a favor, professional reputation-wise, by learning to use css selectors. Best regards, Bill -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.