I haven't tried it, but shouldn't create requests be sent with POST rather than PUT? You shouldn't need the extra routing, or the action parameter...
--Matt On Dec 17, 2008, at 4:49 PM, adamski wrote: > > Thanks - I almost got it working by using the ajax_updater method to > generate the ajaxRequest call (I did that for another control in our > app already). > But in the end I did it with a direct call to 'create' in the url i.e. > models/create?model[field1]=blah&model[field2]=bleh > Had to explicitly define the route in routes.rb to get it working. > I'll have a look at the create-button code at some point aswell. > > On Dec 17, 4:30 pm, James Garlick <[email protected]> wrote: >> Here's a clue, the <create-button> tag would output something very >> similar to what you're after if you can figure out how to use it. >> Unfortunately there's no documentation written for it and I haven't >> used it for ages. >> >> http://cookbook.hobocentral.net/api_tag_defs/create-button >> >> It should be used very roughly something like this: >> >> <create-button model="InterestedParty" label="Add" fields="&{:user_id >> => something, :notifiable_id => something_else}" update="my-part- >> name"/> >> >> If you can get it to work then you can look at the onclick for the >> button and see what it has output. >> >> On 17 Dec 2008, at 15:50, adamski wrote: >> >> >> >>> I'm trying to work out how to call Hobo.ajaxRequest. >>> I'm using the record_select plugin, and need to call from the >>> onclick. >>> This particular case is for a create. I've got it working on another >>> part of the site for an update. >>> But create seems to be different. >>> I've tried and failed to send the parameters. So far I have: >> >>> Hobo.ajaxRequest("/interested_parties", >>> ['interested_parties'], >>> { params: { >>> user_id: user_id, >>> notifiable_type: object_type, >>> notifiable_id: object_id >>> }, >> >>> action: 'create', >>> controller: 'interested_parties', >>> method: 'put', >>> spinnerNextTo: this, message: "" } ) >> >>> action is ignored completely, and params also. >>> If anyone can point me in the direction of some relevant docs that >>> would be much appreciated! The only example I've found is the one on >>> the Hobo Cookbook for dynamic menus. >> >>> Thanks >>> Adam > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
