I got a rather old app using Rails Admin 0.4. I am not a guy so much good with magic and thus would need some help with Rails Admin configuration.
I am in need of sorting the list
view of a model by a relation attribute. For example I got a setup like Exchange
belongs_to :worker, :class_name => "Person", :foreign_key => "worker_id"
. I would like to sort it by the name
attribute of the Person
.
A bare installation sorts it by the #id
of the person (worker_id
in this case). I would like that to be #name
in the Person
class.
Stuff are as follows, though I doubt will be necessary to help.
RailsAdmin.config do |config|
config.model ExchangeAndFee do
list do
field :created_at
field :customer do
searchable [{Person => :name}]
queryable true
end
field :worker do
searchable :workers_exchanges => :name
queryable true
end
field :amount
field :notes do
label "Memo"
formatted_value do
bindings[:object].memo
end
end
end
end
end
Additional Details
- Rails 3
- Rails Admin 0.4
- App OSCurrency
Any help is highly appreciated.
Aucun commentaire:
Enregistrer un commentaire