On Sat, Jan 31, 2009 at 6:58 AM, [email protected]
<[email protected]> wrote:
>
> Maybe its since I am using the feed items differently than they were
> supposed to I am asking myself what the setup method is trying to do:
>
> def setup
>    @profile = Profile[params[:profile_id]]
>    if @p != @profile
>      respond_to do |wants|
>        wants.html do
>          flash[:notice] = "Sorry, you can't do that."
>          redirect_back_or_default @profile
>        end
>        wants.js { render(:update){|page| page.alert "Sorry, you can't
> do that."}}
>      end
>    end
>  end
>
> It seems originally feed items are supposed to show up on each other
> user profile pages. Through generally missleading @p stands for my
> profile and @profile for the profile I am visiting. So if I am
> visiting somebodys elses profile and want to delete a feed item i get
> an error message and get redirected to the profile I was looking at.
> Is that the purpose?

Yes.

>
> I have to menthion that the destroy method:
>
>  def destroy
>    @profile.feeds.find(:first, :conditions => {:feed_item_id=>params
> [:id]}).destroy
>
>    respond_to do |wants|
>      wants.html do
>        flash[:notice] = 'Item successfully removed from the recent
> activities list.'
>        redirect_back_or_default @profile
>      end
>      wants.js { render(:update){|page| page.visual_effect :puff,
> "feed_item_#{params[:id]}".to_sym}}
>    end
>  end
>
> Tries to find feeds on the profile I am seeing right now.

Right, again.


>
> What I was wondering about too is that the feed_helper is calling the
> method delete instead of destroy but that might be ruby conventions
> that it gets redirected to the destroy method.
>
> link_to_remote image_tag('delete.png', :class =>
> 'png', :width=>'12', :height=>'12'), :url => profile_feed_item_path
> (@profile, feed_item), :method => :delete

:method=>:delete refers to the HTTP Method "delete," not an action
named "delete." Rails wires it up so that this will call the destroy
action. There are plenty of good blog post on restful rails, I
recommend find a few as a great place to start.


cheers,
steven bristol

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Lovd by Less" 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/lovdbyless?hl=en
Who loves ya baby?
-~----------~----~----~----~------~----~------~--~---

Reply via email to