Skip to content

Instantly share code, notes, and snippets.


Stephen Roos StephenRoos

View GitHub Profile

Setting up the Secrets Submodule

First, cd into your career_arc repo and pull the latest changes...

> cd ~/repos/career_arc
> git pull

Next, initalize the git submodules feature:



Our app relies entirely on the current_user helper method (found in our ApplicationController) to retrieve the User object associated with the currently logged-in user (if any). You guys are using the devise gem for authentication, but you still have a current_user helper method which is made available to ApplicationController (and all subclasses).

Normally, the current_user method looks something like this:

def current_user
  # do some magic to get the user id from the (encrypted) session cookie…
  user_id = get_user_id_from_session
StephenRoos / divisions_controller.rb
Created Apr 12, 2016
Proposed updates to YNS API
View divisions_controller.rb
class Api::V1::DivisionsController < Api::V1Controller
def index
options = pagination_options
divisions =
render_paginated(divisions, options[:page], options[:per_page], divisions.total_pages, divisions.total_count)
def show
StephenRoos / application_controller.rb
Last active Feb 26, 2016
Subdomain Logic for TMJ
View application_controller.rb
class ApplicationController < ActionController::Base
before_filter :enforce_government
helper_method :current_government
def enforce_government
if current_user
# if the current user belongs to a government, then
# make sure that they are using that government's subdomain.
# otherwise, make sure they are using the default subdomain...
if current_user.government.present?
You can’t perform that action at this time.