selections 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md
CHANGED
@@ -16,11 +16,11 @@ module Selections
|
|
16
16
|
# * +system_code+ - Overrides the automatic system_code name based on the fieldname and looks up the list of items in Selection
|
17
17
|
|
18
18
|
def selections(field, options = {}, html_options = {})
|
19
|
-
SelectionTag.new(self, object, field,
|
19
|
+
SelectionTag.new(self, object, field, options, html_options).to_tag
|
20
20
|
end
|
21
21
|
|
22
22
|
class SelectionTag #:nodoc:
|
23
|
-
attr_reader :form, :object, :field, :
|
23
|
+
attr_reader :form, :object, :field, :options, :html_options, :selection, :field_id, :system_code_name
|
24
24
|
|
25
25
|
def initialize(form, object, field, options, html_options)
|
26
26
|
@form = form
|
@@ -59,7 +59,7 @@ module Selections
|
|
59
59
|
options[:selected] = selected_item
|
60
60
|
form.select field_id, items.map { |item| [item.name, item.id] }, options, html_options
|
61
61
|
else
|
62
|
-
"Could not find system_code of '#{system_code_name}' or '#{form.object_name}_#{system_code_name}'"
|
62
|
+
"Could not find system_code of '#{system_code_name}' or '#{form.object_name}_#{system_code_name}' - #{options}"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
data/lib/selections/version.rb
CHANGED
@@ -50,6 +50,14 @@ describe SelectionTag do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
context "system_code override" do
|
54
|
+
it "meme" do
|
55
|
+
hello = Selection.create(name: "hello")
|
56
|
+
parent
|
57
|
+
expect(new_form(options: {system_code: :hello} ).system_code).to eq hello
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
53
61
|
it "finds with form model prefixed" do
|
54
62
|
model_parent
|
55
63
|
expect(edit_form.system_code).to eq(model_parent)
|