First, cd into your career_arc repo and pull the latest changes...
> cd ~/repos/career_arc
> git pullNext, 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| class Api::V1::DivisionsController < Api::V1Controller | |
| def index | |
| options = pagination_options | |
| divisions = Division.search(options) | |
| render_paginated(divisions, options[:page], options[:per_page], divisions.total_pages, divisions.total_count) | |
| end | |
| def show | |
| render_success(current_division) |
| 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? |