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
ruby '2.7.1' | |
gem 'rails', github: 'rails/rails' | |
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data | |
# Action Text | |
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra' | |
gem 'okra', github: 'basecamp/okra' | |
# Drivers |
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
// Required inside postcss.config.js | |
module.exports = { | |
important: true, | |
theme: { | |
container: { | |
center: true, | |
padding: '0.75rem' | |
}, |
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.html.erb | |
<%= f.fields_for :options do |builder| %> | |
<%= render 'option_fields', f: builder %> | |
<% end %> | |
# _option_fields.html.erb | |
<fieldset class='form-group'> | |
<%= f.hidden_field :account_id, value: current_user.account.id %> | |
<%= f.label :name, 'Option' %> |
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
class ApplicationController < ActionController::Base | |
include Clearance::Controller | |
before_action :require_login | |
before_action :require_account | |
include Pundit | |
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized | |
private |
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_with(model: account, local: true) do |form| %> | |
<fieldset> | |
<%= form.label :name, 'Company Name' %> | |
<%= form.text_field :name %> | |
</fieldset> | |
<%= form.fields_for :user do |builder| %> | |
<fieldset> | |
<%= builder.label :email %> |
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
class QuotesController < ApplicationController | |
before_action :set_quote, only: [:show] | |
before_action :require_login | |
skip_before_action :require_login, only: [:index, :show] | |
def show | |
end | |
def new |
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
class ArtistsController < ApplicationController | |
before_action :set_artist, only: [:show, :edit, :update, :destroy] | |
skip_before_action :require_login, only: [:index, :show] | |
def index | |
@artists = Artist.all | |
end | |
def show | |
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
class Artist < ApplicationRecord | |
belongs_to :user | |
has_many :spoken_quotes, class_name: "Quote", foreign_key: :speaker_id | |
has_many :topic_quotes, class_name: "Quote", foreign_key: :topic_id | |
validates :user_id, presence: true | |
validates :name, presence: true, length: { maximum: 120 }, | |
uniqueness: { case_sensitive: false } | |
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
class Quote < ApplicationRecord | |
belongs_to :user | |
belongs_to :speaker, class_name: "Artist" | |
belongs_to :topic, class_name: "Artist" | |
belongs_to :genre | |
delegate :medium, to: :genre, allow_nil: true | |
validates :user_id, presence: true |
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(@quote) do |f| %> | |
<%= render 'shared/error_messages', object: f.object %> | |
<div class='row'> | |
<div class='col'> | |
<div class='form-group'> | |
<%= f.label :speaker, 'Who said it?' %> | |
<%= f.collection_select :speaker_id, Artist.order(:name), :id, :name, | |
{prompt: 'Select an artist'}, {class: 'form-control select-artist'} %> | |
</div> |
NewerOlder