I knew the answer was gonna be simple and embarrassing! Thank you very much, Jim..
Emre 2010/1/6 Jim Ruther Nill <[email protected]> > This is the pages_controller right? If you look at the require_moderator > method, it sets the @page variable. And since the require_moderator is > called as a before filter, the require_moderator method will be executed > first before going to the destroy action. > > > On Wed, Jan 6, 2010 at 3:15 PM, Emre Akkas <[email protected]> wrote: > >> Thanks for the response, Jim but even though there is a before_filter, it >> does not declare a @page object >> >> 2010/1/5 Jim Ruther Nill <[email protected]> >> >> There could be a before_filter function that looks for the @page variable. >>> >>> On Wed, Jan 6, 2010 at 9:59 AM, Emre Akkas <[email protected]> wrote: >>> >>>> The answer to this is probably pretty obvious but I am new to Rails >>>> overall and cannot seem to be able to figure this out. >>>> >>>> In a typical edit, or update method we first find the object that we >>>> will be working with >>>> >>>> def edit >>>> @user = User.find(params[:id]) >>>> . >>>> . >>>> end >>>> >>>> Then we do whatever we need to do with this object. >>>> >>>> In the pages controller of Community Engine, these objects magically >>>> appear themselves >>>> >>>> def destroy >>>> @page.destroy >>>> flash[:notice] = :page_was_successfully_deleted.l >>>> redirect_to admin_pages_path >>>> end >>>> >>>> How does this destroy method know which object to destroy? This really >>>> puzzled me as I am trying to add a similar object to pages to my >>>> application >>>> and it does not work if I simply follow the methods that are defined in >>>> pages_controller.rb. >>>> >>>> I can make it work by first retrieving the object as usual @myobject = >>>> Myobject.find(params[:id]). I would, however, like to understand what is >>>> happening under the hood and would really appreciate if someone can take a >>>> moment to explain that to a newbie >>>> >>>> Cheers, >>>> Emre >>>> >>>> >>>> -- >>>> 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]<communityengine%[email protected]> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/communityengine?hl=en. >>>> >>>> >>> >>> -- >>> 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]<communityengine%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/communityengine?hl=en. >>> >>> >> >> -- >> 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]<communityengine%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/communityengine?hl=en. >> >> > > -- > 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]<communityengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/communityengine?hl=en. > >--
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.
