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
def job_history | |
#catch double employee association update | |
@histories = @job.versions.delete_if { |version| version.changeset.keys[0] == "updated_at" } | |
#change array to ActiveRecord relation | |
@histories = @job.versions.where(id: @histories.map(&:id)).paginate(:page => params[:page], :per_page => 15) | |
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
# app/models/particiapnt.rb | |
class Participant < ActiveRecord::Base | |
belongs_to :country | |
has_many :answers | |
has_many :questions, through: :answers | |
end | |
# app/models/survey.rb | |
class Survey < ActiveRecord::Base | |
has_many :questions |
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
To untrack a single file that has already been added/initialized to your repository, i.e., stop tracking the file but not delete it from your system use: git rm --cached filename | |
To untrack every file that is now in your .gitignore: | |
First commit any outstanding code changes, and then, run this command: | |
git rm -r --cached . | |
This removes any changed files from the index(staging area), then just run: | |
git add . |
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
git checkout -b <branch> | |
Edit files, add and commit. Then push with the -u (short for --set-upstream) option: | |
git push -u origin <branch> | |
Git will set up the tracking information during the push. |
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
<td> | |
{(() => { | |
switch(array.od.stage) { | |
case "Ready To Pick": | |
return <button | |
onClick={() => this.handleShow(array.od.id)} | |
> | |
Start Picking | |
</button>; | |
case "Being Picked": |
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 Sophead < ApplicationRecord | |
has_many :ods | |
has_many :od_items, through: :ods | |
end | |
models/od.rb | |
class Od < ApplicationRecord | |
belongs_to :sophead | |
has_many :od_items | |
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
def edit | |
if !!(request.referrer[-1] =~ /\A\d+\z/) | |
@page = request.referrer[-1] | |
else | |
@page = 1 | |
end | |
end | |
############## form ################ | |
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
fetch(url, | |
{ | |
method: 'PUT', | |
headers: {'Content-Type': 'application/json', | |
'Accept': 'application/json', | |
'X-Requested-With': 'XMLHttpRequest', | |
'X-CSRF-Token': token}, | |
body: JSON.stringify({ | |
"od" : { | |
"picker_id" : pickerId, |
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
git fetch origin branch:branch | |
git co branch |
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
trash /usr/local/var/postgres | |
initdb -D /usr/local/var/postgres/ |