piggyback 0.3.0b → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/Manifest +1 -1
- data/README.markdown +11 -5
- data/Rakefile +28 -6
- data/lib/piggyback.rb +104 -87
- data/piggyback.gemspec +20 -17
- data/spec/models.rb +26 -6
- data/spec/piggyback_spec.rb +25 -17
- metadata +58 -54
- data/piggyback.tmproj +0 -169
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
data/README.markdown
CHANGED
@@ -64,9 +64,7 @@ You simply declare which association you want to piggyback and how the attribute
|
|
64
64
|
class Post < ActiveRecord::Base
|
65
65
|
belongs_to :user
|
66
66
|
|
67
|
-
piggyback_attr :name, :email
|
68
|
-
piggyback_attr :user_rating , :from => :user, :source => :rating
|
69
|
-
piggyback_attr :member_since , :from => :user, :source => :created_at
|
67
|
+
piggyback_attr :name, :email, { :user_rating => :rating , :member_since => :created_at }, :from => :user
|
70
68
|
end
|
71
69
|
|
72
70
|
Now you can do the following:
|
@@ -107,9 +105,17 @@ If you want to use an SQL-expression for selecting an attribute, Piggyback can a
|
|
107
105
|
|
108
106
|
class Post < ActiveRecord::Base
|
109
107
|
belongs_to :user
|
110
|
-
|
108
|
+
piggyback_attr ({ :user_name => "users.first_name || ' ' || users.last_name" }), :from => :user,
|
111
109
|
end
|
112
110
|
|
113
111
|
post.user_name # => "Donald Duck"
|
114
112
|
|
115
|
-
|
113
|
+
Or you could compute a numeric value. In this case however, you'll want to add the name of the original column to get proper type casting for the computed value. If you don't specifiy the column name, the result be a string instead of a float. You specify the column by passing an array containing the SQL statement and the name of the column:
|
114
|
+
|
115
|
+
class Post < ActiveRecord::Base
|
116
|
+
belongs_to :user
|
117
|
+
piggyback_attr ({ :monthly_salary => [ "users.salary / 12", :salary ] }), :from => :user,
|
118
|
+
end
|
119
|
+
|
120
|
+
post.monthly_salary # => 1300.0
|
121
|
+
|
data/Rakefile
CHANGED
@@ -1,15 +1,37 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'echoe'
|
3
|
-
|
4
|
-
Echoe.new('piggyback', '0.
|
3
|
+
|
4
|
+
Echoe.new('piggyback', '0.5.0') do |p|
|
5
|
+
|
5
6
|
p.description = "Piggyback attributes from associated models with ActiveRecord"
|
6
7
|
p.url = "http://github.com/juni0r/piggyback"
|
7
8
|
p.author = "Andreas Korth"
|
8
9
|
p.email = "andreas.korth@gmail.com"
|
9
|
-
p.ignore_pattern = ["tmp/*", "log/*", "Gemfile", "Gemfile.lock"]
|
10
10
|
|
11
|
-
p.
|
12
|
-
|
11
|
+
p.retain_gemspec = true
|
12
|
+
|
13
|
+
p.ignore_pattern = %w{
|
14
|
+
Gemfile
|
15
|
+
Gemfile.lock
|
16
|
+
vendor/**/*
|
17
|
+
tmp/*
|
18
|
+
log/*
|
19
|
+
*.tmproj
|
20
|
+
}
|
21
|
+
|
22
|
+
p.runtime_dependencies = [ "activerecord >=3.1.0" ]
|
23
|
+
p.development_dependencies = [ "echoe", "rspec", "sqlite3" ]
|
13
24
|
end
|
14
25
|
|
15
|
-
|
26
|
+
require 'rspec/core'
|
27
|
+
require 'rspec/core/rake_task'
|
28
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
29
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
33
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
34
|
+
spec.rcov = true
|
35
|
+
end
|
36
|
+
|
37
|
+
task default: :spec
|
data/lib/piggyback.rb
CHANGED
@@ -1,107 +1,144 @@
|
|
1
1
|
module Piggyback
|
2
2
|
extend ActiveSupport::Concern
|
3
3
|
|
4
|
+
included do
|
5
|
+
class_attribute :piggyback_attributes
|
6
|
+
self.piggyback_attributes = {}
|
7
|
+
end
|
8
|
+
|
4
9
|
module ClassMethods
|
5
10
|
|
6
|
-
def piggyback_attributes
|
7
|
-
read_inheritable_attribute(:piggyback_attributes) || write_inheritable_attribute(:piggyback_attributes, {})
|
8
|
-
end
|
9
|
-
|
10
11
|
def define_attribute_methods
|
11
12
|
piggyback_attributes.values.each do |attribute|
|
12
|
-
|
13
|
-
if attribute.
|
14
|
-
|
13
|
+
|
14
|
+
if column = attribute.column
|
15
|
+
columns_hash[attribute.name] = column
|
16
|
+
end
|
17
|
+
|
18
|
+
if klass = attribute.serialized_class
|
19
|
+
serialized_attributes[attribute.name] = klass
|
15
20
|
end
|
16
21
|
end
|
17
22
|
super
|
18
23
|
end
|
19
24
|
|
20
25
|
def piggyback_attr(*attributes)
|
21
|
-
|
22
26
|
options = attributes.extract_options!
|
23
|
-
options.assert_valid_keys(:from
|
27
|
+
options.assert_valid_keys(:from)
|
24
28
|
|
25
29
|
raise ArgumentError, "No attributes specified for piggybacking" if attributes.empty?
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
end
|
31
|
+
from = options[:from]
|
32
|
+
reflection = reflect_on_association(from)
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
raise ArgumentError, "#{self.name} has no association #{from.inspect}" if reflection.nil?
|
35
|
+
raise ArgumentError, "Piggyback only supports belongs_to and has_one associations" if reflection.collection?
|
36
|
+
|
37
|
+
attributes.each do |attribute|
|
38
|
+
case attribute
|
39
|
+
|
40
|
+
when Symbol
|
41
|
+
add_piggyback_attribute(reflection, attribute)
|
42
|
+
|
43
|
+
when Hash
|
44
|
+
mappings = attribute
|
45
|
+
mappings.each do |attribute, mapping|
|
46
|
+
case mapping
|
47
|
+
|
48
|
+
when Symbol
|
49
|
+
add_piggyback_attribute(reflection, attribute, source: mapping)
|
50
|
+
|
51
|
+
when String
|
52
|
+
add_piggyback_attribute(reflection, attribute, sql: mapping)
|
53
|
+
|
54
|
+
when Array
|
55
|
+
add_piggyback_attribute(reflection, attribute, sql: mapping.first, source: mapping.last)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
34
59
|
end
|
35
60
|
end
|
36
61
|
|
37
62
|
def piggyback(*attr_names)
|
38
|
-
attr_names.flatten!
|
39
|
-
options = attr_names.extract_options!
|
40
63
|
|
41
|
-
|
42
|
-
attr_names = piggyback_attributes.keys
|
43
|
-
else
|
44
|
-
froms = Array.wrap(options[:from])
|
45
|
-
if froms.any?
|
46
|
-
piggyback_attributes.each_value do |attribute|
|
47
|
-
attr_names << attribute.name if froms.include?(attribute.from)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
64
|
+
options = attr_names.extract_options!
|
51
65
|
|
52
|
-
attr_names.
|
66
|
+
attr_names.flatten!
|
67
|
+
attr_names.map!(&:to_s)
|
53
68
|
|
54
|
-
attributes = []
|
55
69
|
piggybacks = []
|
70
|
+
attributes = []
|
56
71
|
joins = []
|
57
72
|
|
58
|
-
attr_names.
|
59
|
-
|
60
|
-
if
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
attribute = piggyback_attributes[attr_name]
|
66
|
-
if attribute
|
67
|
-
piggybacks << attribute.select_sql
|
68
|
-
joins << attribute.join_sql
|
73
|
+
if attr_names.empty?
|
74
|
+
|
75
|
+
if options.has_key?(:from)
|
76
|
+
froms = Array.wrap(options[:from])
|
77
|
+
piggybacks = piggyback_attributes.values.select do |attribute|
|
78
|
+
froms.include?(attribute.reflection.name)
|
79
|
+
end
|
69
80
|
else
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
81
|
+
piggybacks = piggyback_attributes.values
|
82
|
+
end
|
83
|
+
|
84
|
+
else
|
85
|
+
attr_names.uniq.each do |attr_name|
|
86
|
+
if attribute = piggyback_attributes[attr_name]
|
87
|
+
piggybacks << attribute
|
88
|
+
elsif attribute = arel_table[attr_name]
|
89
|
+
attributes << attribute
|
90
|
+
else
|
91
|
+
raise "Unkown attribute #{attr_name}"
|
92
|
+
end
|
93
|
+
end
|
74
94
|
end
|
75
|
-
|
76
|
-
if
|
77
|
-
attributes << "#{quoted_table_name}.*"
|
95
|
+
|
96
|
+
if scoped.select_values.none? && attributes.empty?
|
97
|
+
attributes << "#{quoted_table_name}.*"
|
98
|
+
end
|
99
|
+
|
100
|
+
piggybacks.each do |attribute|
|
101
|
+
attributes << attribute.select
|
102
|
+
joins << attribute.reflection.name
|
78
103
|
end
|
104
|
+
|
105
|
+
context = select(attributes)
|
79
106
|
|
80
|
-
|
81
|
-
|
107
|
+
if joins.any?
|
108
|
+
dependency = ActiveRecord::Associations::JoinDependency.new(self, joins.uniq.compact, [])
|
109
|
+
joins = dependency.join_associations.each{ |assoc| assoc.join_type = Arel::OuterJoin }
|
110
|
+
context.joins(joins)
|
111
|
+
else
|
112
|
+
context
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
|
118
|
+
def add_piggyback_attribute(reflection, name, options = {})
|
119
|
+
attribute = Attribute.new(reflection, name, options)
|
120
|
+
self.piggyback_attributes = piggyback_attributes.merge(attribute.name => attribute)
|
82
121
|
end
|
83
122
|
end
|
84
123
|
|
85
124
|
class Attribute #:nodoc:
|
86
125
|
|
87
|
-
attr_reader :
|
126
|
+
attr_reader :reflection, :name, :sql, :source
|
88
127
|
|
89
|
-
def initialize(
|
90
|
-
@
|
128
|
+
def initialize(reflection, name, options = {})
|
129
|
+
@reflection = reflection
|
91
130
|
@name = name.to_s
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
raise ArgumentError, "#{@owner} has no association #{from.inspect}" if @reflection.nil?
|
99
|
-
raise ArgumentError, "Piggyback only supports belongs_to and has_one associations" if @reflection.collection?
|
131
|
+
if options[:sql]
|
132
|
+
@sql = Arel.sql(options[:sql])
|
133
|
+
@source = options[:source].to_s if options[:source]
|
134
|
+
else
|
135
|
+
@source = (options[:source] || name).to_s
|
136
|
+
end
|
100
137
|
end
|
101
138
|
|
102
|
-
def
|
103
|
-
unless defined? @
|
104
|
-
@
|
139
|
+
def select
|
140
|
+
unless defined? @select
|
141
|
+
@select = if sql
|
105
142
|
sql.as(Arel.sql(name))
|
106
143
|
elsif source == name
|
107
144
|
reflection.klass.arel_table[name]
|
@@ -109,35 +146,15 @@ module Piggyback
|
|
109
146
|
reflection.klass.arel_table[source].as(Arel.sql(name))
|
110
147
|
end
|
111
148
|
end
|
112
|
-
@
|
113
|
-
end
|
114
|
-
|
115
|
-
def join_sql
|
116
|
-
unless defined? @join_sql
|
117
|
-
join_table = reflection.klass.arel_table
|
118
|
-
|
119
|
-
join = owner.arel_table.join(join_table, Arel::Nodes::OuterJoin)
|
120
|
-
@join_sql = if reflection.belongs_to?
|
121
|
-
join.on(owner.arel_table[reflection.primary_key_name].eq(join_table.primary_key))
|
122
|
-
else
|
123
|
-
join.on(owner.arel_table.primary_key.eq(join_table[reflection.primary_key_name]))
|
124
|
-
end.join_sql
|
125
|
-
end
|
126
|
-
@join_sql
|
149
|
+
@select
|
127
150
|
end
|
128
|
-
|
151
|
+
|
129
152
|
def column
|
130
|
-
|
131
|
-
@column = reflection.klass.columns_hash[source]
|
132
|
-
end
|
133
|
-
@column
|
153
|
+
reflection.klass.columns_hash[source]
|
134
154
|
end
|
135
155
|
|
136
156
|
def serialized_class
|
137
|
-
|
138
|
-
@serialized_class = reflection.klass.serialized_attributes[source]
|
139
|
-
end
|
140
|
-
@serialized_class
|
157
|
+
reflection.klass.serialized_attributes[source]
|
141
158
|
end
|
142
159
|
end
|
143
160
|
end
|
data/piggyback.gemspec
CHANGED
@@ -1,37 +1,40 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "0.
|
4
|
+
s.name = "piggyback"
|
5
|
+
s.version = "0.5.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = [
|
9
|
-
s.date =
|
10
|
-
s.description =
|
11
|
-
s.email =
|
12
|
-
s.extra_rdoc_files = [
|
13
|
-
s.files = [
|
14
|
-
s.homepage =
|
15
|
-
s.rdoc_options = [
|
16
|
-
s.require_paths = [
|
17
|
-
s.rubyforge_project =
|
18
|
-
s.rubygems_version =
|
19
|
-
s.summary =
|
8
|
+
s.authors = ["Andreas Korth"]
|
9
|
+
s.date = "2011-11-19"
|
10
|
+
s.description = "Piggyback attributes from associated models with ActiveRecord"
|
11
|
+
s.email = "andreas.korth@gmail.com"
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "README.markdown", "lib/piggyback.rb"]
|
13
|
+
s.files = ["CHANGELOG", "MIT-LICENSE", "Manifest", "README.markdown", "Rakefile", "lib/piggyback.rb", "piggyback.gemspec", "spec/models.rb", "spec/piggyback_spec.rb", "spec/spec_helper.rb"]
|
14
|
+
s.homepage = "http://github.com/juni0r/piggyback"
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Piggyback", "--main", "README.markdown"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = "piggyback"
|
18
|
+
s.rubygems_version = "1.8.11"
|
19
|
+
s.summary = "Piggyback attributes from associated models with ActiveRecord"
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
22
22
|
s.specification_version = 3
|
23
23
|
|
24
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
-
s.add_runtime_dependency(%q<activerecord>, [">= 3.
|
25
|
+
s.add_runtime_dependency(%q<activerecord>, [">= 3.1.0"])
|
26
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
26
27
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
27
28
|
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
28
29
|
else
|
29
|
-
s.add_dependency(%q<activerecord>, [">= 3.
|
30
|
+
s.add_dependency(%q<activerecord>, [">= 3.1.0"])
|
31
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
30
32
|
s.add_dependency(%q<rspec>, [">= 0"])
|
31
33
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
32
34
|
end
|
33
35
|
else
|
34
|
-
s.add_dependency(%q<activerecord>, [">= 3.
|
36
|
+
s.add_dependency(%q<activerecord>, [">= 3.1.0"])
|
37
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
35
38
|
s.add_dependency(%q<rspec>, [">= 0"])
|
36
39
|
s.add_dependency(%q<sqlite3>, [">= 0"])
|
37
40
|
end
|
data/spec/models.rb
CHANGED
@@ -13,31 +13,47 @@ silence_stream(STDOUT) do
|
|
13
13
|
t.string :last_name
|
14
14
|
t.string :words
|
15
15
|
t.integer :count
|
16
|
+
t.float :salary
|
16
17
|
t.boolean :checked
|
17
18
|
t.date :birthday
|
18
19
|
t.text :baggage
|
19
20
|
|
20
21
|
t.timestamps
|
21
22
|
end
|
23
|
+
|
24
|
+
create_table :features do |t|
|
25
|
+
t.belongs_to :essential
|
26
|
+
t.integer :value
|
27
|
+
t.boolean :active
|
28
|
+
end
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
class Essential < ActiveRecord::Base
|
26
|
-
has_one :detail, :
|
33
|
+
has_one :detail, inverse_of: :essential
|
27
34
|
has_many :details
|
28
35
|
|
29
36
|
piggyback_attr :first_name,
|
30
37
|
:last_name,
|
31
|
-
:count,
|
38
|
+
:count,
|
32
39
|
:checked,
|
33
40
|
:birthday,
|
34
|
-
:baggage,
|
35
|
-
|
36
|
-
|
41
|
+
:baggage,
|
42
|
+
{ :updated => :updated_at },
|
43
|
+
{
|
44
|
+
:name => "details.first_name || ' ' || details.last_name",
|
45
|
+
:monthly => [ "details.salary / 12", :salary ]
|
46
|
+
},
|
47
|
+
from: :detail
|
48
|
+
|
49
|
+
has_one :feature, conditions:{ active:true }
|
50
|
+
has_many :features
|
51
|
+
|
52
|
+
piggyback_attr :value, from: :feature
|
37
53
|
end
|
38
54
|
|
39
55
|
class Detail < ActiveRecord::Base
|
40
|
-
belongs_to :essential, :
|
56
|
+
belongs_to :essential, inverse_of: :detail
|
41
57
|
|
42
58
|
serialize :baggage
|
43
59
|
|
@@ -47,3 +63,7 @@ class Detail < ActiveRecord::Base
|
|
47
63
|
"#{first_name} #{last_name}"
|
48
64
|
end
|
49
65
|
end
|
66
|
+
|
67
|
+
class Feature < ActiveRecord::Base
|
68
|
+
belongs_to :essential, :inverse_of => :detail
|
69
|
+
end
|
data/spec/piggyback_spec.rb
CHANGED
@@ -27,17 +27,29 @@ describe Piggyback do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
it "should respect association options" do
|
31
|
+
essential = Essential.create!
|
32
|
+
Feature.create!(essential_id:essential.id, value:23, active:false)
|
33
|
+
Feature.create!(essential_id:essential.id, value:42, active:true)
|
34
|
+
Feature.create!(essential_id:essential.id, value:45, active:false)
|
35
|
+
|
36
|
+
essential = Essential.piggyback.first
|
37
|
+
essential.value.should eql(42)
|
38
|
+
end
|
39
|
+
|
30
40
|
context "relation" do
|
31
41
|
|
32
42
|
ESSENTIAL_ATTRIBUTES = %w{ id token created_at updated_at }
|
33
|
-
DETAIL_ATTRIBUTES = %w{ first_name last_name
|
34
|
-
|
43
|
+
DETAIL_ATTRIBUTES = %w{ first_name last_name count checked birthday baggage name updated monthly }
|
44
|
+
FEATURE_ATTRIBUTES = %w{ value }
|
45
|
+
ALL_ATTRIBUTES = ESSENTIAL_ATTRIBUTES + DETAIL_ATTRIBUTES + FEATURE_ATTRIBUTES
|
35
46
|
|
36
47
|
before do
|
37
48
|
Essential.create!(:token => "ESSENTIAL").create_detail(
|
38
49
|
:first_name => "John",
|
39
50
|
:last_name => "Doe",
|
40
51
|
:count => 23,
|
52
|
+
:salary => 14_814,
|
41
53
|
:checked => false,
|
42
54
|
:birthday => "18.12.1974",
|
43
55
|
:baggage => {:key => "value"})
|
@@ -68,25 +80,17 @@ describe Piggyback do
|
|
68
80
|
essential = Essential.piggyback(:id, :name).first
|
69
81
|
essential.attributes.keys.should =~ %w{ id name }
|
70
82
|
end
|
71
|
-
|
72
|
-
it "should include all native attributes when using the wildcard :*" do
|
73
|
-
essential = Essential.piggyback(:*).first
|
74
|
-
essential.attributes.keys.should =~ ESSENTIAL_ATTRIBUTES
|
75
|
-
end
|
76
|
-
|
83
|
+
|
77
84
|
it "should include all attributes from the specified associations" do
|
78
85
|
essential = Essential.piggyback(from: :detail).first
|
86
|
+
essential.attributes.keys.should =~ ESSENTIAL_ATTRIBUTES + DETAIL_ATTRIBUTES
|
87
|
+
essential = Essential.piggyback(from: [:detail, :feature]).first
|
79
88
|
essential.attributes.keys.should =~ ALL_ATTRIBUTES
|
80
89
|
end
|
81
90
|
|
82
|
-
it "should include all native attributes and those of the specified associations" do
|
83
|
-
essential = Essential.piggyback(:*, from: :detail).first
|
84
|
-
essential.attributes.keys.should =~ ALL_ATTRIBUTES
|
85
|
-
end
|
86
|
-
|
87
91
|
it "should include native and piggybackd attributes as specified" do
|
88
|
-
essential = Essential.piggyback(:id, :token, :first_name, :last_name).first
|
89
|
-
essential.attributes.keys.should =~ %w{ id token first_name last_name }
|
92
|
+
essential = Essential.piggyback(:id, :token, :first_name, :last_name, :value).first
|
93
|
+
essential.attributes.keys.should =~ %w{ id token first_name last_name value }
|
90
94
|
end
|
91
95
|
|
92
96
|
it "should not include native columns if any were selected before" do
|
@@ -121,12 +125,16 @@ describe Piggyback do
|
|
121
125
|
end
|
122
126
|
|
123
127
|
it "should read a mapped attribute" do
|
124
|
-
essential.
|
128
|
+
essential.updated.should be_instance_of(Time)
|
125
129
|
end
|
126
130
|
|
127
|
-
it "should read computed attributes" do
|
131
|
+
it "should read computed string attributes" do
|
128
132
|
essential.name.should eql("John Doe")
|
129
133
|
end
|
134
|
+
|
135
|
+
it "should read computed float attributes" do
|
136
|
+
essential.monthly.should eql(1234.5)
|
137
|
+
end
|
130
138
|
end
|
131
139
|
end
|
132
140
|
end
|
metadata
CHANGED
@@ -1,103 +1,107 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: piggyback
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Andreas Korth
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: activerecord
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2152819980 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 3.
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.0
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: rspec
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *2152819980
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: echoe
|
27
|
+
requirement: &2152819560 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
35
33
|
type: :development
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: sqlite3
|
39
34
|
prerelease: false
|
40
|
-
|
35
|
+
version_requirements: *2152819560
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &2152819100 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
46
44
|
type: :development
|
47
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2152819100
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sqlite3
|
49
|
+
requirement: &2152818640 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2152818640
|
48
58
|
description: Piggyback attributes from associated models with ActiveRecord
|
49
59
|
email: andreas.korth@gmail.com
|
50
60
|
executables: []
|
51
|
-
|
52
61
|
extensions: []
|
53
|
-
|
54
|
-
extra_rdoc_files:
|
62
|
+
extra_rdoc_files:
|
55
63
|
- CHANGELOG
|
56
64
|
- README.markdown
|
57
65
|
- lib/piggyback.rb
|
58
|
-
files:
|
66
|
+
files:
|
59
67
|
- CHANGELOG
|
60
68
|
- MIT-LICENSE
|
61
69
|
- Manifest
|
62
70
|
- README.markdown
|
63
71
|
- Rakefile
|
64
72
|
- lib/piggyback.rb
|
65
|
-
- piggyback.
|
73
|
+
- piggyback.gemspec
|
66
74
|
- spec/models.rb
|
67
75
|
- spec/piggyback_spec.rb
|
68
76
|
- spec/spec_helper.rb
|
69
|
-
- piggyback.gemspec
|
70
77
|
homepage: http://github.com/juni0r/piggyback
|
71
78
|
licenses: []
|
72
|
-
|
73
79
|
post_install_message:
|
74
|
-
rdoc_options:
|
80
|
+
rdoc_options:
|
75
81
|
- --line-numbers
|
76
82
|
- --inline-source
|
77
83
|
- --title
|
78
84
|
- Piggyback
|
79
85
|
- --main
|
80
86
|
- README.markdown
|
81
|
-
require_paths:
|
87
|
+
require_paths:
|
82
88
|
- lib
|
83
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
90
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version:
|
89
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
96
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version:
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '1.2'
|
95
101
|
requirements: []
|
96
|
-
|
97
102
|
rubyforge_project: piggyback
|
98
|
-
rubygems_version: 1.8.
|
103
|
+
rubygems_version: 1.8.11
|
99
104
|
signing_key:
|
100
105
|
specification_version: 3
|
101
106
|
summary: Piggyback attributes from associated models with ActiveRecord
|
102
107
|
test_files: []
|
103
|
-
|
data/piggyback.tmproj
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
-
<plist version="1.0">
|
4
|
-
<dict>
|
5
|
-
<key>currentDocument</key>
|
6
|
-
<string>lib/piggyback.rb</string>
|
7
|
-
<key>documents</key>
|
8
|
-
<array>
|
9
|
-
<dict>
|
10
|
-
<key>expanded</key>
|
11
|
-
<true/>
|
12
|
-
<key>name</key>
|
13
|
-
<string>piggyback</string>
|
14
|
-
<key>regexFileFilter</key>
|
15
|
-
<string>!.*\.(lock|rvmrc|tmproj|gemspec)|(Manifest)</string>
|
16
|
-
<key>regexFolderFilter</key>
|
17
|
-
<string>!.*/(\.[^/]*|tmp|pkg|log|doc)$</string>
|
18
|
-
<key>sourceDirectory</key>
|
19
|
-
<string></string>
|
20
|
-
</dict>
|
21
|
-
</array>
|
22
|
-
<key>fileHierarchyDrawerWidth</key>
|
23
|
-
<integer>202</integer>
|
24
|
-
<key>metaData</key>
|
25
|
-
<dict>
|
26
|
-
<key>README.markdown</key>
|
27
|
-
<dict>
|
28
|
-
<key>caret</key>
|
29
|
-
<dict>
|
30
|
-
<key>column</key>
|
31
|
-
<integer>288</integer>
|
32
|
-
<key>line</key>
|
33
|
-
<integer>77</integer>
|
34
|
-
</dict>
|
35
|
-
<key>columnSelection</key>
|
36
|
-
<false/>
|
37
|
-
<key>firstVisibleColumn</key>
|
38
|
-
<integer>152</integer>
|
39
|
-
<key>firstVisibleLine</key>
|
40
|
-
<integer>54</integer>
|
41
|
-
<key>selectFrom</key>
|
42
|
-
<dict>
|
43
|
-
<key>column</key>
|
44
|
-
<integer>298</integer>
|
45
|
-
<key>line</key>
|
46
|
-
<integer>77</integer>
|
47
|
-
</dict>
|
48
|
-
<key>selectTo</key>
|
49
|
-
<dict>
|
50
|
-
<key>column</key>
|
51
|
-
<integer>288</integer>
|
52
|
-
<key>line</key>
|
53
|
-
<integer>77</integer>
|
54
|
-
</dict>
|
55
|
-
</dict>
|
56
|
-
<key>lib/piggyback.rb</key>
|
57
|
-
<dict>
|
58
|
-
<key>caret</key>
|
59
|
-
<dict>
|
60
|
-
<key>column</key>
|
61
|
-
<integer>16</integer>
|
62
|
-
<key>line</key>
|
63
|
-
<integer>96</integer>
|
64
|
-
</dict>
|
65
|
-
<key>firstVisibleColumn</key>
|
66
|
-
<integer>0</integer>
|
67
|
-
<key>firstVisibleLine</key>
|
68
|
-
<integer>72</integer>
|
69
|
-
</dict>
|
70
|
-
<key>spec/models.rb</key>
|
71
|
-
<dict>
|
72
|
-
<key>caret</key>
|
73
|
-
<dict>
|
74
|
-
<key>column</key>
|
75
|
-
<integer>44</integer>
|
76
|
-
<key>line</key>
|
77
|
-
<integer>1</integer>
|
78
|
-
</dict>
|
79
|
-
<key>columnSelection</key>
|
80
|
-
<false/>
|
81
|
-
<key>firstVisibleColumn</key>
|
82
|
-
<integer>0</integer>
|
83
|
-
<key>firstVisibleLine</key>
|
84
|
-
<integer>0</integer>
|
85
|
-
<key>selectFrom</key>
|
86
|
-
<dict>
|
87
|
-
<key>column</key>
|
88
|
-
<integer>29</integer>
|
89
|
-
<key>line</key>
|
90
|
-
<integer>1</integer>
|
91
|
-
</dict>
|
92
|
-
<key>selectTo</key>
|
93
|
-
<dict>
|
94
|
-
<key>column</key>
|
95
|
-
<integer>44</integer>
|
96
|
-
<key>line</key>
|
97
|
-
<integer>1</integer>
|
98
|
-
</dict>
|
99
|
-
</dict>
|
100
|
-
<key>spec/piggyback_spec.rb</key>
|
101
|
-
<dict>
|
102
|
-
<key>caret</key>
|
103
|
-
<dict>
|
104
|
-
<key>column</key>
|
105
|
-
<integer>0</integer>
|
106
|
-
<key>line</key>
|
107
|
-
<integer>0</integer>
|
108
|
-
</dict>
|
109
|
-
<key>firstVisibleColumn</key>
|
110
|
-
<integer>0</integer>
|
111
|
-
<key>firstVisibleLine</key>
|
112
|
-
<integer>0</integer>
|
113
|
-
</dict>
|
114
|
-
<key>spec/spec_helper.rb</key>
|
115
|
-
<dict>
|
116
|
-
<key>caret</key>
|
117
|
-
<dict>
|
118
|
-
<key>column</key>
|
119
|
-
<integer>19</integer>
|
120
|
-
<key>line</key>
|
121
|
-
<integer>4</integer>
|
122
|
-
</dict>
|
123
|
-
<key>firstVisibleColumn</key>
|
124
|
-
<integer>0</integer>
|
125
|
-
<key>firstVisibleLine</key>
|
126
|
-
<integer>0</integer>
|
127
|
-
</dict>
|
128
|
-
</dict>
|
129
|
-
<key>openDocuments</key>
|
130
|
-
<array>
|
131
|
-
<string>spec/piggyback_spec.rb</string>
|
132
|
-
<string>README.markdown</string>
|
133
|
-
<string>spec/models.rb</string>
|
134
|
-
<string>spec/spec_helper.rb</string>
|
135
|
-
<string>lib/piggyback.rb</string>
|
136
|
-
</array>
|
137
|
-
<key>showFileHierarchyDrawer</key>
|
138
|
-
<false/>
|
139
|
-
<key>showFileHierarchyPanel</key>
|
140
|
-
<true/>
|
141
|
-
<key>treeState</key>
|
142
|
-
<dict>
|
143
|
-
<key>piggyback</key>
|
144
|
-
<dict>
|
145
|
-
<key>isExpanded</key>
|
146
|
-
<true/>
|
147
|
-
<key>subItems</key>
|
148
|
-
<dict>
|
149
|
-
<key>lib</key>
|
150
|
-
<dict>
|
151
|
-
<key>isExpanded</key>
|
152
|
-
<true/>
|
153
|
-
<key>subItems</key>
|
154
|
-
<dict/>
|
155
|
-
</dict>
|
156
|
-
<key>spec</key>
|
157
|
-
<dict>
|
158
|
-
<key>isExpanded</key>
|
159
|
-
<true/>
|
160
|
-
<key>subItems</key>
|
161
|
-
<dict/>
|
162
|
-
</dict>
|
163
|
-
</dict>
|
164
|
-
</dict>
|
165
|
-
</dict>
|
166
|
-
<key>windowFrame</key>
|
167
|
-
<string>{{93, 131}, {1568, 1024}}</string>
|
168
|
-
</dict>
|
169
|
-
</plist>
|