> --
> You received this message because you are subscribed to the Google Groups "ObjectiveResource" group.
> To post to this group, send email to objectiv...@googlegroups.com.
> To unsubscribe from this group, send email to objectiveresou...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/objectiveresource?hl=en.
>
class SongsController < ActionController
before_filter :assign_songs, :only => :index
def index
end
private
def assign_songs
@songs = Song.all
end
end
class Api::SongsController < SongsController
def index
respond_to do |format|
format.json { render :json => @songs }
format.xml { render :xml => @songs }
end
end
end
This makes it easier to separate your tests. It also allows you to extend the controller, if you need extra or different logic in your web service than you have in your existing controller.
Hope this helps.
-Aubrey