error of looping in rails

Hi, I am writing this code in purpose that i can i select image from the picture table and i want to get all the user so i can loop through user1 , user2 ....

and display the pic on bowers..

def show_image

    @id = User.find(:all, :select => 'user.id')

    for id in @id

        @image = ActiveRecord::Base.connection.select_value('select image from Picture pic    inner join Cultures c on pic.culture_id = c.id    inner join user pt on pt.id = p.user    where pt.id = "id"');

    end

   send_data @image, :type => 'image/png', :disposition => 'inline'     end

and i get an error "(SQLite3::SQLException: ambiguous column name: id: "

Please help and give me some advices.. Big thanks for all

Amritpal, please stop posting several messages asking the same thing. If you have more info to add, contribute to your original thread.

Hi, I am writing this code in purpose that i can i select image from the picture table and i want to get all the user so i can loop through user1 , user2 ....

and display the pic on bowers..

Please help and give me some advices.. Big thanks for all

Why aren't you using the associations you have set up in your model to loop pictures?

Your table names seem all over the place: capital letters and singular names... it's not going to help the Rails magic to work.

If you just want an array of user ids:   @ids = User.find(:all).map(&:id)

...but I really doubt that your approach is the best one (or even a good one). You should be doing something along the lines of:

# controller code @users = User.all

# view code @users.each do |user|   # you can render user name, etc here   user.albums.each do |album|     # access to album info here     album.pictures.each do |picture|       # some picture stuff here     end   end end

but... it may be best for you to take a moment, flick back to page 1 of Agile Web Development With Rails, and work quietly through the tutorial again.

This is not my post

Thank you very much

Of course not.... I believe you (from your new email address...). I'm sorry.

It doesn't help when Joanne/Yennie keeps changing their display name with every posting.... you can understand our confusion (what with the four-or-more identities you post under, you must get very confused yourself :-/