Is there a reason why my @flash[:notice] has something set in my actions view but not the main layout file? Seems a little awkward for me. This means I can''t display @flash[:notice] in my application.rhtml layout file. Am I missing something here?
On May 28, 2005, at 9:01 AM, John Kopanas wrote:> Is there a reason why my @flash[:notice] has something set in my > actions view but not the main layout file? Seems a little awkward > for me. This means I can''t display @flash[:notice] in my > application.rhtml layout file. Am I missing something here?Putting @flash[:notice] in your layout is a common approach. It should work fine. What does your controller code and layout rhtml look like? Duane Johnson (canadaduane) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
from layout/application.rhtml: <% if @flash[:notice] %> <div id="notice"><%= @flash[:notice] %></div> <% end %> from controller: flash[:notice] = "Been added to your list." Doesn''t this make sense? When I put what is in application.rhtml into my controllers view it works. When I put in both I only see it in controller. On 28-May-05, at 11:27 AM, Duane Johnson wrote:> > On May 28, 2005, at 9:01 AM, John Kopanas wrote: > >> Is there a reason why my @flash[:notice] has something set in my >> actions view but not the main layout file? Seems a little awkward >> for me. This means I can''t display @flash[:notice] in my >> application.rhtml layout file. Am I missing something here? > > Putting @flash[:notice] in your layout is a common approach. It > should work fine. What does your controller code and layout rhtml > look like? > > Duane Johnson > (canadaduane) > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 5/28/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote:> When I put what is in application.rhtml into my controllers view it > works. When I put in both I only see it in controller.What happens if you only put it in the layout? -- Regards, John Wilger ----------- Alice came to a fork in the road. "Which road do I take?" she asked. "Where do you want to go?" responded the Cheshire cat. "I don''t know," Alice answered. "Then," said the cat, "it doesn''t matter." - Lewis Carrol, Alice in Wonderland
Are you using a redirect_to to get to the page that shows the message? If not, you should be using flash.now[:notice] instead. Could that be it?> Doesn''t this make sense?Yes, it does. I don''t see any problem there. Very strange. Duane Johnson (canadaduane) _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Does not display... On 28-May-05, at 11:43 AM, John Wilger wrote:> On 5/28/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote: > >> When I put what is in application.rhtml into my controllers view it >> works. When I put in both I only see it in controller. >> > > What happens if you only put it in the layout? > > -- > Regards, > John Wilger > > ----------- > Alice came to a fork in the road. "Which road do I take?" she asked. > "Where do you want to go?" responded the Cheshire cat. > "I don''t know," Alice answered. > "Then," said the cat, "it doesn''t matter." > - Lewis Carrol, Alice in Wonderland > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Yes I am using a redirect_to: redirect_to :controller => "looking_for", :id => @params[''id''] On 28-May-05, at 11:44 AM, Duane Johnson wrote:> Are you using a redirect_to to get to the page that shows the > message? If not, you should be using flash.now[:notice] instead. > Could that be it? > >> Doesn''t this make sense? > > Yes, it does. I don''t see any problem there. Very strange. > > Duane Johnson > (canadaduane) > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >