Created
December 20, 2009 14:19
-
-
Save saulius/260499 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def javascript_parameters | |
params = { :csrf_token => form_authenticity_token } | |
if defined? collection | |
params.update(:resource => { :new => new_resource_url, :collection => collection_url }) | |
else | |
if defined? resource | |
if resource.new_record? | |
params.update(:resource => { :new => new_resource_url, :collection => collection_url }) | |
else | |
params.update(:resource => { :show => resource_url, :new => new_resource_url, :edit => edit_resource_url, :collection => collection_url }) | |
end | |
end | |
end | |
if defined? current_user and not(current_user.nil?) | |
params.update(:user => { :id => current_user.id, :show_nsfw => current_user.show_nsfw, :show_content => current_user.show_content } ) | |
end | |
params.to_json | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment