Needed a similar fix in comments_controller#index

  def index

    @commentable = comment_type.constantize.find(comment_id)

    if comment_type == 'Photo'
      @commentable = @commentable.parent if @commentable.parent
    end


On Apr 1, 5:33 pm, sprite <[email protected]> wrote:
> Meant Bornsztein no idea why I typed Boritz... Sorry.
>
> On Apr 1, 5:29 pm, sprite <[email protected]> wrote:
>
> > Just a recommendation. I noticed the behavior on TennisMetro.com is
> > the same. Since for each picture you upload it generates 3 thumbnails,
> > if you try to view those through show it causes a server error.
> > (Crashes on @photo.previous_photo)
>
> > I ended up doing this
>
> >   def show
> >     @photo = Photo.find(params[:id])
> >     @photo = @photo.parent if @photo.parent # If this is a thumbnail
> > set the photo to the parent pic.
> >     if @photo
> >       @user = @photo.user
> >       @album = @photo.album
> >       @is_current_user = @user.eql?(current_user)
> >       @comment = Comment.new(params[:comment])
>
> >       @previous = @photo.previous_photo
> >       @next = @photo.next_photo
> >       @related = Photo.find_related_to(@photo)
>
> >      respond_to do |format|
> >         format.html # show.rhtml
> >      end
> >     end
>
> >     rescue ActiveRecord::RecordNotFound
> >       flash[:error] = "The picture was not found."
> >       redirect_to :controller => 'base', :action => 'site_index'
> >   end
>
> > Of course your code will be slightly different since you don't have
> > albums.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" 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/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to