File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
spec/example/config/initializers Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -55,11 +55,21 @@ def default_name
5555 end
5656 end
5757
58+ def self . camelize_without_inflection ( val )
59+ vals = val . split ( "_" )
60+ if vals . length == 1
61+ vals [ 0 ]
62+ else
63+ ( [ vals [ 0 ] ] + vals [ 1 ..] . map ( &:capitalize ) ) . join ( "" )
64+ end
65+ end
66+
5867 # @param value [String, Symbol]
5968 # @return [String]
6069 def self . convert_case ( value )
6170 case Anchor . config . field_case
6271 when :camel then value . to_s . underscore . camelize ( :lower )
72+ when :camel_without_inflection then camelize_without_inflection ( value . to_s . underscore )
6373 when :kebab then value . to_s . underscore . dasherize
6474 when :snake then value . to_s . underscore
6575 else value
Original file line number Diff line number Diff line change 11module Anchor
22 configure do |c |
3- c . field_case = :camel
3+ c . field_case = :camel_without_inflection
44 c . use_active_record_comment = true
55 c . use_active_record_presence = true
66 c . infer_nullable_relationships_as_optional = true
You can’t perform that action at this time.
0 commit comments