Oh, ok, then, instead of:
@photo = Photo.find(params[:id])
it shoudl be:
@photo = @user.photos.find(params[:id])
On Tue, Apr 7, 2009 at 10:01 AM, <[email protected]> wrote:
> Right. It happens if you put in the idd manually
>
> Sent via BlackBerry by AT&T
>
> ------------------------------
> *From*: Bruno Bornsztein
> *Date*: Tue, 7 Apr 2009 09:51:15 -0500
> *To*: <[email protected]>
> *Subject*: [CommunityEngine] Re: Boritz: Suggested improvement to
> photos_controller#show
>
> I'm not seeing this behavior. Perhaps it you have some local modifications
> that are causing this?
> If you look in you photos table, you should see that the thumbnailed photos
> don't have a user_id assigned, which means they shouldn't come up in
> photo.previous_photo or next_photo.
>
> Thanks,
> Bruno
>
> On Sat, Apr 4, 2009 at 12:24 PM, sprite <[email protected]> wrote:
>
>>
>> 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
-~----------~----~----~----~------~----~------~--~---