Guest User

Untitled

a guest
Apr 26th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. Use helper select or select_tag with JSON on Rails 3.2.1
  2. [{"id":"197630", "name":"JOHN PERS"} , {"id":"6", "name":"JOSHUA JOSH"}]
  3.  
  4. @parsed_json = ActiveSupport::JSON.decode(@listJson)
  5.  
  6. <% collection = options_for_select(ActiveSupport::JSON.decode(@list_json).map { |b| [b["name"], b["id"]] }) %>
  7. <%= f.select :name, collection %>
Advertisement
Add Comment
Please, Sign In to add comment