Skip to content

Instantly share code, notes, and snippets.

@bobbywilson0
Created December 19, 2008 16:44
Show Gist options
  • Save bobbywilson0/38040 to your computer and use it in GitHub Desktop.
Save bobbywilson0/38040 to your computer and use it in GitHub Desktop.
def join_link
return if @appointment.full?
return "#{link_to 'register', new_client_path} or #{link_to 'log in', '/login'} to join this class" if !current_user
return 'Incorrect role, must be a client to sign up for a class' if !current_user.has_role?('client')
return 'You are already signed up for this class' if current_user.appointments.include?(@appointment)
link_to 'join class', add_client_to_appointment
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment