This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # add to user model | |
| has_many :authentications, :dependent => :destroy | |
| # config/routes.rb | |
| match '/auth/:provider/callback' => 'authentications#create' | |
| match '/auth/failure' => redirect('/users/sign_in') | |
| # config/initializers/omniauth.rb | |
| require 'openid/store/filesystem' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| App.util.parse_content_location = (location)-> | |
| # parts = ["content_packages","1","sections","1"] | |
| # parent class, parent id, content item class, content item id | |
| parts = location.split(':') | |
| App.util.find_object_for_location = (content_location)-> | |
| [pkg, pkg_id, store, object_id] = App.util.parse_content_location(content_location) | |
| # find the table based on the store variable | |
| collection = Store(store) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ExamResult | |
| has_many :answers, :dependent => :destroy | |
| accepts_nested_attributes_for :answers | |
| # for cleaner API | |
| alias_method :user_answers=, :answers_attributes= | |
| end | |
| class Answer | |
| belongs_to :exam_result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _.extend(Backbone.Controller.prototype, Backbone.Events, { | |
| route : function(route, name, callback) { | |
| Backbone.history || (Backbone.history = new Backbone.History); | |
| if (!_.isRegExp(route)) route = this._routeToRegExp(route); | |
| Backbone.history.route(route, _.bind(function(fragment) { | |
| var args = this._extractParameters(route, fragment); | |
| if( _.isFunction( this.before ) ){ | |
| this.before.apply(this, args) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SectionsController < ApplicationController | |
| before_filter :require_client | |
| def index | |
| cache_key = "#{ current_package.id }:sections" | |
| @sections = Rails.cache.read cache_key | |
| if !@sections | |
| @sections = Section.tree_for( current_package ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PassengerHighPerformance on | |
| PassengerMaxPoolSize 30 | |
| PassengerPoolIdleTime 0 | |
| RailsAutoDetect off | |
| RailsSpawnMethod smart | |
| PassengerStatThrottleRate 10 | |
| RailsAppSpawnerIdleTime 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p>Hello <%= @resource.email %>!</p> | |
| <p>Someone has requested a link to change your password, and you can do this through the link below.</p> | |
| <p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p> | |
| <p>If you didn't request this, please ignore this email.</p> | |
| <p>Your password won't change until you access the link above and create a new one.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p>Welcome <%= @resource.email %>!</p> | |
| <p>You can confirm your account through the link below:</p> | |
| <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'net/https' | |
| module SecurityModule | |
| class HighSecurity | |
| class ReallyHighSecurity | |
| def self.turn_on_safe_connections | |
| OpenSSL::SSL::VERIFY_NONE | |
| end | |
| end | |
| end |