On Sun, Oct 19, 2008 at 8:59 AM, Per Melin <[EMAIL PROTECTED]> wrote:

>
> I was thinking about how to best extend the session for a plug-in, so
> I had a look at merb-auth-core (0.9.9).
>
> It opens up Merb::Session and defines a self.included method. That
> seems dangerous (and in this case completely unnecessary) to me. If I
> do the same in my plug-in one will overwrite the other. What am I
> missing?


I'll go with you on this one... This indeed doesn't need to be done via the
included method since there are no class methods.


>
> And also, for its helper, it does this:
> Merb::Controller.send(:include, Merb::AuthenticatedHelper)


>
> How is that preferable to opening up Merb::GlobalHelpers and adding
> your methods there? Forcing an include into Merb::Controller feels a
> little like bypassing the public API, no?


It puts it into the controller rather than the helpers because it doesn't
make sense inside the other controller types, it only makes sense to have
the helper inside a web controller.  Strategies may redirect, set headers
and return statuses.  It does not make sense to have this available inside a
mailer or Part controller for example, and would actually fail since the
required methods, headers, status etc are not available in these.  If it
were mixed into the GlobalHelpers mixin, all controllers would have access
to the helper, mailer and parts included which would break.



>
> (I've been away from Ruby for a number of years, mostly living in
> Erlang-land, and have forgotten many Ruby idioms, so I apologize if
> I'm off base here.)


You make some good points, and I will update the session mixin to reflect
it.  I don't think it is appropriate to mixin to the GlobalHelpers module
though for the reasons above.

Thanx very much for taking the time to input :)


Cheers
Daniel

--~--~---------~--~----~------------~-------~--~----~
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