Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
sorting belongs to association field
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Gesimondo  
View profile  
 More options Oct 19 2012, 1:44 am
From: John Gesimondo <j.gesimo...@gmail.com>
Date: Thu, 18 Oct 2012 22:44:58 -0700 (PDT)
Local: Fri, Oct 19 2012 1:44 am
Subject: sorting belongs to association field

Hey everyone. I'm trying to do something seemingly simple and can't figure
it out.

An article belongs to a state. When editing the article, I want the states
list to be in alphabetical order (by :name). But they are appearing by :id
desc.

I have tried

   - setting a default_scope on the state model to order(:name)
   - overriding the column in rails admin config (see below)

  config.model Article do
    list do; end
    export do; end
    show do; end
    edit do
      field :title
      field :state do
        sortable :name
      end
      field :school
      ...
    end
    create do; end
    update do; end
  end

No matter what I do, the states always appear id desc.

Any suggestions?

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »