app/helpers/users_helper.rb
#
# Use this to wrap view elements that the user can't access.
# !! Note: this is an *interface*, not *security* feature !!
# You need to do all access control at the controller level.
#
# Example:
# <%= if_authorized?(:index,   User)  do link_to('List all users', users_path) end %> |
# <%= if_authorized?(:edit,    @user) do link_to('Edit this user', edit_user_path) end %> |
# <%= if_authorized?(:destroy, @user) do link_to 'Destroy', @user, :confirm => 'Are you sure?', :method => :delete end %> 
#
#
Use this to wrap view elements that the user can't access.
Note: this is an *interface*, not *security* feature
You need to do all access control at the controller level.


Use this to wrap view elements that the user can ' t access . Note : this is an * interface * not * security * feature You need to do all access control at the controller level .
def toggle_user_status_link(enable_name, disable_name, user)
	  if user.enabled
		url = disable_admin_user_path(user)
		name = disable_name
	  else
		url = enable_admin_user_path(user)
		name = enable_name
	  end
	  options = {
		:url => url,
	  }
	  html_options = {}
	  link_to_remote name, options, html_options
	end
def toggle_user_status_link ( enable_name , disable_name , user ) if user . enabled url = disable_admin_user_path ( user ) name = disable_name else url = enable_admin_user_path ( user ) name = enable_name end options = { :url => url , } html_options = { } link_to_remote name , options , html_options end
Use this to wrap view elements that the user can't access.
Use this to wrap view elements that the user can ' t access .
# link_to(disable_name, admin_state_path(user), :method => :delete) # link_to(enable_name, admin_state_path(user), :method => :put)
enable_name
disable_name
user