Module: DeepPluck::Model::Helper

Defined in:
lib/deep_pluck/model.rb

Overview


● Helper methods


Constant Summary collapse

TO_KEY_PROC =
proc{|s| Helper.column_to_key(s) }

Class Method Summary collapse

Class Method Details

.column_to_key(key) ⇒ Object

user_achievements.user_id => user_id



227
228
229
230
231
# File 'lib/deep_pluck/model.rb', line 227

def self.column_to_key(key) # user_achievements.user_id => user_id
  key = key[/(\w+)[^\w]*\z/]
  key.gsub!(/[^\w]+/, '')
  return key
end