Skip to content

Instantly share code, notes, and snippets.

@frankie-loves-jesus
Created August 8, 2014 22:51
Show Gist options
  • Save frankie-loves-jesus/4774a4f86ebcf7bc3882 to your computer and use it in GitHub Desktop.
Save frankie-loves-jesus/4774a4f86ebcf7bc3882 to your computer and use it in GitHub Desktop.
class MainController < ApplicationController
require 'hashie'
def index
@json_text = <<END
{
"products": []
}
END
hashes = JSON.parse(@json_text)
mashes = Hashie::Mash.new(hashes)
products = []
mashes.products.fetch('products', []).each do |mash|
puts "YOLO"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment