I am using a hand-rolled authorization scheme (more on that in another post) that allows users to access only specified routes. Thus it protects the underlying resources from unauthorized manipulation. For my dashboard controller, I would like this same authorization scheme to be used, and one way to do this is to access data through the resources instead of the models.
The Resource object sounds like exactly what I am looking for! Let me know if I can help out with design, testing, or coding. ..tony.. On Thu, Dec 11, 2008 at 8:42 AM, Yehuda Katz <[EMAIL PROTECTED]> wrote: > Out of curiosity, what is the rationale for wanting to POST to another > controller. We're working on some stuff that'll give you an object that > represents the Resource that you could modify (instead of touching the ORM > directly), which would encapsulate auth, authz, etags, caching, etc. > Would that be helpful? > > -- Yehuda > > > On Thu, Dec 11, 2008 at 8:39 AM, Tony Mann <[EMAIL PROTECTED]> wrote: > >> You are correct, I want to call a controller from another controller. >> >> I understand that the low-level support is there via Controller#call, >> since I looked at the request() source code already. But I was hoping there >> was something a little higher-level, basically a version of request() that >> was meant for production use and not testing. If not, then I will write one >> myself, or perhaps use one of the Ruby REST libraries out there. >> >> Specifically, we have to implement a dashboard-like controller that is >> manipulating many resources all on the same page via AJAX. We could do this >> resource manipulation via the underlying models, but this does not seem as >> clean to me as using our existing resource controllers for the CRUD. Perhaps >> I could be persuaded otherwise, if this is not well supported in Merb. >> >> I am already using a Merb part, so I am familiar with them. How would you >> see them being used in my scenario? >> >> ..tony.. >> >> >> On Thu, Dec 11, 2008 at 1:10 AM, Ahsan Ali <[EMAIL PROTECTED]> wrote: >> >>> I believe you want to call a controller from another controller .. via >>> REST. >>> >>> Since your controllers are ancestors of the Merb::Rack::Application >>> class, you could do a ControllerName.call(env_hash) (see the source of >>> request() to see how it is implemented) and it should work fine. >>> >>> I would imagine that you could specify the appropriate REST method in the >>> env_hash and the parameters ... >>> >>> Also, have you looked at Merb Parts ? >>> >>> Best Regards, >>> >>> Ahsan Ali >>> >>> >>> On Thu, Dec 11, 2008 at 3:32 AM, phatmann <[EMAIL PROTECTED]> wrote: >>> >>>> >>>> I am sure there is a simple answer to this, but I could not find it >>>> anywhere. >>>> >>>> We have a bunch of resource controllers that are working well. We have >>>> some other controllers that need to access these resources via REST. >>>> For example, we want to create a new Foo resource via a POST rather >>>> than access the Foo model directly. I could not find any calls in Merb >>>> to facilitate this. There is a request() method, but it is part of the >>>> Test framework. Clearly, I could use Ruby Net::HTTP for this, but I >>>> just wondered if there was a more merbish way to do it. >>>> >>>> Thanks. >>>> >>>> ..tony.. >>>> >>>> >>> >>> >>> >> >> >> > > > -- > Yehuda Katz > Developer | Engine Yard > (ph) 718.877.1325 > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
