Thanks for the enlightenment.  I'll check it out.
~Michael

On Wed, Nov 26, 2008 at 1:02 AM, Daniel N <[EMAIL PROTECTED]> wrote:

>
>
> On Wed, Nov 26, 2008 at 4:39 PM, Michael Fairchild <
> [EMAIL PROTECTED]> wrote:
>
>> Alright, I'll just use app/controllers/expceptions.rb.
>> Just for curiosity, what am i missing to make it catch thru the slice
>> tho?  I mean, why does unauthenticated catch, and forbidden not?
>>
>> Thanks,
>> ~Michael
>
>
> The reason it's not taking is because when you mixin a module into a
> controller, you need to activate that method to allow it to be an action.
> This is done for safety so that when you mixin something you don't
> unintentionally expose methods to default_routes and stuff that you may not
> have intended.
>
> Checkout the show_action method on the controller.
> http://merbivore.com/documentation/current/doc/rdoc/stack/index.html?a=M002137&name=show_action
>
> Cheers
> Daniel
>
>
>
>>
>> On Tue, Nov 25, 2008 at 9:20 PM, Daniel N <[EMAIL PROTECTED]> wrote:
>>
>>> Hey,
>>>
>>> You're trying to put it in a slice?  There's no need to add it to the
>>> merb-auth mixin.  That's internal so it doesn't overwrite your stuff you
>>> might declare
>>>
>>> Just add it directly to your exceptions controller in
>>> app/controllers/expceptions.rb
>>>
>>> HTH
>>> Daniel
>>>
>>>
>>> On Wed, Nov 26, 2008 at 4:06 PM, fairchild <[EMAIL PROTECTED]>wrote:
>>>
>>>>
>>>> Hello,
>>>>  Been adding user authentication to my app.  Its gone pretty smooth
>>>> so far.  However, I added an authoirze method that would throw a
>>>> Forbidden excetpiton.  That works fine, but I decided I wanted to
>>>> catch the exception and display something meaningfull the way merb-
>>>> auth catches the Unauthorized exception.
>>>> I sorta got it working, but am confused:
>>>>
>>>> I added a forbidden method to module
>>>> MerbAuthSlicePassword::ExceptionsMixin
>>>>
>>>>  def forbidden
>>>>    provides :html
>>>>    case content_type
>>>>    when :html
>>>>      "that action is forbidden by slice"
>>>>    end
>>>>  end
>>>>
>>>> this causes me to get the green and gray exceptions page instead of
>>>> the gray textmate hyperlinking error page, so, its getting hit
>>>> somewhere in the chain, but not working for some reason.
>>>>
>>>> So, I put the same method in class Exceptions < Application and it
>>>> works.
>>>>
>>>> I'm glad It's working, but would like to understand why it only partly
>>>> works in the slice mixin.  Am I missing something?
>>>>
>>>> Thanks,
>>>> Michael Fairchild
>>>>
>>>> fairchild: Im trying to add a template to handle the 401 Forbiden
>>>> exception
>>>> [8:17pm] fairchild: I added a forbidden method to module
>>>> MerbAuthSlicePassword::ExceptionsMixin
>>>> [8:18pm] fujin: uh, don't you just add it to your exceptions
>>>> controller?
>>>> [8:18pm] fujin: oh, slice
>>>> [8:18pm] fujin: n/m
>>>> [8:18pm] fairchild: fujin: ill try that
>>>> [8:19pm] fujin: that should work, fwiw
>>>> [8:19pm] trogdoro joined the chat room.
>>>> [8:19pm] trogdoro was granted voice by ChanServ.
>>>> [8:19pm] fairchild: yep, that works, thanks
>>>> [8:20pm] fairchild: id kinda like to figure out where to put it if i
>>>> wanted to do it thru the slice tho?
>>>> [8:20pm] kenphused left the chat room. (Remote closed the connection)
>>>> [8:20pm] fairchild: It seems to partially work
>>>> [8:21pm] emzmcgee_ left the chat room. (Remote closed the connection)
>>>> [8:21pm] holoway joined the chat room.
>>>> [8:21pm] holoway was granted voice by ChanServ.
>>>> [8:21pm] fujin: not too familiar with slices sorry +)
>>>> [8:21pm] hj: anyone using dm-paperclip? I got this error:
>>>> uninitialized constant Paperclip::Validate - (NameError)
>>>> [8:22pm] trogdoro: what the F is with firefox upgrading itself and
>>>> then not being compatible with firebug?
>>>> [8:22pm] technoweenie: hj: try requiring dm-validations
>>>> [8:22pm] fairchild: its weird because when i add it to the exception
>>>> pmixin it does change my rendered result, but not to the result of the
>>>> mixin method
>>>> [8:23pm] fairchild: when i add the method to the mixin, i get the
>>>> flash  that i authenticated sucessfully, and then teh Excpetion ,
>>>> "Action 'forbidden' was not found in Exceptions'
>>>> [8:24pm] snuxoll joined the chat room.
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to