Tuesday, 15 July 2014

Associations with Rails Admin & Visible Fields -



Associations with Rails Admin & Visible Fields -

i have 3 models, each associations set between them i'm looking manage using rails_admin there seem issues when comes displaying associations in front-end forms.

the models & associations next (syntax notwithstanding):

client - has_many :orders seller - has_many :orders order - has_one :customer, has_one :seller

when open rails_admin, blank space next label "customer" , "seller" performed add_reference on models customers , sellers contain order_id , orders contains customer_id , seller_id

when did that, 4 new fields appeared in view order:

client - integer field seller - integer field client - searchable dropdown field seller - searchable dropdown field

i want searchable dropdowns integer fields appear (presumably since add_references adds integer field table) , can't rid of integer fields. why appearing if rails_admin detecting association?

also, when editing order existing customer or seller, searchable dropdown field appears empty if i'm inputting new value rather pre-loading saved value.

suggestions on how remedy this?

found issue.

i changed association order belongs_to :customer , belongs_to :seller , manually added next columns order:

customer_id:integer seller_id:integer

ruby-on-rails ruby-on-rails-4 rails-admin

No comments:

Post a Comment