Hi Tom,
I'm by no means an experienced Hobo programmer, but by example I can
quote what I did in my application:

My index.dryml page includes a <table-plus> as follows:

                <table-plus with="&@packages" fields="id, name, client_name,
my_file, client_file, state, created_at, updated_at">
                        <empty-message:>No packages match your 
criteria</empty-message:>

                        <controls:>
                                <if test="&this.editable?">
                        <param-content for="controls" />
                                </if>

                        </controls:>

                </table-plus>


My packages_controller.rb file includes this to handle the sorting by
'state' (which is renamed to 'status' via my package_hints.rb file.


  # We have to redefine the index method here so that we return only
those
  # packages that belong to the current user. This fixes the count of
packages
  # on the index.dryml page.
  def index

    # For passing options to hobo_index, see
    # http://cookbook.hobocentral.net/manual/controllers#pagination
    hobo_index @packages =
        current_user.packages.apply_scopes(
            :search =>
[params[:search], :name, :my_file, :client_file],
            :order_by =>
parse_sort_param(:name, :my_file, :status, :client_file)),
        :per_page => 5

  end

package_hints.rb:
  field_names :name => "Package Name:", :id => "ID", :created_at =>
"Created", :updated_at => "Updated", :state => "Status"


Hope that helps.
Tim



On Sep 30, 9:38 am, Tom <[email protected]> wrote:
> I've got a model with states:
>
> lifecycle do
>     state :started, :default => :true
>     state :ready
>     state :finished
> ...
> end
>
> And in view index I show the table-plus with state. In controler I
> make it sortable. But when I click the "State" on the table-plus I
> recive error:
> undefined method `name_attribute' for
> Project::LifecycleStateField:Class
>
> How can I make it sortabe by state?

-- 
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.

Reply via email to