This file contains hidden or 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
# Run every day at midnight | |
# cd into the Rails app directory | |
# run the rake task `logs:prune` | |
0 0 * * * cd /Users/you/projects/myrailsapp && /usr/local/bin/rake RAILS_ENV=production logs:prune |
This file contains hidden or 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
<script src="http://<BEACON_HOST>/v1/config?configuration_id=<CONFIG_ID"></script> |
This file contains hidden or 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
<script src="http://<BEACON_HOST>/v1/config?configuration_id=<CONFIG_ID"></script> |
This file contains hidden or 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
<%= f.collection_select(:shipping_method, @ship_method_options, :id, :name) %> | |
<%= f.input :shipping_method_other %> |
This file contains hidden or 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 data-controller='tabs' data-tabs-index='1' | |
.tabs.is-boxed.is-marginless | |
ul | |
li data-target='tabs.tab' | |
a data={action: "tabs#change"} Tab 1 | |
li data-target='tabs.tab' | |
a data={action: "tabs#change"} Tab 2 | |
.tab.box data={target: 'tabs.tabPanel'} Tab panel 1 | |
.tab.box data={target: 'tabs.tabPanel'} Tab panel 2 |
This file contains hidden or 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
<tr data-action="click->table#click" data-controller="table"> | |
<td> 2018-01-11 </td> | |
<td> | |
<a data-target="table.url" href="/invoices/1">$7,000.00</a> | |
</td> | |
</tr> |
This file contains hidden or 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
module Sequential | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def next_custom_id_for_tenant(tenant_id) | |
raise "Tenant is required" unless tenant_id.present? | |
# FIXME: Should probably store this value in some external resource, as this could cause race conditions and/or performance issues due to transaction locking. | |
# Possibly use PG Triggers? |
This file contains hidden or 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
document.addEventListener('turbolinks:load', function(){ | |
var el = document.getElementById('js-parallax-window') | |
if (el) { | |
parallax(el); | |
} | |
window.addEventListener('scroll', function(e){ | |
if (el) { | |
parallax(el); | |
} |
This file contains hidden or 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
describe CommentCreator do | |
it 'should persist record' do | |
assert_difference 'Comment.count', +1 do | |
CommentCreator.new(comment_params).call | |
end | |
end | |
end |
This file contains hidden or 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 SignupsController < ActionController::Base | |
def create | |
@signup = TenantCreator.new(signup_params) | |
if @signup.call | |
redirect_to welcome_url(account_id: @signup.tenant.subdomain, auth_token: @signup.user.auth_token) | |
else | |
flash.now[:error] = @signup.errors.full_messages.join(', ') | |
render action: :index | |
end | |
end |