Strange MySQL data populating

I am getting weird data when trying to use HABTM.

I have a Images table with columns id, title, and file.
I have a Categories table with columns id, name.
I have a join table for them with image_id, and category_id

when I do @images.inspect I get:

[#“image 1”, “id”=>“52”, “portrait”=>“0”,
“file”=>“balcony_flowers.jpg”}>, #“image 2”, “id”=>“53”,
“portrait”=>“0”, “file”=>“autumn_parked_car.jpg”}>, #“image 3”,
“id”=>“54”, “portrait”=>“0”, “file”=>“autumn_parked_car.jpg”}>]

which is strange because shouldn’t it come out ‘title’=>‘image 1’ and
not #‘image 1’?

Though if I loop and do
<% for image in @images %>
<%= image.title %>,
<% end %>

I retrieve Image 1, Image 2, Image 3

Anyway, I guess the join table doesn’t come into play, but I originally
thought it might have something to do with it.

Help is much appreciated!

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs