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
# /app/controller/confirmations_controller.rb | |
class ConfirmationsController < Devise::ConfirmationsController | |
skip_before_filter :authenticate_user! | |
# PUT /resource/confirmation | |
def update | |
with_unconfirmed_confirmable do | |
if @confirmable.has_no_password? | |
@confirmable.attempt_set_password(params[:user]) | |
if @confirmable.valid? |
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 Star < ActiveRecord::Base | |
default_scope order: 'registered_at DESC' | |
scope :registered_before, ->(days) { where("registered_at >= ?", days.days.ago) } | |
def self.averages days = 90 | |
registered_before(days).average(:stars, group: "DATE(registered_at, '+1 day')") | |
end | |
end |