This file contains 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 V1::Users::OffersController < V1::UsersController | |
def purchase | |
product = Product.find(params[:offer_id]) | |
product.bind(@user) | |
end | |
end |
This file contains 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
ActionView::Template::Error (super: no superclass method `prize' for #<Battle:0x000000046a3908>): | |
1: <%= ActiveSupport::JSON.encode({ | |
2: prize: { | |
3: coins: @battle.prize | |
4: } | |
5: }).html_safe %> | |
app/views/v1/battles/prize.json.erb:3:in `_app_views_v__battles_prize_json_erb__2855760873617265786_35928320' | |
app/controllers/v1/battles_controller.rb:58:in `prize' | |
app/controllers/v1_controller.rb:11:in `block (2 levels) in respond_json' | |
app/controllers/v1_controller.rb:9:in `respond_json' |
This file contains 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
2013-01-23T16:20:30+00:00 app[web.1]: E, [2013-01-23T16:20:30.839339 #2] ERROR -- : worker=2 PID:1896 timeout (31s > 30s), killing | |
2013-01-23T16:20:30+00:00 app[web.1]: E, [2013-01-23T16:20:30.856145 #2] ERROR -- : reaped #<Process::Status: pid 1896 SIGKILL (signal 9)> worker=2 | |
2013-01-23T16:20:30+00:00 app[web.1]: I, [2013-01-23T16:20:30.856519 #2] INFO -- : worker=2 spawning... | |
2013-01-23T16:20:30+00:00 app[web.1]: ** [NewRelic][01/23/13 16:20:30 +0000 e811a373-3ff2-436c-bf1a-3e30f9bbfcb0 (1972)] INFO : Starting the worker thread in 1972 after forking. | |
2013-01-23T16:20:30+00:00 app[web.1]: I, [2013-01-23T16:20:30.873625 #1972] INFO -- : worker=2 spawned pid=1972 | |
2013-01-23T16:20:30+00:00 app[web.1]: I, [2013-01-23T16:20:30.881617 #1972] INFO -- : worker=2 ready |
This file contains 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
# Para deletar o conteudo de dentro da variavel | |
b.map(&:delete) | |
# Comando para tirar o heroku da manuntenção para ser executado no terminal: heroku maintenance:off -a battle-server-mock | |
# Scritpt que o Erich me passou | |
count = 0 | |
total = 0 | |
ids = Challenge.all.map(&:id) |
This file contains 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/model/user.rb | |
has_and_belongs_to_many :friends, class_name: 'User', inverse_of: :friends | |
# spec/model/user_spec.rb | |
it { should have_and_belong_to_many(:friends).of_type('User').as_inverse_of(:friends) } | |
# Error message | |
#1) User Associations | |
# Failure/Error: it { should have_and_belong_to_many(:friends).of_type('User').as_inverse_of(:friends) } | |
# Expected User to reference and referenced in many "friends" of type "User" which is an inverse of "friends", got User #references and referenced in many friends of type User |
This file contains 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 'spec_helper' | |
describe 'v1/endpoints/index', formats: [ :json ] do | |
let(:endpoint) { 'http://battle-server-mock.herokuapp.com/1' } | |
describe 'Endpoints API Representation' do | |
before { render } | |
let(:json) { ActiveSupport::JSON.decode(rendered) } |
This file contains 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
# Here are the settings that are common to all environments | |
common: &default_settings | |
# ============================== LICENSE KEY =============================== | |
# You must specify the license key associated with your New Relic | |
# account. This key binds your Agent's data to your account in the | |
# New Relic service. | |
license_key: '<%= ENV["NEW_RELIC_LICENSE_KEY"] %>' | |
# Agent Enabled (Rails Only) |
This file contains 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
# my unicorn file | |
worker_processes 4 # amount of unicorn workers to spin up | |
timeout 30 # restarts workers that hang for 30 seconds | |
preload_app true # needed for newrelic_rpm to start its agent | |
after_fork do |server, worker| | |
Sidekiq.configure_client do |config| | |
config.redis = { size: 1 } | |
end |
This file contains 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
source 'https://rubygems.org' | |
ruby '2.0.0' | |
gem 'rails', '3.2.13' | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'rails-api' |
This file contains 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
GEM | |
remote: https://rubygems.org/ | |
specs: | |
actionmailer (3.2.13) | |
actionpack (= 3.2.13) | |
mail (~> 2.5.3) | |
actionpack (3.2.13) | |
activemodel (= 3.2.13) | |
activesupport (= 3.2.13) | |
builder (~> 3.0.0) |
OlderNewer