I''m trying to set up my RESTful controllers to allow public reading of
data
only when they are requesting XML. I''m using acts_as_authenticated for
my
authentication, and am basically trying to do something like this:
class MyController < AC
before_filter :login_required do |controller|
true if controller.params[:format] == ''xml''
end
def index
@models = Model.find(:all)
respond_to do |wants|
wants.html { render :nothing => true }
wants.js { render :partial => ''index'' }
wants.xml { render :xml => @models.to_xml }
end
end
end
Should I just make the whole action public or is there a proper way of doing
this?
Thanks
Jason
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---