in_place_relation 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module InPlaceRelation
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -9,9 +9,12 @@ require "in_place_relation/version"
9
9
  #
10
10
  # you can do this
11
11
  # rel = SomeModel.where( ... ).in_place
12
- # rel.joins!().where!() if x
13
- # rel.select!() unless y
12
+ # rel.joins().where() if x
13
+ # rel.select() unless y
14
14
  # rel.all
15
+ #
16
+ # and get original relation with:
17
+ # rel.relation # ActiveRecord::Relation
15
18
  module InPlaceRelation
16
19
 
17
20
  module Methods
@@ -25,14 +28,10 @@ module InPlaceRelation
25
28
 
26
29
  attr_reader :relation
27
30
 
28
- METHODS_TO_WRAP = ActiveRecord::Relation::ASSOCIATION_METHODS + ActiveRecord::Relation::MULTI_VALUE_METHODS + ActiveRecord::Relation::SINGLE_VALUE_METHODS
31
+ METHODS_TO_WRAP = ActiveRecord::Relation::ASSOCIATION_METHODS + ActiveRecord::Relation::MULTI_VALUE_METHODS + ActiveRecord::Relation::SINGLE_VALUE_METHODS + [:merge]
29
32
 
30
33
  METHODS_TO_WRAP.each do |meth|
31
34
  define_method( meth ) do |*args|
32
- return @relation.send( meth, *args )
33
- end
34
-
35
- define_method( "#{meth}!" ) do |*args|
36
35
  @relation = @relation.send( meth, *args )
37
36
  return self
38
37
  end
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 0.0.2
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marek Janukowicz/Starware
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-22 00:00:00 +01:00
18
+ date: 2011-11-28 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency