Hey everyone, I''m having a really difficult time displaying flash[:notice]. I''m setting it inside one of my controllers and it appears fine inside a template rhtml file, but when I try to display it from layout rhtml it doesn''t appear at all. I''m using flash.inspect in both the layout and in a template. In the layout, nothing appears. In the template I see my notice just fine. The funny (or frustrating) thing is, displaying a notice works fine from other controllers using similar code where I''m doing a redirect as well. Any pointers would be helpful. Thanks. -- seth at subimage interactive http://www.subimage.com/sublog/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Does your controller use that layout file? Is the layout displayed at all? On 9/14/05, subimage interactive <subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hey everyone, > > I''m having a really difficult time displaying flash[:notice]. I''m setting > it inside one of my controllers and it appears fine inside a template rhtml > file, but when I try to display it from layout rhtml it doesn''t appear at > all. > > I''m using flash.inspect in both the layout and in a template. In the > layout, nothing appears. In the template I see my notice just fine. > > The funny (or frustrating) thing is, displaying a notice works fine from > other controllers using similar code where I''m doing a redirect as well. > > Any pointers would be helpful. Thanks. > > -- > seth at subimage interactive > http://www.subimage.com/sublog/ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Yes, it would be pretty stupid of me if it weren''t displayed ;) To clarify, I can output flash.inspect in 2 places, the layout AND the template _at the same time_. It''ll be empty in the layout but the expected value in the template. Make more sense? On 9/14/05, Bogdan Ionescu <bogdan.ionescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Does your controller use that layout file? Is the layout displayed at all? > > > > On 9/14/05, subimage interactive <subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hey everyone, > > > > I''m having a really difficult time displaying flash[:notice]. I''m > > setting it inside one of my controllers and it appears fine inside a > > template rhtml file, but when I try to display it from layout rhtml it > > doesn''t appear at all. > > > > I''m using flash.inspect in both the layout and in a template. In the > > layout, nothing appears. In the template I see my notice just fine. > > > > The funny (or frustrating) thing is, displaying a notice works fine from > > other controllers using similar code where I''m doing a redirect as well. > > > > Any pointers would be helpful. Thanks. > > > > -- > > seth at subimage interactive > > http://www.subimage.com/sublog/ > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > >-- seth at subimage interactive http://www.subimage.com/sublog/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
If you call render_component it will erase the flash. Try printing the flash at the top of you layout and see if it works. If it does, a workaround is to store the flash to a temporary variable: <% @myflash = flash[:notice] %> Then just refer to @myflash throughout your layout. If that is not your problem.. then I am out of ideas :) Tom On 9/14/05, subimage interactive <subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Yes, it would be pretty stupid of me if it weren''t displayed ;) To clarify, > I can output flash.inspect in 2 places, the layout AND the template _at the > same time_. It''ll be empty in the layout but the expected value in the > template. Make more sense? > > On 9/14/05, Bogdan Ionescu <bogdan.ionescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > Does your controller use that layout file? Is the layout displayed at all? > > > > > > > > > > > > > > On 9/14/05, subimage interactive < subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hey everyone, > > > > > > I''m having a really difficult time displaying flash[:notice]. I''m > setting it inside one of my controllers and it appears fine inside a > template rhtml file, but when I try to display it from layout rhtml it > doesn''t appear at all. > > > > > > I''m using flash.inspect in both the layout and in a template. In the > layout, nothing appears. In the template I see my notice just fine. > > > > > > The funny (or frustrating) thing is, displaying a notice works fine from > other controllers using similar code where I''m doing a redirect as well. > > > > > > Any pointers would be helpful. Thanks. > > > > > > -- > > > seth at subimage interactive > > > http://www.subimage.com/sublog/ > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > -- > seth at subimage interactive > http://www.subimage.com/sublog/ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
I am rendering a component...many actually. That''s a gotcha I didn''t see coming. On the subject, is it possible to pass parameters using render_component? On 9/14/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > If you call render_component it will erase the flash. Try printing > the flash at the top of you layout and see if it works. If it does, a > workaround is to store the flash to a temporary variable: > > <% @myflash = flash[:notice] %> > > Then just refer to @myflash throughout your layout. > > If that is not your problem.. then I am out of ideas :) > > Tom > > On 9/14/05, subimage interactive <subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Yes, it would be pretty stupid of me if it weren''t displayed ;) To > clarify, > > I can output flash.inspect in 2 places, the layout AND the template _at > the > > same time_. It''ll be empty in the layout but the expected value in the > > template. Make more sense? > > > > On 9/14/05, Bogdan Ionescu <bogdan.ionescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > Does your controller use that layout file? Is the layout displayed at > all? > > > > > > > > > > > > > > > > > > > > > On 9/14/05, subimage interactive < subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Hey everyone, > > > > > > > > I''m having a really difficult time displaying flash[:notice]. I''m > > setting it inside one of my controllers and it appears fine inside a > > template rhtml file, but when I try to display it from layout rhtml it > > doesn''t appear at all. > > > > > > > > I''m using flash.inspect in both the layout and in a template. In the > > layout, nothing appears. In the template I see my notice just fine. > > > > > > > > The funny (or frustrating) thing is, displaying a notice works fine > from > > other controllers using similar code where I''m doing a redirect as well. > > > > > > > > Any pointers would be helpful. Thanks. > > > > > > > > -- > > > > seth at subimage interactive > > > > http://www.subimage.com/sublog/ > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > seth at subimage interactive > > http://www.subimage.com/sublog/ > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > >-- seth at subimage interactive http://www.subimage.com/sublog/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 15.9.2005, at 5.03, subimage interactive wrote:> I am rendering a component...many actually. That''s a gotcha I > didn''t see coming. > > On the subject, is it possible to pass parameters using > render_component?Yes [1]. //jarkko [1] http://rails.rubyonrails.com/classes/ActionController/ Components.html#M000036> > On 9/14/05, Tom Davies <atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote:If you call > render_component it will erase the flash. Try printing > the flash at the top of you layout and see if it works. If it does, a > workaround is to store the flash to a temporary variable: > > <% @myflash = flash[:notice] %> > > Then just refer to @myflash throughout your layout. > > If that is not your problem.. then I am out of ideas :) > > Tom > > On 9/14/05, subimage interactive <subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Yes, it would be pretty stupid of me if it weren''t displayed ;) > To clarify, > > I can output flash.inspect in 2 places, the layout AND the > template _at the > > same time_. It''ll be empty in the layout but the expected value > in the > > template. Make more sense? > > > > On 9/14/05, Bogdan Ionescu < bogdan.ionescu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > Does your controller use that layout file? Is the layout > displayed at all? > > > > > > > > > > > > > > > > > > > > > On 9/14/05, subimage interactive < subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Hey everyone, > > > > > > > > I''m having a really difficult time displaying flash[:notice]. > I''m > > setting it inside one of my controllers and it appears fine inside a > > template rhtml file, but when I try to display it from layout > rhtml it > > doesn''t appear at all. > > > > > > > > I''m using flash.inspect in both the layout and in a template. > In the > > layout, nothing appears. In the template I see my notice just fine. > > > > > > > > The funny (or frustrating) thing is, displaying a notice > works fine from > > other controllers using similar code where I''m doing a redirect > as well. > > > > > > > > Any pointers would be helpful. Thanks. > > > > > > > > -- > > > > seth at subimage interactive > > > > http://www.subimage.com/sublog/ > > > > > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > seth at subimage interactive > > http://www.subimage.com/sublog/ > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > -- > seth at subimage interactive > http://www.subimage.com/sublog/ > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
* On Sep 14 11:56, Tom Davies (atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) wrote:> If you call render_component it will erase the flash. Try printing > the flash at the top of you layout and see if it works. If it does, a > workaround is to store the flash to a temporary variable: > > <% @myflash = flash[:notice] %> > > Then just refer to @myflash throughout your layout.Unfortunately I''m having the same problem, and this doesn''t fix it. Neither does the workaround in ticket 1858. I can get the flash to work part of the time - on simple actions. If the controller just sets up variables for the template/layout, the flash works fine as long as I use one of the workarounds. (I render about 4 components in the layout, so I need the workaround.) However, I really need it to work in a slightly more complicated spot. In this action, the controller checks if the request is a post, and if so, does a bit of work with a few model objects, saves the parent model, and redirects to another action. That action cannot see the flash no matter what I do. I tried adding flash.keep statements to the models that are being interacted with, but they don''t know about flash, so I''m not sure where it''s being wiped. Even if I save the flash to a local variable in the layout, it''s empty, so it''s being wiped out before the layout stage. Any ideas? I''m new to all this, if you couldn''t tell. Thanks, Tom _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Tom, The flash should remain until either a redirect or another render is called. If it is disappearing, my guess would be that a render or redirect is clearing it. I would try to reduce the problem down to the smallest amount of code. For example, try just setting the flash in your action and remove all of your business logic, such as your model updating. Also, change your layout and view to do nothing but render the flash. If that works, then start adding things back in one by one to see which one is causing the problem. If that wasn''t helpful, you can try posting more details about the problem and someone may be able to help you out. Good Luck. Tom On 9/17/05, Thomas Kirchner <lists-AwGSwOOX2Udg9hUCZPvPmw@public.gmane.org> wrote:> * On Sep 14 11:56, Tom Davies (atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) wrote: > > If you call render_component it will erase the flash. Try printing > > the flash at the top of you layout and see if it works. If it does, a > > workaround is to store the flash to a temporary variable: > > > > <% @myflash = flash[:notice] %> > > > > Then just refer to @myflash throughout your layout. > > Unfortunately I''m having the same problem, and this doesn''t fix it. > Neither does the workaround in ticket 1858. I can get the flash to work > part of the time - on simple actions. > > If the controller just sets up variables for the template/layout, the > flash works fine as long as I use one of the workarounds. (I render > about 4 components in the layout, so I need the workaround.) > > However, I really need it to work in a slightly more complicated spot. > In this action, the controller checks if the request is a post, and if > so, does a bit of work with a few model objects, saves the parent model, > and redirects to another action. That action cannot see the flash no > matter what I do. I tried adding flash.keep statements to the models > that are being interacted with, but they don''t know about flash, so I''m > not sure where it''s being wiped. > > Even if I save the flash to a local variable in the layout, it''s empty, > so it''s being wiped out before the layout stage. Any ideas? I''m new to > all this, if you couldn''t tell. > > Thanks, > Tom > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >
* On Sep 17 22:41, Tom Davies (atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) wrote:> The flash should remain until either a redirect or another render is > called. If it is disappearing, my guess would be that a render or > redirect is clearing it.As an update - I hacked my way around the problem by putting some flash-displaying code in the specific action that I needed it. Not ideal, but it works for now. And as for a permanent solution, ticket 2291 at http://dev.rubyonrails.org/ticket/2291 seems to be progressing nicely, so we may have a fix soon! Tom _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Any update on this? Has this made it into a build yet? On 9/25/05, Thomas Kirchner <lists-AwGSwOOX2Udg9hUCZPvPmw@public.gmane.org> wrote:> > * On Sep 17 22:41, Tom Davies (atomgiant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) wrote: > > The flash should remain until either a redirect or another render is > > called. If it is disappearing, my guess would be that a render or > > redirect is clearing it. > > As an update - I hacked my way around the problem by putting some > flash-displaying code in the specific action that I needed it. Not > ideal, but it works for now. > > And as for a permanent solution, ticket 2291 at > http://dev.rubyonrails.org/ticket/2291 > seems to be progressing nicely, so we may have a fix soon! > > Tom > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- seth at subimage interactive http://www.subimage.com/sublog/ _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
* On Sep 28 20:53, subimage interactive (subimage-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org) wrote:> Any update on this? Has this made it into a build yet?Not into an official rails release, but it''s fixed in SVN. It should (hopefully) be in the next release. Don''t hold me to that, but I did see the fix in trac. Tom _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails