> eg:
> <script>
> Ext.onReady(function() {
> UserPart.create({first : 'joma', last: 'cutchcutch'}, function
> (data, response) {
> alert('this is the callback');});
>
> });
> </script>
and UserPart#create would go something like this:
<code>
class UserPart < Merb::PartController
def create
req = params[:xrequest] # <-- XRequest instance provided
automatically for you by merb-extjs-direct gem
user = User.create(req.params)
throw XException.new("Could not create user") if user.id.nil? #
<-- throw an XException back to Ext.Direct on client.
res = XResponse.new(req) # <-- Ext.Direct response class
XResponse provided by merb-extjs-direct gem
res.status = true
res.message "Created new user"
res.to_json
end
end
</code>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---