Hi Ignacio,
I never did get to try the dryml approach you recommended below before I
found a solution. It turns out that you can not chain the*unscoped*
method with other scopes when the model has a default scope as in:
finder = model.unscoped.apply_scopes( ... # doesn't override default_scope
# with the desired scopes
but,*unscoped* accepts a block so that
finder = model.unscoped do # removes default_scope, then
model.apply_scopes( ... # applies the desired scopes
end
All parts of all the pages now work correctly, and I don't have to
wait for Rails 4.1 :-)
Thanks,
Don
On 09/10/2014 12:41 PM, Ignacio Huerta wrote:
Hi Don,
I assume you are in a edit/new page, and you want the form to show a
dropdown with ordered items. If the model was called "Thing", I think
you should be able to do something like:
<field-list: fields="name, last_name, thing">
<thing-view:>
<select-menu name="model[thing_id]"
options="&Thing.order(:member_position).map{|t|
[t.name, t.id]}" />
</thing-view:>
</field-list:>
I'm writing this from memory, please write if you can't find the right
syntax.
Warm regards,
Ignacio
El 10/09/14 a las #4, Donald Ziesig escribió:
Hi All!
Ran into a nasty set of issues associated with "default_order". In
Rails 4.0.x, default_order OVERRIDES all other ordering which breaks the
sort function of table-plus. That part is easily fixed, just remove
default_order from the model.
Unfortunately, the model in question is used to populate a drop-down
list and when the default_order is removed, the ordering reverts to the
non-order in the table (a function of which items were edited last).
The dryml for the form in question is:
<field-list fields="name, last_name, first_name, status,
member_position, user" param/>
and the problem field is "member_position".
Any ideas how to get around this other than wait for Rails 4.1 (there is
a long conversation going on about how to fix this with the consensus
being it is being deferred till Rails 4.1)?
Thanks,
Don Ziesig
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.