3

Is it possbile with RABL to set the key names dynamically? I am trying to out put in the following format...

snippet_1: {name: 'map', options: {'options[postcode]': "SW64TY"}}, snippet_2: {name: 'map', options: {'options[postcode]': "GU78YU"}}

and i have the following in by rabl view:

collection @snippets => 'snippets'
attribute :snippet_type => :name
attribute :options => :options
attribute :snippet_id => :id

my table looks like:

  create_table "snippet_instances", :force => true do |t|
    t.string   "snippet_type"
    t.text     "options"
    t.integer  "page_id"
    t.string   "snippet_id"
    t.datetime "created_at",   :null => false
    t.datetime "updated_at",   :null => false
  end

options is serialized

many thanks

nodrog
  • 3,532
  • 2
  • 25
  • 31

0 Answers0