Hello! I am having some problems with flash[:notice]. In fact, in my code, I use flash[:error] for showing errors messages and flash[:notice] for showing other messages. All flash errors are correctly displayed, however flash notices are never displayed. The code is the same for both of them: - on the controller I have for example: if create_asset flash[:notice] = ''Asset was successfully created.'' else flash[:error] = ''There were some problems on the creation of the asset.'' end - then, on the view I have: - if (flash[:notice]) #noticebox = flash[:notice] - elsif (flash[:error]) #errorbox = flash[:error] Did someone have the same problem? Could you help me? Thank you, Amagoia. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
there is no reason that the flash display the notice but not the error. maybe it''s your div ''errorbox'' isn''t displayed. try this in your page to check if flash have values : - flash.each do |key,value| = key.to_s + ''=>'' + value.to_s (i''m not sure about haml synthax) you will see something like : notice=>Asset was successfully created. or error=>There were some problems on the creation of the asset. On Nov 9, 3:47 pm, amagoia <amagoi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello! > > I am having some problems with flash[:notice]. > > In fact, in my code, I use flash[:error] for showing errors messages > and flash[:notice] for showing other messages. > > All flash errors are correctly displayed, however flash notices are > never displayed. The code is the same for both of them: > > - on the controller I have for example: > > if create_asset > flash[:notice] = ''Asset was successfully created.'' > else > flash[:error] = ''There were some problems on the creation of the > asset.'' > end > > - then, on the view I have: > > - if (flash[:notice]) > #noticebox > = flash[:notice] > - elsif (flash[:error]) > #errorbox > = flash[:error] > > Did someone have the same problem? Could you help me? > > Thank you, > > Amagoia.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you for your answer. It seems that flash[:notice] has no values. Because the div ''errorbox'' is working fine. And when I try with your code I have no value for the flash notices. However, I have no problem with flash errors and warnings. Although I do the same way for errors, warnings and notices, it seems that the problem is only with the notices. amagoia On Nov 9, 5:50 pm, Jean-Sébastien <jeansebastien....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> there is no reason that the flash display the notice but not the > error. maybe it''s your div ''errorbox'' isn''t displayed. try this in > your page to check if flash have values : > > - flash.each do |key,value| > = key.to_s + ''=>'' + value.to_s > (i''m not sure about haml synthax) > > you will see something like : > notice=>Asset was successfully created. > or > error=>There were some problems on the creation of the asset. > > On Nov 9, 3:47 pm, amagoia <amagoi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello! > > > I am having some problems with flash[:notice]. > > > In fact, in my code, I use flash[:error] for showing errors messages > > and flash[:notice] for showing other messages. > > > All flash errors are correctly displayed, however flash notices are > > never displayed. The code is the same for both of them: > > > - on the controller I have for example: > > > if create_asset > > flash[:notice] = ''Asset was successfully created.'' > > else > > flash[:error] = ''There were some problems on the creation of the > > asset.'' > > end > > > - then, on the view I have: > > > - if (flash[:notice]) > > #noticebox > > = flash[:notice] > > - elsif (flash[:error]) > > #errorbox > > = flash[:error] > > > Did someone have the same problem? Could you help me? > > > Thank you, > > > Amagoia.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Nov 12, 2007, at 9:57 AM, amagoia wrote:> Because the div ''errorbox'' is working fine. And when I try with your > code I have no value for the flash notices. However, I have no problem > with flash errors and warnings. Although I do the same way for errors, > warnings and notices, it seems that the problem is only with the > notices.Flash is kind of a hash table, the name of the keys (:notice, :error, ...) is not important to how it works, you can pass messages to the user with :foo instead of :notice. You surely have a logic flaw somewhere. You know that flash[:key] evaluates to what you expect in the _next_ request right? Normally there''s a redirection in between. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you. Yes I think I will change the key of the flash hash table. Instead of using the key "notice" I will use another one. amagoia. On Nov 12, 1:08 pm, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> On Nov 12, 2007, at 9:57 AM, amagoia wrote: > > > Because the div ''errorbox'' is working fine. And when I try with your > > code I have no value for the flash notices. However, I have no problem > > with flash errors and warnings. Although I do the same way for errors, > > warnings and notices, it seems that the problem is only with the > > notices. > > Flash is kind of a hash table, the name of the keys > (:notice, :error, ...) is not important to how it works, you can pass > messages to the user with :foo instead of :notice. > > You surely have a logic flaw somewhere. You know that flash[:key] > evaluates to what you expect in the _next_ request right? Normally > there''s a redirection in between. > > -- fxn--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---