Improved to_app_model.
This commit is contained in:
parent
b3bda95b7c
commit
d6d21e6cfe
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
||||||
class Class
|
class Class
|
||||||
def to_app_model
|
def to_app_model
|
||||||
name = self.to_s.downcase
|
camel_cased_word = self.to_s
|
||||||
name.gsub( /::/, '_' )
|
camel_cased_word.gsub(/::/, '_').
|
||||||
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
||||||
|
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
||||||
|
tr("-", "_").
|
||||||
|
downcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue