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
# Requires on the model that mixes this concern in: | |
# => approved_by integer | |
# => approved_at DateTime | |
# => disapproved_by integer | |
# => disapproved_at DateTime | |
module Moderation | |
extend ActiveSupport::Concern | |
included do |
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 Bannable | |
extend ActiveSupport::Concern | |
included do | |
extend ClassMethods | |
default_scope where("banned_at IS NULL") | |
end | |
def ban(reason=nil) | |
options = ban_attributes({ban_reason: reason, banned_at: DateTime.now}) |
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 "unpublished reviews are fucking up listing scores" do | |
let(:reviewable) { create(:dispensary) } | |
let(:user) { create :user } | |
before do | |
25.times do | |
review = Review.create! user: user, reviewable: reviewable, | |
title: "title", body: "body" | |
review.create_rates atmosphere: 5, bud_quality: 5, accessibility: 5, | |
staff: 5, price: 5 | |
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
(function() { | |
// Localize jQuery variable | |
var jQuery; | |
/******** Load jQuery if not present *********/ | |
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') { | |
var script_tag = document.createElement('script'); | |
script_tag.setAttribute("type","text/javascript"); | |
script_tag.setAttribute("src", |
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 Models | |
module Concerns | |
module Bannable | |
extend ActiveSupport::Concern | |
included do | |
default_scope -> { where(banned_at: nil) } | |
end | |
def ban(reason=nil) |
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
guard "minitest", all_on_start: false, rerun: false do | |
# with Minitest::Spec | |
watch(%r|^test/(.*)_test\.rb|) | |
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" } | |
watch(%r|^test/minitest_helper\.rb|) { "test" } | |
watch(%r|^test/support/|) { "test" } | |
# Rails 3.2 | |
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" } | |
watch(%r|^app/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}_test.rb" } |
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
guard "minitest", all_on_start: false, rerun: false do | |
# with Minitest::Spec | |
watch(%r|^test/(.*)_test\.rb|) | |
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_test.rb" } | |
watch(%r|^test/minitest_helper\.rb|) { "test" } | |
watch(%r|^test/support/|) { "test" } | |
# Rails 3.2 | |
watch(%r|^app/controllers/(.*)\.rb|) { |m| "test/controllers/#{m[1]}_test.rb" } | |
watch(%r|^app/mailers/(.*)\.rb|) { |m| "test/mailers/#{m[1]}_test.rb" } |
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
. /usr/local/etc/bash_completion.d/git-prompt.sh | |
. /usr/local/etc/bash_completion.d/git-completion.bash | |
export PS1='\[\033[01;32m\]\h\[\033[01;34m\] \w\[\033[31m\] $(__git_ps1 "(%s)") \[\033[01;34m\]$\[\033[00m\] ' |
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
platform: &platform | |
<% if RUBY_PLATFORM == "java" %> | |
adapter: jdbcpostgresql | |
<% else %> | |
adapter: postgresql | |
<% end %> | |
default: &default | |
<<: *platform | |
username: dreamr |
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
modelName = $('#review_filter').val() || "dispensary" | |
$('#review_filter_query').attr("placeholder","#{modelName.capitalize}") | |
$('#review_filter_query').attr("data-autocomplete", "/admin/reviews/autocomplete_#{modelName}_name") | |
$.fn.capitalize -> | |
$.each this, -> | |
caps = this.value | |
caps = caps.charAt(0).toUpperCase() + caps.slice(1) | |
this.value = caps | |
return this |