Skip to content

Instantly share code, notes, and snippets.

View chrislerum's full-sized avatar

Chris Lerum chrislerum

View GitHub Profile
Bundler could not find compatible versions for gem "actionpack":
In Gemfile:
haml-rails was resolved to 0.9.0, which depends on
actionpack (>= 4.0.1)
kaminari was resolved to 0.17.0, which depends on
actionpack (>= 3.0.0)
lograge was resolved to 0.11.2, which depends on
actionpack (~> 5.2.4)
@chrislerum
chrislerum / Supplier.rb
Last active November 25, 2017 02:01
Shouldn't includes give different sql?
class Supplier < ApplicationRecord
has_many :supplier_results
end
get 'videos/:id/coveritlive/enable', controller: 'coveritlive', action: :enable, as: :coveritlive_enable
get 'videos/:id/coveritlive/disable', controller: 'coveritlive', action: :disable, as: :coveritlive_disable
get 'videos/:id/coveritlive/reset', controller: 'coveritlive', action: :reset, as: :coveritlive_reset
get 'videos/:id/coveritlive/start', controller: 'coveritlive', action: :start, as: :coveritlive_start
get 'videos/:id/coveritlive/end', controller: 'coveritlive', action: :end, as: :coveritlive_end
how to structure builder so filter requires both hidden be false AND approved be true?
right now, 'approved' just replaces the 'hidden' line.
query = Jbuilder.encode do |json|
json.query do
json.multi_match do
json.query term
json.fields ['title^2', 'description', 'tags.name']
end
end
<table>
<%= f.fields_for :daughters do |daughters_form| %>
<tr>
<td>
Daughter Name:
</td>
<td>
<%= daughters_form.text_field :name %>
</td>
<td>
server {
listen 81;
server_name sempermedusa.com/blog;
return 301 http://$server_name$request_uri;
}
<tr>
<td class="my-label">
<input type="checkbox" name="user[role_ids][]" id="role_1" value="1" checked="checked" />
</td>
<td class="value">
<label for="role_1">Approver</label>
</td>
</tr>
module ActiveModel
class Errors
def full_messages
map do |attribute, message|
if attribute == :name
full_message(' ', message)
else
full_message(attribute, message)
end
end
rspec ./spec/models/video_spec.rb
.....F
Failures:
1) Video#last_used works with one video
Failure/Error: expect(Video.last_used.usec).to eq video.updated_at.usec
expected: 840199
got: 0
5 def self.top_player
6 averages = {}
7 joins(:games).group(:id).each {|player| averages[player.name.to_sym] = player.games.average(:score).to_i}
8 averages.max_by{|k,v| v}[0]
9 end