Respond_to Hack

Tagged with Rails respond_to

Language: Ruby

View as text

def update
  formats = ["html","xml","js"]
  respond_to do |f|
    self.send("update_#{response[0]}") unless ({|x| f.send(x)}).empty?
Original snippet written by Kevin Gisi
Last updated at 12:25 PM on Jun 06, 2009

SnippetStash costs money to host and develop. The service is free for everyone to use
but if you found it useful please consider making a small donation.