Skip to content

Instantly share code, notes, and snippets.

@mccun934
Created August 17, 2012 23:39
Show Gist options
  • Select an option

  • Save mccun934/3383495 to your computer and use it in GitHub Desktop.

Select an option

Save mccun934/3383495 to your computer and use it in GitHub Desktop.
def set_org
orgs = current_user.allowed_organizations
org = Organization.find(params[:org_id])
if org.nil? or !orgs.include?(org)
notify.error _("Invalid organization")
render :nothing => true
return
else
self.current_organization = org
end
if self.current_organization == org
redirect_to dashboard_index_url
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment