开发者

Translate form helper to simple_form or formstatic

I have this in my model:

class Person < ActiveRecord::Base
  RELATIONSHIP_STATUSES = [
    "single",
    "in a relationship",
    "together",
    "it's complicated"
  ]

  validates :relationship_status, :inclusion => RELATIONSHIP_STATUSES
end

This in the view:

collection_select(:pers开发者_开发技巧on, :relationship_status, Person::RELATIONSHIP_STATUSES, :to_s)

And I would like to translate that to simple_form. Is that possible?


If I understood you right, it's simple(it's for formtastic):

<%= form.input :relationship_status, :as => :select, :collection => Person::RELATIONSHIP_STATUSES %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜