I have a question that how to take a list of user on user table
def show_pic
@id = User.find(:all, :select => ‘users.id’) @id.each do |i| @pic = ActiveRecord::Base.connection.select_value(
select picture
from albums a
inner join Users u
on u.id = a.id
where u.id = i )
end
end
I don’t see what you are trying to achieve here. Surely you just have a
list of Users:
User.all
Given Users has_many :albums, you could handle this in the view along
with pictures. To limit the number of requests to the database, make
sure to include the associations:
User.all.include :albums
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.