title: How to parse an array to json using ruby on rails
body: <p>I'm trying to parse a hash to json but in the index.json.jbuilder I get empty hash.</p>
  
  <p><strong>what am I doing wrong:</strong></p>
  
  <pre><code>  def self.fake_objects 
  
      fake_objects = {id: 1,
                    title: 'appointment one',
                    description: 'bla bla bla',
                    start_time: '2014-08-19 14:00:00.000000000 Z',
                    end_time: '2014-08-19 14:30:00.000000000 Z'}  
    end 
  </code></pre>
  
  <p>events_controller</p>
  
  <pre><code>  def index
      @events = Event.all
      @fake_objects = Event.fake_objects 
    end
  </code></pre>
  
  <p>index.json.jbuilder</p>
  
  <pre><code>(@fake_objects).to_json do |event|
    json.extract! event, :id, :title, :description
    json.start event.start_time
    json.end event.end_time
    json.url event_url(event, format: :html)
  end
  
  class Event &lt; ActiveRecord::Base
    def self.fake_objects 
      fake_objects = Event.new(id: 1,
                    title: 'appointment one',
                    description: 'bla bla bla',
                    start_time: '2014-08-19 14:00:00.000000000 Z',
                    end_time: '2014-08-19 14:30:00.000000000 Z')
    end 
  end
  </code></pre>