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 Task < ActiveRecord::Base | |
has_one :notification_preference, as: :notifee | |
accepts_nested_attributes_for :notification_preference | |
end | |
class NotificationPreference < ActiveRecord::Base | |
belongs_to :notifee, polymorphic: true | |
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
Game::Note.new | |
(irb):3: warning: toplevel constant Note referenced by Game::Note | |
=> #<Note id: nil, article_id: nil, type: nil, category: nil, body: nil, cite_url: nil, cite_title: nil, cite_website: nil, created_by_id: nil, created_at: nil, updated_at: nil> | |
# ^^ This is a new Note class object, not a Game::Note class object |
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 User < ActiveRecord::Base | |
has_many :memberships | |
has_many :groups, through: :memberships | |
end | |
class Group < ActiveRecord::Base | |
has_many :memberships | |
has_many :members, class_name: 'User', through: :memberships | |
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 < ApplicationRecord | |
has_many :order_items, dependent: :destroy | |
def amount | |
order_items.sum :total_price | |
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
ActiveAdmin::Views::Pages::Base.class_eval do | |
def build(*args) | |
super | |
add_classes_to_body | |
add_attributes_to_body | |
build_active_admin_head | |
build_page | |
end | |
def add_attributes_to_body |
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 class='main-content'> | |
<h2 class='greeting'>Free hi-res stock images for both personal & commercial use.</h2> | |
<ul class='optionsnavi'> | |
<li class='dropdown'> | |
<button class='dropbtn'> | |
Sort By <i class="fa fa-sort-desc" aria-hidden="true"></i> | |
</button> | |
<div id='myDropdown' class='dropdown-content'> | |
<%= link_to "Latest", :sort => "created_at asc" %> |
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
def genderized_comment | |
comment.gsub(/HESHE/, gender_pronoun.capitalize) | |
end | |
def gender_pronoun | |
gender == 'female' ? 'she' : 'he' | |
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
params = {} | |
room = { wall:"red", size:4 } | |
params[:house] = room | |
puts params[:house][:wall] # => 'red' |
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
Content::LibraryPage.each { |c| puts c.live.title if c.live.title.in?(months) } |
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
# The error message | |
undefined method `comments_path' for #<#<Class:0x007f01f0513be8>:0x00000003b43928> | |
Did you mean? font_path | |
Extracted source (around line #1): | |
1 | |
2 | |
3 | |
4 |
NewerOlder