Q:

Rails simple_form association

I'm trying to create a form for 'Member' using simple_form and having trouble displaying an association where it display the organization as below instead of the id, or organization_name. Am I missing something here? How should I go about this?
**Organization:0x0000000485cf88
Organization:0x0000000485c948
Organization:0x0000000485c358**
class Organization < ActiveRecord::Base
  has_many :members
  attr_accessible :organization_name
end

class Member < ActiveRecord::Base
  belongs_to :organization
  attr_accessible :active, :email, :first_name, :last_name, :role
end

  <%= f.input :first_name %>
  <%= f.input :last_name %>
  <%= f.input :role %>
  <%= f.input :email %>
  <%= f.input :active %>
  <%= f.association :organization %>

  <%= f.button :submit %>

Thanks.
Cheers,
Azren

A:

looks like Organization model doesn't have any of these fields: [ :to_label, :name, :title, :to_s ] so SimpleForm can't detect a default label and value methods for collection. I think you should pass it manually.

A:

add to_label function to your Organization class as shown below
class Organization < ActiveRecord::Base
  has_many :members
  attr_accessible :organization_name

  def to_label
    "#{organization_name}"

  end
end

refered 
Simple form association custom label name

