Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Sort Virtual Attribute (or for this purpose associated records count) #101

Open
marclipovsky opened this issue Jun 28, 2012 · 0 comments
Open

Comments

@marclipovsky
Copy link

I'd like to be able to sort the associated records count. For example:

# form.rb
class Form
    has_many :references

    def reference_count
        self.references.count
    end
end

# reference.rb
class Reference
    belongs_to :form
end

#my view
= sort_link @search, :reference_count, 'References'

Is this possible? Or being able to sort the count directly without the virtual attribute.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant