Skip to content

Instantly share code, notes, and snippets.

@bsgreenb
Last active November 20, 2015 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsgreenb/e86b1b69d18b83f893ce to your computer and use it in GitHub Desktop.
Save bsgreenb/e86b1b69d18b83f893ce to your computer and use it in GitHub Desktop.
def generic_render(path, flash_hash = {})
flash_hash.each do |k, v|
flash.now[k] = v
end
if xhr?
@modal_path = path
render 'shared/modal_replace'
else
render path
end
end
def generic_redirect(path, flash_hash = {})
flash_hash.each do |k, v|
flash[k] = v
end
if xhr?
@redirect_path = path
render 'shared/redirect'
else
redirect_to path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment