Right.
I see that in the documentation, but beyond ‘title’ and when it was
published, what constitutes a “field”? I really don’t want to pour
backwards and forwards though the code - this out to be documented!
If you look in db/schema.rb or use a tool to inspect the database, you
can
see what fields are available in the database.
Here’s what my schema.rb says:
create_table “pages”, :force => true do |t|
t.column “title”, :string
t.column “slug”, :string, :limit => 100
t.column “breadcrumb”, :string, :limit => 160
t.column “class_name”, :string, :limit => 25
t.column “status_id”, :integer, :default => 1,
:null => false
t.column “parent_id”, :integer
t.column “layout_id”, :integer
t.column “created_at”, :datetime
t.column “updated_at”, :datetime
t.column “published_at”, :datetime
t.column “created_by”, :integer
t.column “updated_by”, :integer
t.column “virtual”, :boolean, :default =>
false,
:null => false
end
Now some of those are fields that don’t make sense to order by – for
example, class_name or layout_id or status_id, and in the context of
children, parent_id is always going to be the same.
Can the existence of a page part (the tab when editing like ‘sidebar’ or
‘extended’) or its content be used? If I have one called ‘current’ can I
percolate that to the top? If I have one called “order” in each of the
pages can I use its content to sort?
Currently, I believe they are ordered by id inside the application,
which
basically means creation order.
In English, does that mean I have to write Ruby code to do this?
Yes. It’s not much, maybe about 15 lines. Since you can do practically
anything Ruby inside the tag definition, sorting pages by one of their
page
parts should be relatively trivial.
I suspect you and I use the word ‘arbitrary’ slightly differently
What I’m thinking of isn’t at all arbitrary, its quite strictly
controlled.
And I’m really surprised that better ordering of the children isn’t an
issue.
Yes. What I mean is an ordering that is orthogonal to the domain of the
model, which is what acts_as_list does.
Of course I may just be completely misunderstanding what you mean by
‘field’. But as I say, it doesn’t grab me in the documentation or the
code
for <r:children:each>
I hope that there is something in there and Its just that I don’t
understand
what you mean by ‘field’.
Unfortunately, the documentation has been really poor in the past.
However,
it should get better as time goes on, especially with the tag reference
UI/DSL that is now available in mental. Speaking of, I need to add
Textile
to that…
Sean