Rails modeling admin-managed fields

I have 10 drop-down fields in the "post" form that I want to control by the administrator.

I currently have another model called "mail fields"

class PostField
  include Mongoid::Document
  field :family, type: String
  field :project, type: String
  field :event, type: String
  field :testmode, type: String
  field :location, type: String
end

I then use these documents to populate each drop-down list for a new post.

I have 2 dellimas:

1) If the administrator adds a PostField document for one drop-down list, he creates the whole document. Not the most effective thing, but I can handle it. 2) If the administrator changes the field name, all related messages will not match.

This is an effective tag model, but poorly implemented by b / c. I am not sure how to do this.

.. : [ "", "", "" ], "Restroom". "" "Restroom", , .

, .

+4
2

, , PostField ? , , : ?

, , , , Upstairs, Downstairs, Bathroom .. id, . PostField has_one :location, location_id. Location.name , , PostFields . postField.location.name .

+3

, .

"" .

simple schema

PostField

  • "" .
  • "" . .
  • , "label",

PostFieldValue

  • .
  • "label" [ "", "", " " ]

.

< >

  • , "isdefault" , .
0

All Articles