lib/selections/form_builder_extensions.rb in selections-0.1.3 vs lib/selections/form_builder_extensions.rb in selections-0.1.4

- old
+ new

@@ -41,12 +41,12 @@ !!options[:include_blank] end end def system_code - @system_code ||= selection.where(system_code: system_code_name.to_s).first @system_code ||= selection.where(system_code: "#{form.object_name}_#{system_code_name}").first + @system_code ||= selection.where(system_code: system_code_name.to_s).first end def items @items ||= system_code.children.filter_archived_except_selected(object.send(field_id)) end @@ -57,10 +57,10 @@ #html_options[:style] ||= options[:include_blank] = include_blank? options[:selected] = selected_item form.select field_id, items.map { |item| [item.name, item.id] }, options, html_options else - "Invalid system_code of '#{system_code_name}'" + "Could not find system_code of '#{system_code_name}' or '#{form.object_name}_#{system_code_name}'" end end def selected_item if object.new_record? \ No newline at end of file