BTW, can you give us some stats on how many cities, countries, etc and what indexing you have on tables. A copy of schema.rb would be useful for discussion purposes.
At Barquin we tend to use very different indexing strategies based on the DB engine and data composition rather than try to tweak the SQL. Thanks, Owen On Mon, Jun 14, 2010 at 8:32 PM, Ronbo <[email protected]> wrote: > Great, Owen. Thanks for the clarification. > > On Jun 14, 8:29 pm, Owen Dall <[email protected]> wrote: > > Sorry--meant ask them (Tom, Bryan, Matt, Kevin, etc.) for an opinion of > the > > best way to do it now... > > > > My personal goal for for Hobo is to provide as much as possible data > logic > > w/o dropping down to SQL for most common patterns. > > > > Of course it can't be always avoided, but the goal is, IMHO, to > > encapsulate as much as possible in the DSL. > > > > -Owen > > > > On Mon, Jun 14, 2010 at 7:32 PM, Ronbo <[email protected]> wrote: > > > Owen, > > > > > Not clear on your gist. 'Defer' in what sense? Thanks. > > > > > On Jun 14, 1:17 pm, Owen Dall <[email protected]> wrote: > > > > Need to defer to one of the Big Guns.... > > > > > > On Mon, Jun 14, 2010 at 11:27 AM, Ronbo <[email protected]> > wrote: > > > > > Not sure who changed the thread title or why. This post is to > > > > > (hopefully) reset it. > > > > > > > On Jun 14, 7:54 am, Ronbo <[email protected]> wrote: > > > > > > Here is what gets echo'd by default. Not a lot of detail here. > Please > > > > > > let me know if you need more. > > > > > > > > ActiveRecord::UnknownAttributeError (unknown attribute: > position): > > > > > > hobo (1.0.1) lib/hobo/model.rb:399:in `send' > > > > > > hobo (1.0.1) lib/hobo/model.rb:399:in `attributes=' > > > > > > hobo (1.0.1) lib/hobo/permissions.rb:194:in > > > `user_update_attributes' > > > > > > hobo (1.0.1) lib/hobo/permissions.rb:171:in `with_acting_user' > > > > > > hobo (1.0.1) lib/hobo/permissions.rb:193:in > > > `user_update_attributes' > > > > > > hobo (1.0.1) lib/hobo/model_controller.rb:757:in `hobo_reorder' > > > > > > hobosupport (1.0.1) lib/hobo_support.rb:29:in `each_with_index' > > > > > > hobo (1.0.1) lib/hobo/model_controller.rb:756:in `each' > > > > > > hobo (1.0.1) lib/hobo/model_controller.rb:756:in > `each_with_index' > > > > > > hobo (1.0.1) lib/hobo/model_controller.rb:756:in `hobo_reorder' > > > > > > app/controllers/units_controller.rb:13:in `reorder' > > > > > > hobo (1.0.1) lib/hobo/controller.rb:23:in `call' > > > > > > hobo (1.0.1) lib/hobo/controller.rb:23:in `included_in_class' > > > > > > > > Rendered rescues/_trace (159.2ms) > > > > > > Rendered rescues/_request_and_response (0.4ms) > > > > > > Rendering rescues/layout (internal_server_error) > > > > > > > > On Jun 12, 7:21 pm, Owen <[email protected]> wrote: > > > > > > > > > Yeh, If we can get this example working I'll write it up. If > not, > > > we > > > > > > > should add this kind functionality to Hobo. > > > > > > > > > Thanks, > > > > > > > -Owen > > > > > > > > > On Jun 11, 5:07 pm, kevinpfromnm <[email protected]> > wrote: > > > > > > > > > > hmm... can you post a stack trace as a gist? > > > > > > > > > > On Jun 11, 4:27 am, Ronbo <[email protected]> wrote: > > > > > > > > > > > Hi Kevin - that makes sense. Where I am confused is that > the > > > > > position > > > > > > > > > column *is* being populated when the item is initially > added to > > > the > > > > > > > > > list. If I create a new Activity and add three items to it, > > > looking > > > > > > > > > manually at the join table, the position column has 1,2,3, > as > > > > > > > > > positions. So I don't see where nil is an issue. The > problem is > > > > > that > > > > > > > > > they do not update when dragged. That is when I get the > > > "Unknown > > > > > > > > > Attribute: position" error, and the column has not updated > - is > > > > > still > > > > > > > > > 1,2,3 > > > > > > > > > > > On Jun 10, 9:30 pm, kevinpfromnm <[email protected]> > > > wrote: > > > > > > > > > > > > position in list is relative. can't adjust one's point > in > > > list > > > > > based > > > > > > > > > > off a nil value. that'd be my guess since you said the > > > column > > > > > was > > > > > > > > > > present. > > > > > > > > > > > > On Jun 10, 3:39 pm, Ronbo <[email protected]> > wrote: > > > > > > > > > > > > > Ok, thanks. > > > > > > > > > > > > > I'm not sure either what you mean by this (referring to > the > > > > > position > > > > > > > > > > > column not updating: > > > > > > > > > > > > > (not available) means nil value IIRC. since you had > > > existing > > > > > values, > > > > > > > > > > > you'll need to populate the values. > > > > > > > > > > > > > Since I get "unknown attribute: position", is the > problem > > > that > > > > > the > > > > > > > > > > > unit model does not know where position is? Or is it > some > > > other > > > > > issue? > > > > > > > > > > > > > On Jun 10, 5:35 pm, kevinpfromnm < > [email protected]> > > > > > wrote: > > > > > > > > > > > > > > that's what I meant. so the position would be per > > > activity. > > > > > > > > > > > > > > On Jun 10, 3:21 pm, Ronbo <[email protected]> > > > wrote: > > > > > > > > > > > > > > > Thanks Kevin, > > > > > > > > > > > > > > > Not sure what you mean about scope to activity. I > have > > > > > > > > > > > > > acts_as_list :scope => :activity on the join now. > > > > > > > > > > > > > > > On Jun 10, 2:27 pm, kevinpfromnm < > > > [email protected]> > > > > > wrote: > > > > > > > > > > > > > > > > (not available) means nil value IIRC. since you > had > > > > > existing values, > > > > > > > > > > > > > > you'll need to populate the values. oh, you'll > also > > > need > > > > > to scope the > > > > > > > > > > > > > > acts_as_list to the activity as well > > > > > > > > > > > > > > > > On Jun 10, 8:49 am, Ronbo < > [email protected]> > > > > > wrote: > > > > > > > > > > > > > > > > > OK. I just added <view:unit_activity.position/> > to > > > the > > > > > view and get > > > > > > > > > > > > > > > (Not Available) when I render the page. > > > > > > > > > > > > > > > > > In the unit_activity table, the position column > is > > > > > being populated > > > > > > > > > > > > > > > when the units are added to an activity, but > not > > > when > > > > > reordered from > > > > > > > > > > > > > > > the acts_as_list view. > > > > > > > > > > > > > > > > > Could this be a permission or scope problem > caused > > > by > > > > > 'position' being > > > > > > > > > > > > > > > on the join table? > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > On Jun 9, 5:28 pm, Ronbo < > [email protected]> > > > > > wrote: > > > > > > > > > > > > > > > > > > Yup. I have a 'position' column on the join > > > table. > > > > > > > > > > > > > > > > > > On Jun 9, 5:06 pm, kevinpfromnm < > > > > > [email protected]> wrote: > > > > > > > > > > > > > > > > > > > hmm... you've already done the migration > after > > > > > declaring the > > > > > > > > > > > > > > > > > acts_as_list? > > > > > > > > > > > > > > > > > > > On Jun 9, 2:46 pm, Ronbo < > > > [email protected]> > > > > > wrote: > > > > > > > > > > > > > > > > > > > > Thanks again. The tips are really > > > appreciated. > > > > > > > > > > > > > > > > > > > > I added the hobo_reorder as shown below. > The > > > page > > > > > now renders properly > > > > > > > > > > > > > > > > > > (with the sortable-collection UI > controls). > > > > > > > > > > > > > > > > > > > > class UnitsController < > ApplicationController > > > > > > > > > > > > > > > > > > hobo_model_controller > > > > > > > > > > > > > > > > > > auto_actions :all > > > > > > > > > > > > > > > > > > > > def reorder > > > > > > > > > > > > > > > > > > hobo_reorder > > > > > > > > > > > > > > > > > > end > > > > > > > > > > > > > > > > > > end > > > > > > > > > > > > > > > > > > > > The page now renders properly (with the > > > > > sortable-collection UI > > > > > > > > > > > > > > > > > > controls), but moving a list item fails > to > > > update > > > > > the position with > > > > > > > > > > > > > > > > > > the following error: > > > > > > > > > > > > > > > > > > ActiveRecord::UnknownAttributeError > (unknown > > > > > attribute: position): > > > > > > > > > > > > > > > > > > > > I have the position declared on the join > > > > > relation: > > > > > > > > > > > > > > > > > > has_many :unit_activities, :order => > > > :position > > > > > > > > > > > > > > > > > > > > Is this the right place, or is there > > > something > > > > > else I need to tweak to > > > > > > > > > > > > > > > > > > get this going? > > > > > > > > > > > > > > > > > > I'm getting closer... > > > > > > > > > > > > > > > > > > > > On Jun 9, 2:46 pm, kevinpfromnm < > > > > > [email protected]> wrote: > > > > > > > > > > > > > > > > > > > > > you need the method on the controller > for > > > it, I > > > > > can't remember if it's > > > > > > > > > > > > > > > > > > > something special or just standard > update > > > > > methods. > > > > > > > > > > > > > > > > > > > > > On Jun 9, 12:41 pm, Ronbo < > > > > > [email protected]> wrote: > > > > > > > > > > > > > > > > > > > > > > Hi Kevin, > > > > > > > > > > > > > > > > > > > > > > Do you mean something like: > > > > > > > > > > > > > > > > > > > > > > class Activity < ActiveRecord::Base > > > > > > > > > > > > > > > > > > > > has_many :unit_activities, :order > => > > > > > :position > > > > > > > > > > > > > > > > > > > > has_many :units, :through => > > > > > :unit_activities > > > > > > > > > > > > > > > > > > > > > > .... > > > > > > > > > > > > > > > > > > > > > > class UnitActivity < > ActiveRecord::Base > > > > > > > > > > > > > > > > > > > > belongs_to :activity > > > > > > > > > > > > > > > > > > > > belongs_to :unit > > > > > > > > > > > > > > > > > > > > acts_as_list :scope => :activity > > > > > > > > > > > > > > > > > > > > > > ... > > > > > > > > > > > > > > > > > > > > class Unit < ActiveRecord::Base > > > > > > > > > > > > > > > > > > > > has_many :unit_activities > > > > > > > > > > > > > > > > > > > > has_many :activities, :through => > > > > > :unit_activities > > > > > > > > > > > > > > > > > > > > > > class ActivityHints < Hobo::ViewHints > > > > > > > > > > > > > > > > > > > > children :units > > > > > > > > > > > > > > > > > > > > > > This generates a <collection:units > > > param/> > > > > > tag for the Activities show > > > > > > > > > > > > > > > > > > > > page. If I manually change it to > > > > > <sortable-collection:units param/>, I > > > > > > > > > > > > > > > > > > > > get the following error: > > > > > > > > > > > > > > > > > > > > > > undefined method `reorder_units_url' > > > > > > > > > > > > > > > > > > > > > > Am I missing the gist of what you > mean, > > > or am > > > > > I missing a step? Do I > > > > > > > > > > > > > > > > > > > > need to pass something to > > > > > sortable-collection? > > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > > > > > On Jun 9, 1:32 pm, kevinpfromnm < > > > > > [email protected]> wrote: > > > > > > > > > > > > > > > > > > > > > > > You want the acts_as_list and > > > accessible on > > > > > the join table, not the > > > > > > > > > > > > > > > > > > > > > end table. that way, each item can > be > > > > > sorted per > > > > ... > > > > read more ยป > > -- > 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]<hobousers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/hobousers?hl=en. > > -- - Owen Owen Dall, Chief Systems Architect Barquin International Cell: 410-991-0811 -- 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.
