This works, but I am sure there is a better way todo this:

  # GET /posts/1/edit
  def edit
    @post = Post.find(params[:id])
    # Find user galleries that have not been used in posts yet
    usergalleries = Array.new
    @post.user.galleries.each do |pug|
        usergalleries << pug.id
    end
    userpostgalleries = Array.new
    @post.user.posts.each do |pup|
        userpostgalleries << pup.gallery_id
    end
    aug = usergalleries - userpostgalleries
    @availableusergalleries = @post.user.galleries.find
(:all, :conditions => { :id => aug })
  end

Any ideas?

Regards
Arwed

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to