Hi Bryan, It took me a while to figure out that if you have a "set-default-order" on the model you are using for the select-one-or-new then you get the last one in that order, not the one you just created.
Mike On Thursday, June 30, 2011 5:44:09 PM UTC-4, Bryan Larsen wrote: > > There are three issues. > > Problem 1: fixed, so bundle update hobo-jquery. > > The other two only apply to new actions, not to edit's. So the short > answer is "don't use select-one-or-new-dialog on new items." > > Problem 2: > > On a new action, Hobo cannot resurrect the context from the database, > so it just uses whatever 'this' the controller is spitting out. For > > class Story > hobo_model > fields do > name :string > end > belongs_to :story_status > # plus permissions, etc... > end > > app/views/stories/new.dryml: > > <new-page> > <field-list:> > <story-status-view:> > <select-one-or-new-dialog/> > </story-status-view:> > </field-list:> > </new-page> > > The initial action is Story#new, but select-one-or-new-dialog posts to > StoryStatus#create. You can fix this by fiddling with the > controller: > > app/controllers/story_statuses_controller.rb: > > class StoryStatusesController < ApplicationController > def create > hobo_create do > if request.xhr? > self.this = Story.new > end > end > end > end > > You'd think this would break Story#edit, but it doesn't because Hobo > ignores self.this when it can resurrect the story from the database. > > Problem 3: The above works in Hobo 1.0, but not in Hobo 1.3. > > If you look at the console in Hobo 1.0, it will say: > > > Call part: select_one_or_new_dialog_select. this-id = this:city, locals > = [] > > : form_field_path = ["property", "city"] > > Hobo 1.3 says: > > > Call part: select_one_or_new_dialog_select. this-id = :city, locals = [] > > : form_field_path = ["property", "city"] > > I'm still looking into the 3rd problem. > > Bryan > > > On Wed, Jun 29, 2011 at 2:26 PM, kevinpfromnm > <[email protected]<javascript:>> > wrote: > > Trying to do a select-one-or-new-dialog in Hobo 1.3.0.RC with rails 3.0.9 > > and the form comes up and on clicking OK, nothing appears to happen. the > > new item does get created but looking in the console I get an invalid > > typed-id error. > > > > Call part: select_one_or_new_dialog_select. this-id = :city, locals = [] > > : form_field_path = ["property", "city"] > > Completed 500 Internal Server Error in 600ms > > > > ArgumentError (invalid typed-id: :city): > > > > -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/hobousers/-/WaGbxS0VFTIJ. 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.
