Method: Growth::ApplicationHelper#get_grouped_options

Defined in:
app/helpers/growth/application_helper.rb

#get_grouped_options(resources) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/growth/application_helper.rb', line 5

def get_grouped_options(resources)
  resources.map do |model|
    [
        model,
        model.reflect_on_all_associations(:has_many).map do |reflection|
          name = reflection.name.to_s.singularize.camelize
          [name, "#{model}-#{name}"]
        end
    ]
  end
end