Module: Admin::BlocksHelper

Defined in:
app/helpers/admin/blocks_helper.rb

Constant Summary collapse

@@db_choices =
[ 'gallery','snippet','menu','form', 'ad_unit', 'ad_zone' ]

Instance Method Summary collapse

Instance Method Details

#db_choice(name) ⇒ Object



2
3
4
5
6
7
# File 'app/helpers/admin/blocks_helper.rb', line 2

def db_choice(name)
  klass = Object::const_get(name.singularize.camelize)
  field_name = name=='form' ? :title : :name

  options_from_collection_for_select(klass.order(field_name).all, :id, field_name) 
end

#is_db_choice?(type) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/helpers/admin/blocks_helper.rb', line 11

def is_db_choice?(type)
  @@db_choices.include?(type.singularize)  
end