Forum: Ruby on Rails update subset of my data

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
woodie63 (Guest)
on 2006-03-27 14:51
Please can someone put me out of my misery...
I am missing the point here:

I have a table of albums called: dealers
I have a table of images: popp_images

each dealer has 6 popp_images linked by foriegn key: albumid

Each dealer can login using user_engine engine
I restrict viewing for each dealer to their own images by assigning each
dealer their own albumid.

I list their images with:

in my controller:

def list
     @dealers = Dealer.find_all
     @dealer = current_user.albumid
    @popp_image_pages, @popp_images = paginate :popp_images, :per_page
=> 10

in my view:

odd_or_even = 0
for popp_image in @popp_images
odd_or_even = 1 - odd_or_even
<% if (@dealer == nil) || (@dealer == popp_image.albumid)%>

this works fine.

I am stuck on updating multiple pop_images i.e the whole six in the
album (dealer)
here's what I have:

def update

     # @dealer assign to current users albumid
     @dealer = current_user.albumid
     @dealers = Dealer.find(params[:id], :include => :dealer)
     @dealer_images = PoppImage.find(params[:id], :include => :dealers)

    if @popp_image.update_attributes(params[:popp_image])
      flash[:notice] = 'Your image was successfully updated.'
      redirect_to :action => 'show', :id => @popp_image
      render :action => 'edit'

I get: Couldn't find Dealer without an ID

probably dumb but.....
any ideas?

This topic is locked and can not be replied to.