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 ArbitraryModel < DataMapper::Type | |
primitive String | |
def self.dump(value, property) | |
"#{value.class}/#{value.id}" unless value.nil? | |
end | |
def self.load(value, property) | |
case value |
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 SomeModel | |
include DataMapper::Resource | |
property :id, Serial | |
property :details, ArbitraryModel | |
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
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 143 | 117 | 6 | 13 | 2 | 7 | | |
| Helpers | 33 | 20 | 0 | 2 | 0 | 8 | | |
| Models | 691 | 421 | 16 | 38 | 2 | 9 | | |
| Libraries | 764 | 463 | 10 | 63 | 6 | 5 | | |
| Model specs | 1237 | 864 | 0 | 5 | 0 | 170 | | |
| View specs | 0 | 0 | 0 | 0 | 0 | 0 | | |
| Controller specs | 974 | 661 | 0 | 13 | 0 | 48 | |
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
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 179 | 147 | 6 | 17 | 2 | 6 | | |
| Helpers | 34 | 20 | 0 | 2 | 0 | 8 | | |
| Models | 697 | 424 | 16 | 39 | 2 | 8 | | |
| Libraries | 764 | 463 | 10 | 63 | 6 | 5 | | |
| Model specs | 1237 | 864 | 0 | 5 | 0 | 170 | | |
| Controller specs | 1117 | 760 | 0 | 14 | 0 | 52 | | |
| Library specs | 459 | 314 | 2 | 1 | 0 | 312 | |
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
Code LOC: 1394 Test LOC: 3340 Code to Test Ratio: 1:2.4 | |
... | |
700 examples, 0 failures, 1 pending | |
... | |
Total coverage: 95.3% |
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 'simplabs/excellent/rake' | |
desc 'Analyse the source with excellent.' | |
Simplabs::Excellent::Rake::ExcellentTask.new(:excellent) do |t| | |
t.paths = %w(app lib) | |
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
require 'rubygems' | |
require 'spork' | |
ENV['RAILS_ENV'] = 'test' | |
Spork.prefork do | |
require File.dirname(__FILE__) + "/../config/environment" | |
require 'spec/autorun' | |
require 'spec/rails' |
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/views/service_mails/_common_form_elements.html.erb | |
* Line 2: Instance variable possible_senders used in partial. |
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
def require_all(dir, &block) | |
Dir[File.join(dir, '**', '*.rb')].each do |path| | |
begin | |
require path | |
rescue => e | |
yield path | |
end | |
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
# Good: | |
class Post | |
belongs_to :author, :class_name => User.to_s # ActiveRecord | |
belongs_to :author, User.to_s # DataMapper | |
has_many :replies, :class_name => Comment.to_s # ActiveRecord | |
has n, :replies, Comment.to_s # DataMapper |