code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class Bill < ActiveRecord::Base
PAYMENT_METHODS = [
# Displayed stored in db
[ "Check" , "ck" ],
[ "Credit card" , "cc" ],
[ "Cash" , "cs" ]
]
FREQUENCY = [
# Displayed stored in db
[ "Only once" , "oo" ],
[ "Daily" , "dy" ],
[ "Wee... | Ruby |
class Payee < ActiveRecord::Base
has_many :bills
validates_presence_of :name
end
| Ruby |
class Transaction < ActiveRecord::Base
belongs_to :account
validates_presence_of :amount, :account_id
validates_format_of :amount, :with => /^[0-9]+\.[0-9]{0,2}$/
validates_numericality_of :amount, :greater_than => 0.0
def name
"#{number} - #{payee_category}"
end
def real_amount
self.credit ?... | Ruby |
class Category < ActiveRecord::Base
has_many :bills
validates_presence_of :name
end
| Ruby |
class PayeesController < ApplicationController
layout "application"
active_scaffold :payee do |config|
config.label = "Payees"
config.columns = [:name, :phone_number]
config.columns[:phone_number].label = "Phone #"
config.columns[:phone_number].description = "(Format: ###-###-####)"
end
# # G... | Ruby |
class ReportsController < ApplicationController
layout "application"
def index
end
def spending_by_category
@categories = Category.find(:all)
end
def spending_by_payee
@payees = Payee.find(:all)
end
def credit_card_debt
end
def top_five_expense_categories
... | Ruby |
class CategoriesController < ApplicationController
layout "application"
active_scaffold :category do |config|
config.label = "Categories"
config.columns = [:name, :credit]
config.columns[:credit].form_ui = :checkbox
end
# # GET /categories
# # GET /categories.xml
# def index
# @categories = C... | Ruby |
class HomeController < ApplicationController
layout "application"
def index
@accounts = Account.find(:all)
end
end
| Ruby |
class BillsController < ApplicationController
layout "application"
active_scaffold :bill do |config|
config.label = "Bills"
config.columns = [:payee, :account, :number, :next_payment_date, :payment_method, :frequency, :amount, :category]
config.columns[:payee].form_ui = :select
config.columns[:acco... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details... | Ruby |
class TransactionsController < ApplicationController
layout "application"
active_scaffold :transaction do |config|
config.label = "Transactions"
config.columns = [:date, :number, :account, :payee_category, :amount, :credit]
config.columns[:account].form_ui = :select
config.columns[:credit].form_ui ... | Ruby |
class AccountsController < ApplicationController
layout "application"
active_scaffold :account do |config|
config.label = "Accounts"
config.columns = [:number, :name]
config.list.columns << :transactions
config.list.columns << :total
config.nested.add_link("Account's transactions", [:transact... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
ActionController::Routing::Routes.draw do |map|
map.resources :reports, :accounts, :payees, :categories, :transactions, :bills, :active_scaffold => true
# map.resources :bills
# map.resources :categories
# map.resources :payees
# map.resources :transactions
# map.resources :accounts
# The pr... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | Ruby |
# Be sure to restart your server when you modify this file
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.0... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | Ruby |
class CaseinCreateUsers < ActiveRecord::Migration
def self.up
create_table :casein_users do |t|
t.string :login, :null => false
t.string :name
t.string :email
t.integer :access_level, :null => false, :default => 0
t.string :crypted_password, :null => false
t... | Ruby |
class CreateCategories < ActiveRecord::Migration
def change
create_table :categories do |t|
t.string :name
t.timestamps
end
end
end
| Ruby |
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string :name
t.string :picture
t.integer :price
t.integer :category_id
t.timestamps
end
end
end
| Ruby |
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :content
t.integer :user_id
t.integer :product_id
t.timestamps
end
end
end
| Ruby |
require 'rubygems'
require 'test/unit'
require 'active_support'
| Ruby |
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
CaseinCMS::Application.load_tasks
| Ruby |
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'casein'
gem 'roo'
gem 'carrierwave'
gem 'mini_magick'
gem 'flash_cookie_session'
gem 'pry'
gem 'haml'
gem 'fog'
gem 'google_drive'
# Gems used only for assets a... | Ruby |
module ApplicationHelper
end
| Ruby |
module ProductsHelper
end
| Ruby |
module CategoriesHelper
end
| Ruby |
module Casein
module CaseinHelper
def casein_get_version_info
YAML::load_file File.join(File.dirname(__FILE__), '..', '..', '..', 'PUBLIC_VERSION.yml')
end
def casein_get_full_version_string
version_info = casein_get_version_info
"v.#{version_info['major']}.#{version_info['minor']}.#{ver... | Ruby |
module Casein
module ConfigHelper
# Text string containing the name of the website or client
# Used in text and titles throughout Casein
def casein_config_website_name
'Casein'
end
# URL to the logo used for the login screen and top banner - it should be a transparent PNG
def casein_co... | Ruby |
module CommentsHelper
end
| Ruby |
module Casein
class CaseinNotification < ActionMailer::Base
self.prepend_view_path File.join(File.dirname(__FILE__), '..', 'views', 'casein')
def generate_new_password from, casein_user, host, pass
@name = casein_user.name
@host = host
@login = casein_user.login
@pass = pass
@from_tex... | Ruby |
# encoding: utf-8
class ExcelUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
#storage :file
storage :fog
# Override the directory where uploaded... | Ruby |
# encoding: utf-8
class FileUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
#storage :fog
# Override the directory where uploaded ... | Ruby |
# app/uploaders/photo_uploader.rb
class PhotoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :fog
# stor... | Ruby |
module Casein
class UserSession < ::Authlogic::Session::Base
include ActiveModel::Conversion
def persisted?
false
end
end
end | Ruby |
class Product < ActiveRecord::Base
attr_accessible :category_id, :name, :picture, :price
validates_presence_of :category_id, :name
has_many :comments
belongs_to :category
end
| Ruby |
class Comment < ActiveRecord::Base
attr_accessible :content, :product_id, :user_id
belongs_to :user
belongs_to :product
end
| Ruby |
include Casein::ConfigHelper
$CASEIN_USER_ACCESS_LEVEL_ADMIN = 0
$CASEIN_USER_ACCESS_LEVEL_USER = 10
module Casein
class User < ActiveRecord::Base
has_many :comments
def self.table_name
self.to_s.gsub("::", "_").tableize
end
acts_as_authentic { |c| c.validate_email_field = false }
... | Ruby |
class Category < ActiveRecord::Base
attr_accessible :name
has_many :products
end
| Ruby |
require 'rack/utils'
class FlashSessionCookieMiddleware
def initialize(app, session_key = '_session_id')
@app = app
@session_key = session_key
end
def call(env)
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
req = Rack::Request.new(env)
env['HTTP_COOKIE'] = [ @session_key,
... | Ruby |
class ProductsController < ApplicationController
# GET /products
# GET /products.json
def index
@products = Product.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @products }
end
end
# GET /products/1
# GET /products/1.json
def show
@produc... | Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| Ruby |
class CommentsController < ApplicationController
# GET /comments
# GET /comments.json
def index
@comments = Comment.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @comments }
end
end
# GET /comments/1
# GET /comments/1.json
def show
@commen... | Ruby |
class CategoriesController < ApplicationController
# GET /categories
# GET /categories.json
def index
@categories = Category.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @categories }
end
end
# GET /categories/1
# GET /categories/1.json
def s... | Ruby |
# encoding: utf-8
class ExcelUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
#storage :file
storage :fog
# Override the directory where uploaded... | Ruby |
# encoding: utf-8
class FileUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
include CarrierWave::MiniMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
#storage :fog
# Override the directory where uploaded ... | Ruby |
# app/uploaders/photo_uploader.rb
class PhotoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :fog
# sto... | Ruby |
require 'authlogic'
module Casein
class CaseinController < ApplicationController
unloadable
require 'casein/casein_helper'
include Casein::CaseinHelper
require 'casein/config_helper'
include Casein::ConfigHelper
layout 'casein_main'
helper_method :current_user_session, :current_user... | Ruby |
module Casein
class UsersController < Casein::CaseinController
unloadable
before_filter :needs_admin, :except => [:show, :destroy, :update, :update_password]
before_filter :needs_admin_or_current_user, :only => [:show, :destroy, :update, :update_password]
def index
@casein_page_title = "Us... | Ruby |
module Casein
class UserSessionsController < Casein::CaseinController
unloadable
skip_before_filter :authorise, :only => [:new, :create]
before_filter :requires_no_session_user, :except => [:destroy]
layout 'casein_auth'
def new
@user_session = Casein::UserSession.new
end... | Ruby |
module Casein
class PasswordResetsController < Casein::CaseinController
unloadable
skip_before_filter :authorise
before_filter :load_user_using_perishable_token, :only => [:edit, :update]
layout 'casein_auth'
def create
users = Casein::User.where(:email => params[:recover_email])... | Ruby |
require 'rack/utils'
class FlashSessionCookieMiddleware
def initialize(app, session_key = '_session_id')
@app = app
@session_key = session_key
end
def call(env)
if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
req = Rack::Request.new(env)
env['HTTP_COOKIE'] = [ @session_key,
... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', ... | Ruby |
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | Ruby |
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Be sure to restart your server when you modify this file.
CaseinCMS::Application.config.session_store :cookie_store, key: '_CaseinCMS_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rai... | Ruby |
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.raise_delivery_errors = false
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => false,
:address => "mail.gmail.com",
:port => 25,
:domain => "yourdomain.com",
:user_name => "maitrithien@gmail.com",
:password => "M@iTriThien",
... | Ruby |
Rails.application.routes.draw do
resources :products do
resources :comments
end
resources :categories do
resources :products
end
match "/admin" => redirect("/casein")
namespace :casein do
resources :products do
get 'load_from_excel', :on => :collection
get 'show_resu... | Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
CaseinCMS::Application.initialize!
| Ruby |
CaseinCMS::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.acti... | Ruby |
CaseinCMS::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web ... | Ruby |
CaseinCMS::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test ... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run CaseinCMS::Application
| Ruby |
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
CaseinCMS::Application.load_tasks
| Ruby |
require 'rubygems'
require 'builder'
# Base class for all other types of spreadsheets
class GenericSpreadsheet
attr_reader :default_sheet
# sets the line with attribute names (default: 1)
attr_accessor :header_line
def initialize
end
# set the working sheet in the document
def default_sheet=(sheet)
... | Ruby |
require 'xml'
require 'fileutils'
require 'zip/zipfilesystem'
require 'date'
require 'base64'
require 'cgi'
class Excel2003XML < GenericSpreadsheet
@@nr = 0
# initialization and opening of a spreadsheet file
# values for packed: :zip
def initialize(filename, packed=nil, file_warning=:error)
@file_warnin... | Ruby |
require 'spreadsheet'
CHARGUESS = begin
require 'charguess'
true
rescue LoadError => e
false
end
# The Spreadsheet library has a bug in handling Excel
# base dates so if the file is a 1904 base date then
# dates are off by a day. 1900 base dates work fine
module Spreadsheet
module Excel
class Row < Sprea... | Ruby |
require 'xml'
require 'fileutils'
require 'zip/zipfilesystem'
require 'date'
require 'base64'
require 'cgi'
class Openoffice < GenericSpreadsheet
@@nr = 0
# initialization and opening of a spreadsheet file
# values for packed: :zip
def initialize(filename, packed=nil, file_warning=:error) #, create = false)
... | Ruby |
require 'gdata/spreadsheet'
require 'xml'
class GoogleHTTPError < RuntimeError; end
class GoogleReadError < RuntimeError; end
class GoogleWriteError < RuntimeError; end
# overwrite some methods from the gdata-gem:
module GData
class Spreadsheet < GData::Base
def visibility
@headers ? "private" : "pub... | Ruby |
def spreadsheet(spreadsheet, sheets, options={})
@rspreadsheet = spreadsheet
coordinates = true # default
o=""
if options[:coordinates] != nil
o << ":coordinates uebergeben: #{options[:coordinates]}"
coordinates = options[:coordinates]
end
if options[:bgcolor]
bgcolor = options[:bgcolor]
else
... | Ruby |
module Roo #:nodoc:
module VERSION #:nodoc:
MAJOR = 1
MINOR = 3
TINY = 9
STRING = [MAJOR, MINOR, TINY].join('.')
end
end
| Ruby |
require 'xml'
require 'fileutils'
require 'zip/zipfilesystem'
require 'date'
class String
def end_with?(str)
self[-str.length,str.length] == str
end
end
class Excelx < GenericSpreadsheet
FORMATS = {
'General' => :float,
'0' => :float,
'0.00' => :float,
'#,##0' => :float,
'#,##0.00' => :... | Ruby |
module Roo
class Spreadsheet
class << self
def open(file)
case File.extname(file)
when '.xls'
Excel.new(file)
when '.xlsx'
Excelx.new(file)
when '.ods'
Openoffice.new(file)
when '.xml'
Excel2003XML.new(file)
when ''
... | Ruby |
require "casein"
require "rails"
module Casein
class Engine < Rails::Engine
rake_tasks do
load "railties/tasks.rake"
end
end
class RouteConstraint
def matches?(request)
return false if request.fullpath.include?("/casein")
return false if request.fullpath.include?("/... | Ruby |
module Casein
class InstallGenerator < Rails::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
def self.next_migration_number dirname
if ActiveRecord::Base.timestamped_migrations
Time.now.utc.strftime("%Y%m%d%H%M%S"... | Ruby |
class CaseinCreateUsers < ActiveRecord::Migration
def self.up
create_table :casein_users do |t|
t.string :login, :null => false
t.string :name
t.string :email
t.integer :access_level, :null => false, :default => 0
t.string :crypted_password, :null => false
t... | Ruby |
module Casein
module ConfigHelper
# Text string containing the name of the website or client
# Used in text and titles throughout Casein
def casein_config_website_name
'Casein'
end
# URL to the logo used for the login screen and top banner - it should be a transparent PNG
def casein_co... | Ruby |
module Casein
class UpdateGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def generate_files
puts "*** Updating Casein public assets. These should not be modified as they may be overwritten in future updates. ***"
#stylesheets
co... | Ruby |
module Casein
class ScaffoldGenerator < Rails::Generators::NamedBase
include Casein::CaseinHelper
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
argument :attributes, :type => :array, :required => true, :desc => "attribute list required"
clas... | Ruby |
class Create<%= class_name.pluralize %> < ActiveRecord::Migration
def self.up
create_table :<%= table_name %> do |t|
<% attributes.each do |attribute| %>t.<%= attribute.type %> :<%= attribute.name %>
<% end %>
t.timestamps
end
end
def self.down
drop_table :<%= table_name %>
end
en... | Ruby |
class <%= class_name %> < ActiveRecord::Base
end | Ruby |
require 'casein/engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
require 'will_paginate'
require 'authlogic' | Ruby |
require 'authlogic'
namespace :casein do
namespace :users do
desc "Create default admin user"
task :create_admin => :environment do
raise "Usage: specify email address, e.g. rake [task] email=mail@caseincms.com" unless ENV.include?("email")
admin = Casein::User.new( {:login => '... | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.