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
module Paperclip | |
class Padder < Thumbnail | |
def transformation_command | |
super + ["-gravity center", | |
"-background white", | |
"-extent", %["#{geometry_extent}"]] | |
end | |
def geometry_extent | |
"#{target_geometry.width.to_i}x#{target_geometry.height.to_i}" |
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
module Paperclip | |
class TimeStamper < Processor | |
def initialize(file, options={}, attachment=nil) | |
super(file,options,attachment) | |
timestamp_filename | |
end | |
def timestamp_filename | |
original_filename = attachment.instance_read(:file_name) | |
extension = File.extname(original_filename) |
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 User < ActiveRecord::Base | |
has_attached_file :image, | |
:styles => { | |
:large => "280x280#", | |
:medium => "130x130#", | |
:small => "50x50#", | |
:tiny => "30x30#" }, | |
:processors => [:thumbnail, :timestamper], | |
:date_format => "%Y%m%d%H%M%S" | |
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
Mysql2::Error: Column 'id' in order clause is ambiguous: SELECT COUNT(*) AS count_all, users.id AS users_id FROM `users` LEFT JOIN followings ON users.id = followings.followee_id GROUP BY users.id WHERE COUNT(followings.followee_id) > 10 ORDER BY id desc | |
activerecord (3.0.7) lib/active_record/connection_adapters/abstract_adapter.rb:207:in `rescue in log' | |
activerecord (3.0.7) lib/active_record/connection_adapters/abstract_adapter.rb:199:in `log' | |
mysql2 (0.2.6) lib/active_record/connection_adapters/mysql2_adapter.rb:314:in `execute' | |
mysql2 (0.2.6) lib/active_record/connection_adapters/mysql2_adapter.rb:635:in `select' | |
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all' | |
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cache.rb:54:in `block in select_all' | |
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `cache_sql' | |
activerecord (3.0.7) lib/active_record/connection_adapters/abstract/query_cac |
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
module LayoutHelper | |
def page_description | |
description = case | |
when @question then @question.background | |
when @user && @user.bio.present? then @user.bio | |
when @user && @user.sports.present? then @user.sports_list | |
when @user && [email protected]_record? then "Tribesports user: #{@user.short_name}" | |
when @topic then @topic.body | |
when @tribe then @tribe.description |
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
# -*- encoding: utf-8 -*- | |
Gem::Specification.new do |s| | |
s.name = %q{draper} | |
s.version = "0.7.0" | |
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | |
s.authors = ["Jeff Casimir"] | |
s.date = %q{2011-08-17 00:00:00.000000000Z} | |
s.description = %q{Draper reimagines the role of helpers in the view layer of a Rails application, allowing an object-oriented approach rather than procedural.} |
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
module LayoutHelper | |
def page_description | |
begin | |
vars = [:@question, :@user, :@topic, :@tribe, :@challenge, :@product] | |
dumps = Hash[*(vars.map{|v| [v, instance_variable_get(v).inspect]}.flatten)] | |
description = case | |
when @question then @question.background | |
when @user && @user.bio.present? then @user.bio | |
when @user && @user.sports.present? then @user.sports_list |
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 'guard/guard' | |
guard 'bundler' do | |
watch('Gemfile') | |
end | |
guard 'spork', :wait => 60, :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do | |
watch('config/application.rb') | |
watch('config/environment.rb') | |
watch(%r{^config/environments/.+\.rb$}) |
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
$ curl -v -H 'Accept: application/vnd.tribesports.api.v1+json' "http://tribesports.dev/activities/32006" | |
* About to connect() to tribesports.dev port 80 (#0) | |
* Trying 127.0.0.1... connected | |
* Connected to tribesports.dev (127.0.0.1) port 80 (#0) | |
> GET /activities/32006 HTTP/1.1 | |
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3 | |
> Host: tribesports.dev | |
> Accept: application/vnd.tribesports.api.v1+json | |
> | |
< HTTP/1.1 200 OK |
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
@search | |
Scenario: List products | |
Given the system has the following products: | |
| id | name | | |
| 1 | Acme Flaming Hammer | | |
| 2 | Adidas Patented Truss | | |
| 3 | Corby Trouser Press | | |
And I authenticate as admin | |
And I send and accept XML | |
And the search index is updated |
OlderNewer