Within a controller, I have this code:
@placements = []
empty_placement = {
'placement' => {
'competition_id' => '',
'division_id' => '',
'dancetype_id' => '',
'leader_id' => '',
'leader_name' => '',
'follower_id' => '',
'follower_name' => '',
'rank' => '',
'result' => '',
'leader_points' => '',
'follower_points' => ''
}
}
@placements << empty_placement
@placements << empty_placement
@placements << empty_placement
respond_to do |format|
format.json{ render :json => @placements }
end
The problem: It returns an array like this
[{},{},{}]
I'm obviously doing something wrong, but just can't spot it.
Thanks for any light you're able to shed on this.