Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Replace Subclasses with Strategies: Step Five
* Pass strategy instead of subclass when only the strategy is needed * Don't delegate strategy-specific behavior from subclasses
- Loading branch information
Showing
6 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
example_app/app/views/multiple_choice_questions/_multiple_choice_question_form.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<%= form.fields_for(:options, question.options_for_form) do |option_fields| -%> | ||
<%= form.fields_for(:options, submittable.options_for_form) do |option_fields| -%> | ||
<%= option_fields.input :text, label: 'Option' %> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
<%= simple_form_for question, as: :question, url: url do |form| -%> | ||
<%= form.hidden_field :type %> | ||
<%= form.input :title %> | ||
<%= render "#{question.to_partial_path}_form", question: question, form: form %> | ||
<%= render( | ||
"#{question.to_partial_path}_form", | ||
submittable: question.submittable, | ||
form: form | ||
) %> | ||
<%= form.submit %> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters