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 was generated by the `rails generate rspec:install` command. Conventionally, all | |
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. | |
# The generated `.rspec` file contains `--require spec_helper` which will cause | |
# this file to always be loaded, without a need to explicitly require it in any | |
# files. | |
# | |
# Given that it is always loaded, you are encouraged to keep this file as | |
# light-weight as possible. Requiring heavyweight dependencies from this file | |
# will add to the boot time of your test suite on EVERY test run, even for an | |
# individual file that may not need all of that loaded. Instead, consider making |
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 is copied to spec/ when you run 'rails generate rspec:install' | |
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../../config/environment', __FILE__) | |
# Prevent database truncation if the environment is production | |
abort("The Rails environment is running in production mode!") if Rails.env.production? | |
require 'spec_helper' | |
require 'rspec/rails' | |
# Add additional requires below this line. Rails is not loaded until this point! | |
# Requires supporting ruby files with custom matchers and macros, etc, in |
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
--color | |
--require spec_helper |
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
<h3>Edit <%= human_name %></h3> | |
<%= "<%= render 'form', #{singular_name}: @#{singular_name} %%>" %> |
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
<h3>Create <%= human_name %></h3> | |
<%= "<%= render 'form', #{singular_name}: @#{singular_name} %%>" %> |
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
<%= "<%= link_to 'Create new', new_#{singular_name}_path, class: 'btn btn-primary btn-sm mb-2' %%>" %> | |
<table class="table table-sm"> | |
<tbody> | |
<%= "<% @#{plural_name}.each do |#{singular_name}| %%>" %> | |
<tr> | |
<td> <%= "<%= #{singular_name}.id %%>" %> </td> | |
<td> [ADD INFO] </td> | |
<td> | |
<% if show_action? -%> |
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
<div> | |
<% editable_attributes.each do |attribute| -%> | |
<dl class="row"> | |
<dt class="col-sm-3"><%= attribute.human_name.titleize %>:</dt> | |
<dd class="col-sm-9"><%= "<%= @#{singular_name}.#{attribute.name} %%>" %></dd> | |
</dl> | |
<% end -%> | |
</div> | |
<p> | |
<%= "<%= link_to 'Edit', edit_#{singular_name}_path(@#{singular_name}), class: 'btn btn-sm btn-outline-info' %%>" %> |
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
<%= "<%= form_for @#{singular_name} do |f| %%>" %> | |
<div class="row"> | |
<div class="col-md-4"> | |
<%= "<% if @#{singular_name}.errors.any? %%>" %> | |
<div id="error_explanation"> | |
<%= "<h2><%= pluralize(@#{singular_name}.errors.count, 'error') %%>" %> prohibited this <%= class_name %> from being saved:</h2> | |
<ul class="list-unstyled"> | |
<%= "<% @#{singular_name}.errors.full_messages.each do |message| %%>" %> | |
<%= "<li><%= message %%></li>" %> |