Sha256: 8ed9b9b4dd74cf21ff153e84b979725a5ec456a92b5411c782c9de4d3c2e3133
Contents?: true
Size: 937 Bytes
Versions: 9
Compression:
Stored size: 937 Bytes
Contents
module Responders # This responder modifies your current responder to redirect # to the collection page on POST/PUT/DELETE. module CollectionResponder protected # Returns the collection location for redirecting after POST/PUT/DELETE. # This method, converts the following resources array to the following: # # [:admin, @post] #=> [:admin, :posts] # [@user, @post] #=> [@user, :posts] # # When these new arrays are given to redirect_to, it will generate the # proper URL pointing to the index action. # # [:admin, @post] #=> admin_posts_url # [@user, @post] #=> user_posts_url(@user.to_param) # def navigation_location return options[:location] if options[:location] klass = resources.last.class if klass.respond_to?(:model_name) resources[0...-1] << klass.model_name.plural.to_sym else resources end end end end
Version data entries
9 entries across 9 versions & 1 rubygems