= form_for(Group.new, url: actions_url_path, method: :put, html: {class: :front_form, novalidate: true}) do |f| = f.collection_check_boxes(:user_approve_status, list, :entity_id, :name) do |b| - binding.pry = b.check_box class: 'is-checkradio' label(for="group_user_approve_status_#{b.object.entity_id}")
上記コードでbinding.pryして
bの値をみると
=> #<ActionView::Helpers::Tags::CollectionCheckBoxes::CheckBoxBuilder:0x00007f8c40116fd8 @input_html_options={:object=>#<Organizationxx:0x00007f8c39fee1c0 id: nil, user_approve_status: "未承認", created_at: nil, updated_at: nil>}, @method_name="user_approve_status", @object=#<Organization:0x00007f8c39feecb0 id: 5, entity_id: "1003", name: "浩 野田">, @object_name="xx", @sanitized_attribute_name="user_approve_status_1003", @template_object= #<#<Class:0x00007f8c3f297700>:0x00007f8c3f295a40 @_assigns= {"rendered_format"=>nil, "marked_for_same_origin_verification"=>true, "organization"=> #<Organization:0x00007f8c3f2842e0 id: 100, entity_id: "100", created_at: Thu, 23 Jan 2020 07:49:57 UTC +00:00, updated_at: Thu, 23 Jan 2020 07:49:57 UTC +00:00>, "unapproved_list"=> [#<Organization:0x00007f8c39feecb0 id: 5, entity_id: "1003", name: "浩 野田">, @_config={}, ...
色々見れますが、
b.object
b.text
b.checkbox
以外は触れませんでした。
@object
@oject_name
同列に並んでるのでなんとなく
b.object_nameも取れると思いましたが、なぜ取れないか概念を教えていただけますでしょうか。
あなたの回答
tips
プレビュー