-
Notifications
You must be signed in to change notification settings - Fork 3
Disambiguating by breaking more conventions #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| <%= singular_table_name %>_to_show = <%= class_name.singularize %>.find(params[:id_to_display]) | ||
|
|
||
| render("<%= plural_table_name.underscore %>_templates/show.html.erb", :locals => { | ||
| :the_<%= singular_table_name.underscore %> => <%= singular_table_name %>_to_show |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tLT
unterminated string meets end of file
|
|
||
| def show | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:id]) | ||
| <%= singular_table_name %>_to_show = <%= class_name.singularize %>.find(params[:id_to_display]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
| class <%= plural_table_name.camelize %>Controller < ApplicationController | ||
| def index | ||
| @<%= plural_table_name.underscore %> = <%= class_name.singularize %>.all | ||
| all_<%= plural_table_name.underscore %> = <%= class_name.singularize %>.all.order(:created_at => :desc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
| @remaining_count = <%= class_name.singularize %>.count | ||
| render("<%= plural_table_name.underscore %>_templates/destroy_row.html.erb") | ||
| render("<%= singular_table_name.underscore %>_templates/destroy_row.html.erb", :locals => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
unterminated string meets end of file
| <% unless skip_validation_alerts? -%> | ||
| redirect_to("/<%= @plural_table_name.underscore %>", :notice => "<%= singular_table_name.humanize %> deleted successfully.") | ||
| redirect_to("/<%= plural_table_name.underscore %>", :notice => "<%= singular_table_name.humanize %> deleted successfully.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
unexpected token tRPAREN
|
|
||
| if save_status == true | ||
| redirect_to("/<%= @plural_table_name.underscore %>/#{@<%= singular_table_name.underscore %>.id}", :notice => "<%= singular_table_name.humanize %> updated successfully.") | ||
| redirect_to("/<%= plural_table_name.underscore %>/#{<%= singular_table_name.underscore %>_to_change.id}", :notice => "<%= singular_table_name.humanize %> updated successfully.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tLT
unexpected token tRPAREN
|
|
||
| <% attributes.each do |attribute| -%> | ||
| @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params[:<%= attribute.column_name %>] | ||
| <%= singular_table_name.underscore %>_to_change.<%= attribute.column_name %> = params["form_<%= attribute.column_name %>"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
unexpected token tOP_ASGN
|
|
||
| def update_row | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:id_to_modify]) | ||
| <%= singular_table_name.underscore %>_to_change = <%= class_name.singularize %>.find(params["id_to_modify"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
|
|
||
| render("<%= plural_table_name.underscore %>_templates/edit_form.html.erb") | ||
| render("<%= singular_table_name.underscore %>_templates/edit_form.html.erb", :locals => { | ||
| :<%= singular_table_name.underscore %>_to_prefill => existing_<%= singular_table_name.underscore %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tOP_ASGN
unexpected token tIDENTIFIER
|
|
||
| def edit_form | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:prefill_with_id]) | ||
| existing_<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params["prefill_with_id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
22711f0 to
e594291
Compare
- Removing all instance variables to decouple variable name choices between actions that re-use templates, and to remove the additional cognitive load of learning what an instance variable is. Also, avoiding state is better practice anyway, IMO. - Using strings as keys to the `params` hash following the heuristic: "If we could change it to 'zebra' on a whim, then use a string; otherwise use a symbol." - Making variable and input names longer and more pedantic.
e594291 to
eebc1c7
Compare
| @remaining_count = <%= class_name.singularize %>.count | ||
| render("<%= plural_table_name.underscore %>_templates/destroy_row.html.erb") | ||
| render("<%= singular_table_name %>_templates/destroy_row.html.erb", :locals => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
unterminated string meets end of file
| <% unless skip_validation_alerts? -%> | ||
| redirect_to("/<%= @plural_table_name.underscore %>", :notice => "<%= singular_table_name.humanize %> deleted successfully.") | ||
| redirect_to("/<%= plural_table_name %>", :notice => "<%= singular_table_name.humanize %> deleted successfully.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
unexpected token tRPAREN
| <%= singular_table_name %>_to_delete = <%= class_name.singularize %>.find(params["id_to_remove"]) | ||
| @<%= singular_table_name.underscore %>.destroy | ||
| <%= singular_table_name %>_to_delete.destroy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tLT
| def destroy_row | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:id_to_remove]) | ||
| <%= singular_table_name %>_to_delete = <%= class_name.singularize %>.find(params["id_to_remove"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
| redirect_to("/<%= plural_table_name %>/#{<%= singular_table_name %>_to_change.id}") | ||
| <% else -%> | ||
| render("<%= plural_table_name.underscore %>_templates/update_row.html.erb") | ||
| render("<%= singular_table_name %>_templates/update_row.html.erb", :locals => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
unexpected token tLCURLY
|
|
||
| if save_status == true | ||
| redirect_to("/<%= @plural_table_name.underscore %>/#{@<%= singular_table_name.underscore %>.id}", :notice => "<%= singular_table_name.humanize %> updated successfully.") | ||
| redirect_to("/<%= plural_table_name %>/#{<%= singular_table_name %>_to_change.id}", :notice => "<%= singular_table_name.humanize %> updated successfully.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tLT
unexpected token tRPAREN
|
|
||
| <% attributes.each do |attribute| -%> | ||
| @<%= singular_table_name.underscore %>.<%= attribute.column_name %> = params[:<%= attribute.column_name %>] | ||
| <%= singular_table_name %>_to_change.<%= attribute.column_name %> = params["<%= attribute.column_name %>_from_form"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
unexpected token tOP_ASGN
|
|
||
| def update_row | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:id_to_modify]) | ||
| <%= singular_table_name %>_to_change = <%= class_name.singularize %>.find(params["id_to_modify"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
|
|
||
| render("<%= plural_table_name.underscore %>_templates/edit_form.html.erb") | ||
| render("<%= singular_table_name %>_templates/edit_form.html.erb", :locals => { | ||
| :<%= singular_table_name %>_to_prefill => existing_<%= singular_table_name %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tOP_ASGN
unexpected token tIDENTIFIER
|
|
||
| def edit_form | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:prefill_with_id]) | ||
| existing_<%= singular_table_name %> = <%= class_name.singularize %>.find(params["prefill_with_id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:id]) | ||
| id_of_<%= singular_table_name %>_to_show = params.fetch("id_to_display") | ||
|
|
||
| @<%= singular_table_name %>_to_show = <%= class_name.singularize %>.find(id_of_<%= singular_table_name %>_to_show) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected @'
|
|
||
| def show | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:id]) | ||
| id_of_<%= singular_table_name %>_to_show = params.fetch("id_to_display") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
| id_of_<%= singular_table_name %>_to_show = params.fetch("id_to_display") | ||
|
|
||
| render("<%= plural_table_name.underscore %>_templates/show.html.erb") | ||
| @<%= singular_table_name %>_to_show = <%= class_name.singularize %>.find(id_of_<%= singular_table_name %>_to_show) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected @'
|
|
||
| def show | ||
| @<%= singular_table_name.underscore %> = <%= class_name.singularize %>.find(params[:id_to_display]) | ||
| id_of_<%= singular_table_name %>_to_show = params.fetch("id_to_display") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
| class <%= plural_table_name.camelize %>Controller < ApplicationController | ||
| def index | ||
| @<%= plural_table_name.underscore %> = <%= class_name.singularize %>.all | ||
| @list_of_<%= plural_table_name %> = <%= class_name.singularize %>.all.order({ :created_at => :desc }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected token tIDENTIFIER
| %w(index show new_form create_row edit_form update_row destroy_row) | ||
| else | ||
| %w(index new_form edit_form show) | ||
| %w(index show new_form new_form_with_errors edit_form edit_form_with_errors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [84/80]
|
|
||
| template "specs/crud_spec.rb", "spec/features/crud_#{plural_table_name.underscore}_spec.rb" | ||
| template "specs/factories.rb", "spec/factories/#{plural_table_name.underscore}.rb" | ||
| template "specs/crud_spec.rb", "spec/features/crud_#{plural_table_name}_spec.rb" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [86/80]
| available_views.each do |view| | ||
| filename = view_filename_with_extensions(view) | ||
| template filename, File.join("app/views", "#{plural_table_name}_templates", File.basename(filename)) | ||
| template filename, File.join("app/views", "#{singular_table_name}_templates", File.basename(filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [110/80]
| template "controllers/read_only_controller.rb", "app/controllers/#{plural_table_name}_controller.rb" | ||
| else | ||
| template "controllers/controller.rb", "app/controllers/#{plural_table_name.underscore}_controller.rb" | ||
| template "controllers/controller.rb", "app/controllers/#{plural_table_name}_controller.rb" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [98/80]
|
|
||
| if read_only? | ||
| template "controllers/read_only_controller.rb", "app/controllers/#{plural_table_name.underscore}_controller.rb" | ||
| template "controllers/read_only_controller.rb", "app/controllers/#{plural_table_name}_controller.rb" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [108/80]
* Add github login * #3 - Fixed failing test * #3 - Fixed other test cases * #3 - Minor changes * #3 - Indentation fixes * #3 Added .rubocop.yml and fixed rubocop issues * #3 - Test cases for https://github.com/firstdraft/ideas/pull/3 * #3 - CicleCi add minitest_globs and fixed rubocop issues * #3 - Added bootswatch paper theme * #3 - Turn off hound ci for js, css * we do not recommend using capybara * added database yml to gitignore * added database yml sample file for postgresqlapp * #3 - Removed rspec completely * #3 - Remove Factory Girl and instead uses fixtures * #3 - Updated CircleCi.yml and modified setup script * #3 - Added database.yml.ci * #3 - Review comments changes
between actions that re-use templates, and to remove the additional
cognitive load of learning what an instance variable is. Also,
avoiding state is better practice anyway, IMO.
paramshash following the heuristic:"If we could change it to 'zebra' on a whim, then use a string;
otherwise use a symbol."