i\'m trying to_json in the following way
@own_events.as_json(:include => {:created_date => {},:attendees => {}, :user => {}, :start_times => {},
:include is used to include associations in the json, usually has_many or belongs_to associations.
:include
has_many
belongs_to
To include methods like created_date, use methods:
created_date
methods:
Such as:
@own_events.as_json(include: [:attendees, :user, :start_times, :end_times], methods: :created_date )