Rails 4 の grouped_collection_select に問題があるので、助けてください。
私はこのモデルを持っています:
class Event < ActiveRecord::Base
has_many :appointments
belongs_to :user
scope :evento_sin, -> { where(available: "1") }
end
class User < ActiveRecord::Base
has_many :events
has_many :appointments
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
def medic_with_spec
"#{especialidad}, #{name} #{lastname}"
end
end
そして私の見解は:
<div class="field">
<%= f.label :user_id, "Médicos" %><br />
<%=select("appointment", "user_id", @usuarios.collect {|p| [p.especialidad+" - "+p.lastname + ", " +p.name, p.id ] }, { include_blank: true }) %>
</div>
<div class="field">
<%= f.label :event_id, "Consultas Disponibles" %><br />
<%= f.grouped_collection_select :event_id, @usuarios.order(:name),
:eventos.evento_sin, :id, :id, :start_time, include_blank: true %>
:events:Symbol の undefined method `evento_sin' が表示されます
このコードはどうなりますか?
助けてくれてありがとう