Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Motion Support give inflector support much more robust pluarlization; CamelCase support as well #3

Merged
merged 1 commit into from

2 participants

@hookercookerman

for instance "Activity" becomes "Activities"

@clayallsopp
Owner

Very cool! Thanks for the request and MotionSupport in general

@clayallsopp clayallsopp merged commit f244962 into clayallsopp:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 23, 2012
  1. @hookercookerman
This page is out of date. Refresh to see the latest.
View
4 lib/remote_model.rb
@@ -1,5 +1,7 @@
require "remote_model/version"
require 'bubble-wrap'
+require "motion_support/inflector"
+
Dir.glob(File.join(File.dirname(__FILE__), 'remote_model/*.rb')).each do |file|
BW.require file
-end
+end
View
4 lib/remote_model/record.rb
@@ -22,7 +22,7 @@ def find_all(params = {}, &block)
if json.class == Array
arr_rep = json
elsif json.class == Hash
- plural_sym = self.pluralize.to_sym
+ plural_sym = self.pluralize.downcase.to_sym
if json.has_key? plural_sym
arr_rep = json[plural_sym]
end
@@ -73,4 +73,4 @@ def destroy(&block)
end
end
end
-end
+end
View
4 lib/remote_model/remote_model.rb
@@ -33,7 +33,7 @@ def belongs_to(params = [])
end
def pluralize
- self.to_s.downcase + "s"
+ self.to_s.pluralize
end
def method_missing(method, *args, &block)
@@ -215,4 +215,4 @@ def setter_klass(hash, symbol)
[klass, hash_symbol]
end
end
-end
+end
View
9 lib/remote_model/string.rb
@@ -1,9 +0,0 @@
-class String
- def pluralize
- self + "s"
- end
-
- def singularize
- self[0..-2]
- end
-end
View
3  remote_model.gemspec
@@ -15,5 +15,6 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.add_dependency "bubble-wrap"
+ s.add_dependency "motion_support"
s.add_development_dependency 'rake'
-end
+end
Something went wrong with that request. Please try again.