rails3_bridge 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,6 +3,32 @@ Rails 3 Bridge
3
3
 
4
4
  Adds Rails 3 style methods to ActiveRecord::Base.
5
5
 
6
+ Example
7
+ -------
8
+
9
+ log_entries
10
+ -----------
11
+ id
12
+ session_id
13
+ page
14
+ created_at
15
+
16
+ LogEntry.select("session_id, COUNT(*) as hits").group("session_id").having("hits > 5").where("created_at > ?", 1.day.ago).all
17
+
18
+
19
+ scope
20
+ =====
21
+
22
+ It's a protected method in ActiveRecord::Base. So, you still have to use named_scope in Rails 2. You can use Rails 3 style scopes though.
23
+
24
+ class LogEntry < ActiveRecord::Base
25
+ named_scope :home_page, where(:page => '/')
26
+ end
27
+
28
+ LogEntry.home_page.all
29
+
30
+ Right now you can not due, named_scope :newest_home_page_views, where(:page => '/').order('created_at DESC').
31
+
6
32
  Contributing to rails3_bridge
7
33
  =============================
8
34
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/rails3_bridge.rb CHANGED
@@ -35,5 +35,10 @@ module ActiveRecord
35
35
  def self.having(arg)
36
36
  self.scoped :having => arg
37
37
  end
38
+
39
+ def self.named_scope(name, options={}, &block)
40
+ options = options.proxy_options if options.respond_to?(:proxy_options)
41
+ super(name, options, &block)
42
+ end
38
43
  end
39
44
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails3_bridge}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Doug Youch"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails3_bridge
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Doug Youch