Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- w/merb:
- (rdb:1) blah = {}
- {}
- (rdb:1) images = [{:src => '1', :href => '1' }, {:src => '2', :href => '2' }]
- [{:href=>"1", :src=>"1"}, {:href=>"2", :src=>"2"}]
- (rdb:1) blah[:images] = images
- [{:href=>"1", :src=>"1"}, {:href=>"2", :src=>"2"}]
- (rdb:1) blah.to_json
- TypeError Exception: wrong argument type Hash (expected Data)
- w/irb:
- ruby: main
- >> blah = {}
- # => {}
- ruby: main
- >> images = [{:src => '1', :href => '1' }, { :src => '2', :href => '2' }]
- # => [{:href=>"1", :src=>"1"}, {:href=>"2", :src=>"2"}]
- ruby: main
- >> blah[:images] = images
- # => [{:href=>"1", :src=>"1"}, {:href=>"2", :src=>"2"}]
- ruby: main
- >> blah.to_json
- # => "{\"images\":[{\"href\":\"1\",\"src\":\"1\"},{\"href\":\"2\",\"src\":\"2\"}]}"
Add Comment
Please, Sign In to add comment