Don’t simply test for the presence of the magic Paperclip attribute, it will return a paperclip Attachment object and thus always be true:
- if user.photo.present? # always true
= image_tag(user.photo.url)
fs = require('fs') | |
readline = require('readline') | |
google = require('googleapis') | |
googleAuth = require('google-auth-library') | |
calendar = google.calendar('v3') | |
SCOPES = [ 'https://www.googleapis.com/auth/calendar.readonly' ] | |
TOKEN_DIR = (process.env.HOME or process.env.HOMEPATH or process.env.USERPROFILE) + '/.credentials/' | |
TOKEN_PATH = TOKEN_DIR + 'calendar-api-quickstart.json' | |
# Create an OAuth2 client with the given credentials, and then execute the |
class API::V1::BaseController < ApplicationController | |
skip_before_filter :verify_authenticity_token | |
before_filter :cors_preflight_check | |
after_filter :cors_set_access_control_headers | |
def cors_set_access_control_headers | |
headers['Access-Control-Allow-Origin'] = '*' | |
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS' |