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 User | |
include Mongoid::Document | |
authenticates_with_sorcery! | |
attr_accessor :username, :email, :password, :password_confirmation | |
attr_accessible :username, :email, :password, :password_confirmation | |
field :_id, type: String, default: -> { username.to_s.parameterize } | |
field :username, type: String | |
field :email, type: String |
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
# spec/controllers/pages_controller_spec.rb | |
require 'spec_helper' | |
describe PagesController do | |
describe "#show" do | |
context "with a published slug" do | |
... | |
end | |
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
Started POST "/patients/4/prescribe" for 127.0.0.1 at 2013-05-02 16:24:39 -0400 | |
Processing by PatientsController#prescribe as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Y8q2s/H4QzKVX8v03mXKg282kLEaNIwsztwVjQaJL7Q=", "patient"=>{"prescriptions_attributes"=>{"0"=>{"product_id"=>"2", "total_amount_prescribed"=>"100", "total_amount_prescribed_quantity"=>"Tablets", "amount_prescribed"=>"1", "amount_prescribed_quantity"=>"Tablets", "frequency"=>"Daily", "_destroy"=>"1", "id"=>"3"}, "1"=>{"product_id"=>"", "total_amount_prescribed"=>"", "total_amount_prescribed_quantity"=>"", "amount_prescribed"=>"", "amount_prescribed_quantity"=>"", "frequency"=>"", "_destroy"=>"0"}}}, "commit"=>"Update Patient", "patient_id"=>"4"} | |
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]] | |
{"utf8"=>"✓", "authenticity_token"=>"Y8q2s/H4QzKVX8v03mXKg282kLEaNIwsztwVjQaJL7Q=", "patient"=>{"prescriptions_attributes"=>{"0"=>{"product_id"=>"2", "total_amount_prescribed"=>"100", |
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
/* ACL Tables */ | |
CREATE TABLE acos ( | |
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, | |
parent_id INT DEFAULT NULL, | |
model VARCHAR(255) DEFAULT '', | |
foreign_key INT UNSIGNED DEFAULT NULL, | |
alias VARCHAR(255) DEFAULT '', | |
lft INT DEFAULT NULL, | |
rght INT DEFAULT NULL |
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
# Example - Let's write a function that prints a name | |
# This is RSpec, it's a testing framework. It's just like ruby in that it's made to be super readable. As you read the code, read it outloud like instructions | |
# We start with tests first | |
# We know that we need a function to print names. That's all we need. We | |
# use tests to keep us focused on the task. You'll write it piece by piece. Instead of writing the whole | |
# function, we'll break it up into responsibility chunks |
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
#<OmniAuth::AuthHash credentials=#<OmniAuth::AuthHash expires=false token="sk_test_1CaKdG1dAXb8KslcL31SCiXw"> extra=#<OmniAuth::AuthHash raw_info=#<OmniAuth::AuthHash livemode=false scope="read_write" stripe_publishable_key="pk_test_8xjqOYJzb8aXps69xLgRig6i" stripe_user_id="acct_2E8oqiveAsKlfRBdumEj" token_type="bearer">> info=#<OmniAuth::AuthHash::InfoHash livemode=false scope="read_write" stripe_publishable_key="pk_test_8xjqOYJzb8aXps69xLgRig6i"> provider="stripe_connect" uid="acct_2E8oqiveAsKlfRBdumEj"> |
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
# Buyer's credit card was created in JS using OUR publishable key (as the docs say this is ok if you're sharing customers)... I think | |
@item = Item.find(1) | |
#<Item id: 1, user_id: 1, category_id: 1, status: "buy_it_now", name: "Time Traveling DeLoreanzz", description: "Lorem ipsum dolor sit amet, consectetuer adipiscing...", content: "Lorem ipsum dolor sit amet, consectetuer adipiscing...", price: #<BigDecimal:7f88b5f80a08,'0.15E6',9(18)>, reserve: #<BigDecimal:7f88b5f80990,'0.149E6',9(18)>, shipping: nil, is_shippable: false, is_featured: false, created_at: "2013-08-30 14:41:55", updated_at: "2013-10-09 15:22:57", auction_id: 1, buy_it_now_price: #<BigDecimal:7f88b5f80828,'0.15E6',9(18)>, accepted_credit_amount: 0, slug: "time-traveling-deloreanzz", deleted_at: nil, buyer_responsible_for_shipping: false, payment_status: "paid"> | |
@seller = User.find(1) | |
#<User id: 1, email: "[email protected]", encrypted_password: "$2a$10$2knLYeWdDmkJA4l.UOa2nO4qYt3gfQ89ekibN/fGk/Xy...", reset_password_token: nil, reset_passwor |
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/models/credit_card.rb | |
class CreditCard < ActiveRecord::Base | |
belongs_to :user | |
... | |
def make_default! | |
old = self.users.credit_cards.where(default: true).first |
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
# Model | |
class Job | |
include MongoMapper::Document | |
key :title, String | |
key :description, String | |
end | |
# Controller |
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
[1, 2, 3, 4].slice(3) #=> 4 | |
[1, 2, 3, 4].slice(4) #=> nil | |
[1, 2, 3, 4].slice(5) #=> nil | |
[1, 2, 3, 4].slice(4, 1) #=> [] | |
[1, 2, 3, 4].slice(5, 1) #=> nil |