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 document.
>
> > > On Jun 9, 9:08 am, Ronbo <[email protected]> wrote:
>
> > > > Hi all,
>
> > > > I am still very new to Hobo, and learning mostly through trial and
> > > > error. I have been creating small throw-away apps to explore and test
> > > > things out.
>
> > > > I do have a serious app in mind though, and I am trying to figure out
> > > > how to implement a specific workflow in which users will create new
> > > > documents and add boilerplate text pieces to them from a predefined
> > > > set. Since documents will have many pieces and a piece can belong to
> > > > many documents, my first hunch is that I would use a
>
> > > > has_many :through => x, :accessible => true
>
> > > > sort of relationship, with the pieces as children of the document
> > > > model. Users could create a new doc and add the pieces they want.
> > > > Where I am having problems prototyping this is that the pieces in the
> > > > doc should be sortable. I've hunted through the hobo and rails forums
> > > > and can't find a recipe for how to make acts_as_list work with a
> > > > joined many-to-many sort of relationship.
>
> > > > Is this possible? If so, is there a better way of defining the
> > > > relationship or some special magic to getting it working through a
> > > > join?
>
> > > > Any hints are much appreciated.
--
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.