Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1299602
location_responder.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 18, 11:42 PM
Size
791 B
Mime Type
text/x-ruby
Expires
Thu, Nov 20, 11:42 PM (6 h, 26 m)
Engine
blob
Format
Raw Data
Handle
292767
Attached To
rWEBDNS WebDNS (edet4)
location_responder.rb
View Options
module
Responders
# Responder to accept callable objects as the redirect location.
# Useful when you want to use the <tt>respond_with</tt> method with
# a route that requires persisted objects, but the validation may fail.
#
# class ThingsController < ApplicationController
# responders :location, :flash
# respond_to :html
#
# def create
# @thing = Things.create(params[:thing])
# respond_with @thing, location: -> { thing_path(@thing) }
# end
# end
#
module
LocationResponder
def
initialize
(
controller
,
resources
,
options
=
{})
super
if
options
[
:location
].
respond_to?
(
:call
)
location
=
options
.
delete
(
:location
)
options
[
:location
]
=
location
.
call
unless
has_errors?
end
end
end
end
Event Timeline
Log In to Comment