I''m using some standard Rails Resource controllers and on a new
resource creation you''ll see something like
respond_to do |format|
if @company.save
flash[:notice] = ''Company was successfully created.''
format.html { redirect_to(@company) }
format.xml { render :xml => @company, :status
=> :created, :location => @company }
else
format.html { render :action => "new" }
format.xml { render :xml => @company.errors, :status
=> :unprocessable_entity }
end
end
Now I''m starting to add some AJAX stuff in the dashboard of the
application and want to add a `format.js` to that list. This has me
thinking...
Shouldn''t the flash[:notice] be inside the html block. Why is this the
default? I''m pretty sure you don''t want to set the flash when
we are
dealing with XML requests. Similarly most xhr requests will deal with
notification in their own way (Yellow fade effect, and so on.)
I''m just curious as to why this is the default and see how other
people edit/use this in similar cases.
~ Mike
--
Michael Zornek
Clickable Bliss
http://clickablebliss.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
-~----------~----~----~----~------~----~------~--~---