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
| Test |
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
| gem 'acts_as_csv', git: 'https://github.com/jordangraft/acts_as_csv.git', branch: 'stable-1.0' |
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 Order < ActiveRecord::Base | |
| has_many :line_items | |
| def has_many_associations | |
| self.reflect_on_all_associations(:has_many).collect {|assoc| "#{assoc.name}_total_amount"} | |
| end | |
| def line_items_total_amount | |
| line_items.sum(:amount) |
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 Order < ActiveRecord::Base | |
| # needs to return an array of strings representing method names that exist for the model | |
| def self.optional_csv_attributes | |
| ['state'] | |
| end | |
| def state | |
| return 'the state' | |
| 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 Order < ActiveRecord::Base | |
| # again it needs to return an array of strings | |
| def self.filter_names | |
| ['ssn', 'credit_card', 'password'] | |
| 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 OrdersController < ApplicationController | |
| def index | |
| ... | |
| respond_to do |format| | |
| format.json { render :index } | |
| format.csv { send_data build_csv, filename: "Orders-#{Date.today}.csv" } | |
| 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
| <a target='_sef' href='/some/path?{{ransackParams(q)}}'></a> |
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
| cd ~ | |
| git clone https://github.com/letsencrypt/letsencrypt | |
| cd letsencrypt | |
| sudo service nginx stop | |
| ./letsencrypt-auto certonly --standalone -d static-staging.example.com | |
| sudo service nginx start |
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
| ssl_certificate /etc/letsencrypt/live/static-staging.example.com/fullchain.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/static-staging.example.com/privkey.pem; |
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
| #!/bin/sh | |
| sudo service nginx stop | |
| sudo /home/ubuntu/letsencrypt/letsencrypt-auto renew -nvv --standalone | |
| sudo service nginx start |
OlderNewer