cowtech-rails 1.7.5.0 → 1.7.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -237,43 +237,45 @@ module Math
237
237
  end
238
238
  end
239
239
 
240
- class ActiveRecord::Base
241
- def self.table_prefix
242
- p = ActiveRecord::Base.configurations[Rails.env]["table_prefix"]
243
- !p.blank? ? p + "_" : ""
244
- end
240
+ if defined?(ActiveRecord) then
241
+ class ActiveRecord::Base
242
+ def self.table_prefix
243
+ p = ActiveRecord::Base.configurations[Rails.env]["table_prefix"]
244
+ !p.blank? ? p + "_" : ""
245
+ end
245
246
 
246
- def self.table_suffix
247
- p = ActiveRecord::Base.configurations[Rails.env]["table_suffix"]
248
- !p.blank? ? p + "_" : ""
249
- end
247
+ def self.table_suffix
248
+ p = ActiveRecord::Base.configurations[Rails.env]["table_suffix"]
249
+ !p.blank? ? p + "_" : ""
250
+ end
250
251
 
251
- def self.set_table_name(value = nil, &block)
252
- define_attr_method :table_name, "#{ActiveRecord::Base.table_prefix}#{value}#{ActiveRecord::Base.table_suffix}", &block
253
- end
252
+ def self.set_table_name(value = nil, &block)
253
+ define_attr_method :table_name, "#{ActiveRecord::Base.table_prefix}#{value}#{ActiveRecord::Base.table_suffix}", &block
254
+ end
254
255
 
255
- def self.find_or_create(oid, attributes = nil)
256
- begin
257
- self.find(oid)
258
- rescue ActiveRecord::RecordNotFound
259
- self.new(attributes)
256
+ def self.find_or_create(oid, attributes = nil)
257
+ begin
258
+ self.find(oid)
259
+ rescue ActiveRecord::RecordNotFound
260
+ self.new(attributes)
261
+ end
260
262
  end
261
- end
262
263
 
263
- def self.safe_find(oid)
264
- begin
265
- rv = self.find(oid)
266
- rescue ActiveRecord::RecordNotFound
267
- nil
264
+ def self.safe_find(oid)
265
+ begin
266
+ rv = self.find(oid)
267
+ rescue ActiveRecord::RecordNotFound
268
+ nil
269
+ end
268
270
  end
269
- end
270
271
 
271
- def self.random
272
- c = self.count
273
- c != 0 ? self.find(:first, :offset => rand(c)) : nil
274
- end
272
+ def self.random
273
+ c = self.count
274
+ c != 0 ? self.find(:first, :offset => rand(c)) : nil
275
+ end
275
276
 
276
- def self.per_page
277
- 25
277
+ def self.per_page
278
+ 25
279
+ end
278
280
  end
279
- end
281
+ end
@@ -9,7 +9,7 @@ module Cowtech
9
9
  module Version
10
10
  MAJOR = 1
11
11
  MINOR = 7
12
- PATCH = 5
12
+ PATCH = 6
13
13
  BUILD = 0
14
14
 
15
15
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cowtech-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.5.0
4
+ version: 1.7.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-22 00:00:00.000000000Z
12
+ date: 2011-06-30 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: A general purpose Rails utility plugin.
15
15
  email: shogun_panda@me.com