text
stringlengths
10
2.61M
module IGMarkets class DealingPlatform # Provides methods for working with client sentiment. Returned by {DealingPlatform#client_sentiment}. class ClientSentimentMethods # Initializes this helper class with the specified dealing platform. # # @param [DealingPlatform] dealing_platform The dea...
require 'grpc/errors' require 'google/cloud/errors' module GRPC module Kit module Communication module Resilient DEFAULT_RESCUED_ERRORS = [ GRPC::BadStatus, Google::Cloud::UnavailableError, Google::Cloud::InternalError ].freeze def resilient(limit: 16,...
class EntriesController < ApplicationController before_filter :get_organization def create Entry.transaction do credit_account = @organization.accounts.where(id: params.require(:credit_account_id)).first debit_account = @organization.accounts.where(id: params.require(:debit_account_id)).first ...
class Paginator DEFAULT_PAGE = 1 def self.paginate_relation(kaminari_relation, params) map_from_relation_to_hash( kaminari_relation, params[:page].try(:to_i) || DEFAULT_PAGE, params[:per_page].try(:to_i) || kaminari_relation.default_per_page, kaminari_relation.total_count ) end ...
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../../lib/fog/google/models/storage/directory' describe 'Fog::Google::Storage::Directory' do describe "#initialize" do it "should remap attributes from parser" do now = Time.now directory = Fog::Google...
class Commissionerd require 'socket' attr_reader :server, :configfile attr_accessor :config def initialize require 'yaml' @configfile = "config/commissionerd.yml" @config = YAML.load_file(@configfile) if @config["socket"] && ! @config["tcpip"] @server = UNIXServer.new(@config["socketfile"]...
module RailsSettings class SettingObject < ActiveRecord::Base self.table_name = 'settings' belongs_to :target, :polymorphic => true validates_presence_of :var, :target_type validate do errors.add(:value, "Invalid setting value") unless value.is_a? Hash unless _target_class.default_setti...
pkgs = value_for_platform( [ "centos", "redhat", "fedora" ] => { "default" => %w{ php53-cli php-pear } }, [ "debian", "ubuntu" ] => { "default" => %w{ php5-cgi php5-cli php-pear } }, "default" => %w{ php5-cgi php5-cli php-pear } ) pkgs.each do |pkg| package pkg do action :install end end if...
class FileList include Enumerable attr_reader :store def initialize(file) file = File.new(file) if file.is_a?(String) file.each_line do |line| parse(line) end end def each store.each { |elm| yield elm } end def each_pair store.each_pair do |k,v| yield k, v end end...
# frozen_string_literal: true # require 'matrix' class Board attr_reader :board def initialize(board = Array.new(6) { Array.new(7, '-') }) @board = board end def get_move(piece) # p 'getting move' row = player_input column = calculate_column(row) if valid_move?(row, column) add_move...
class HistoryBarQuery def self.main_query(options = {}) @transactions_bar = TransactionBar.where(input_bar_id: options[:id_order]).order("input_bar_id DESC") end def self.inputs(options = {}) reset_query_state @inputs_bar = inputs_bar.where.not(date_out: :NULL).order("date_in DESC") if options...
require './src/reporter' require './src/interface' require './src/router' class Robot < Interface attr_accessor :x, :y, :facing, :router def initialize(x = 0, y = 0, facing = :north, router = Router) @router = router.new x, y, facing @facing = @router.facing @x = @router.x @y = @router.y @dire...
require 'nokogiri' require 'open-uri' class Scraper def self.scrape_index_page(index_url) doc = Nokogiri::HTML(open(index_url)) students = doc.css("div.student-card") students_array = [] students.each{|student| students_array.push({ :name => student.css("div.card-text-container h4.student...
class AddImageColumnsToEndUsers < ActiveRecord::Migration[5.2] def change add_column :end_users, :twitter_image, :string add_column :end_users, :profile_image_id, :string end end
class User < ActiveRecord::Base belongs_to :address has_many :mytimeslots, :as=>:booker, :order=>"myorder ASC" validates_confirmation_of :password, :on=>:create validates_presence_of :first_name, :last_name, :email, :password validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i val...
# -*- encoding : utf-8 -*- class ChangeReadedTimesFromNotifies < ActiveRecord::Migration def up change_column :notifies, :readed_times, :integer, :default => 0 end def down change_column :notifies, :readed_times, :integer, :default => :null; end end
class ChartQuery include ActiveModel::Conversion extend ActiveModel::Naming attr_reader :start_date, :end_date, :shareholder_id def self.grouped_shareholders result = {'All' => [['Anyone',nil]],'Active' => [], 'Inactive' => []} Shareholder.order(:name).each do |sh| result[sh.status].push([sh.nam...
=begin Write your code for the 'Beer Song' exercise in this file. Make the tests in `beer_song_test.rb` pass. To get started with TDD, see the `README.md` file in your `ruby/beer-song` directory. =end class BeerSong def self.recite(starting, count) case count when 1 verse(starting) else star...
Rails.application.routes.draw do get "categories/index" root "static_pages#home" get '/introduction', to: 'static_pages#introduction' get '/contact', to: 'static_pages#contact' get '/help', to: 'static_pages#help' get '/login', to: "sessions#new" post '/login...
# Abstract the process of killing dialog boxes. Kills them # until closed, for a given PID. # # Author: Ben Nagy # Copyright: Copyright (c) Ben Nagy, 2006-2013. # License: The MIT License # (See http://www.opensource.org/licenses/mit-license.php for details.) require 'ffi' require 'bm3-core' module BM3 module Win32...
class ChangeColumnsForCategory < ActiveRecord::Migration def change remove_column :categories, :subcategory_id, :integer add_reference :subcategories, :category, index: true end end
class Api::V1::BaseController < ActionController::Base respond_to :json before_filter :authenticate_user private def authenticate_user @current_user = User.where(authentication_token: params[:token]).first unless @current_user respond_with({ error: "Token is invalid." }) end en...
# frozen_string_literal: true require "spec_helper" RSpec.describe PatternStore do subject(:pattern_store) { PatternStore.new } it { expect(pattern_store).not_to be_nil } describe "#[]" do context "when a known pattern is requested" do context "as string" do let(:pattern_name) { "xes" } ...
# == Schema Information # Schema version: 3 # # Table name: categories # # id :integer(11) not null, primary key # name :string(255) # class Category < ActiveRecord::Base has_many :posts def Category.find_select_options [[ '-- Select a Category --', '' ]] + Category.find(:all).map...
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } root 'students#index' resources :students do get '/entries/ids', :to => 'entries#ge...
require 'fileutils' class Subject < ActiveRecord::Base include ContentManagement::Model include PublicActivity::Model tracked RESERVED_NAMES = ["homepage_header", "index", "promotion", "homepage"] include Liquid::Rails::Droppable enum status: [ :open, :close ] acts_as_punchable class_attribute :de...
# class LinkedList attr_reader :size def initialize clear end def empty? @size.zero? end def clear @head = nil @tail = nil @size = 0 end def add(data) link_head(data) end # def get # validate(1) # @head.element # end def get_first validate(1) @head.e...
class Tweet < ActiveRecord::Base validates_length_of :tweet, :in => 1..140 belongs_to :user end
json.array!(@entries) do |entry| json.extract! entry, :id, :nick, :r1, :r2, :r3, :r4, :r5, :r6, :tournament_id json.url entry_url(entry, format: :json) end
module Intent class Combat < Action attr_reader :attack attr_reader :defend attr_accessor :mo_delta def initialize(attack, defend) super attack.entity, {encumbrance: false, status_tick: false, unhide: false, alive: false} # checks get done in Attack intent @mo_delta = 0 @attack = attack @defend ...
class ChangeUsersToEmbedPerson < ActiveRecord::Migration[5.2] def change remove_reference :users, :person, foreign_key: true add_column :users, :full_name, :string add_column :users, :ic, :string add_reference :users, :person_type, foreign_key: true add_reference :users, :ic_type, foreig...
class Memory < ActiveRecord::Base belongs_to :creator, class_name: "User" has_many :comments has_many :pending_replies, -> { where approved: false }, class_name: "Comment" has_many :approved_comments, -> { where approved: true }, class_name: "Comment" has_and_belo...
require 'rails_helper' require 'spec_helper' RSpec.describe User, type: :model do it { should have_many(:feedbacks) } it { should validate_presence_of(:first_name) } it { should validate_presence_of(:last_name) } it { should validate_presence_of(:email) } it { should validate_presence_of(:password) } end
class User include HyperMapper::Document attr_accessor :password # Determines, as in Rails, which attributes can be modified via mass assignment attr_accessible :username, :bio, :password # HyperMapper will generate a unique ID the first time this # User is saved autogenerate_id # Create t...
# frozen_string_literal: true require "digest" # This class creates/mines a block with necessary information class Block def initialize(timestamp:, transactions:) @timestamp = timestamp @transactions = transactions @nonce = 0 end def mine_block(difficulty) difficulty_string = "0" * difficulty ...
# frozen_string_literal: true class AuthService def initialize(config) @config = config @registry = PolicyRegistry.setup!(config) end attr_reader :config include GRPC::GenericService self.marshal_class_method = :encode self.unmarshal_class_method = :decode self.service_name = 'envoy.service.au...
class TriangleMovesCounting def initialize(n) @n = n end # This probably isn't the right way to go, but it will work for now. def each_position(&block) (0...@n).flat_map do |x| (0..x).map { |y| yield(x, y) } end end def count_moves(positions) each_position { |x, y| count_position(x,...
class ContactsController < ApplicationController # before_action :authenticate_user, except: [:index, :show] def index # contacts = Contact.all.order(:id => :asc) #shows all contacts from the database contacts = Contact.all.where(user_id: current_user.id) if params[:first_name_search] contacts = ...
module Api::V1::Agents class ProposalsController < AgentUsersController include Serializable before_action :set_job, only: %i[create destroy] before_action :set_proposal, only: %i[destroy] def index proposals = current_user.proposals set_response( 200, 'Propuestas listadas exitosa...
# frozen_string_literal: true module Jiji::Composing::Configurators class IconConfigurator < AbstractConfigurator include Jiji::Model def configure(container) container.configure do object :icon_repository, Icons::IconRepository.new end end end end
module Endpoints class Versions < Base namespace "/versions" do get do versions = Version.reverse(:number) versions = versions.where(platform: params['platform']) if params['platform'] encode serialize(versions) end get "/:identity" do |identity| version = Versio...
Given(/^a node "(.*?)" started with a votenotify script$/) do |arg1| name = arg1 options = { image: "nunet/empty", links: @nodes.values.map(&:name), args: { debug: true, timetravel: timeshift, votenotify: "/shared/votenotify.sh", }, } node = CoinContainer.new(options) @nodes...
class Item < ActiveRecord::Base belongs_to :package belongs_to :user validates :name, presence: true validates :brand, presence: true validates :unit_price, presence: true validates :quantity, presence: true def self.unpacked_items(userid) where("user_id == #{userid} and package_id is null") end end
module Cultivation class UpdateTrayPlans prepend SimpleCommand attr_reader :current_user, :batch_id def initialize(current_user, args = {}) args = { batch_id: nil, # BSON::ObjectId, Batch.id }.merge(args) @batch_id = args[:batch_id].to_bson_id @current_user = current_use...
# source: https://launchschool.com/exercises/66216db8 # Q: Write a minitest assertion that will fail if the value.odd? is not true. def test_odd_question assert_equal(true, value.odd?) end
When /^(\d+) of (\d+) attacks succeed$/ do |success, total| deaths = [true] * success + (all - count) * [false] @attacker.kill_armies(@defender, deaths) end Then /^then attacker should have (\d+) armies left$/ do |d| @attacker.game_player_country.armies.should == d.to_i end Then /^then defender should have (\d+...
# frozen_string_literal: true RSpec.describe ZoomSlack::ProcessDetector::Base do describe ".for_platform" do it "should return Mac instance" do expect(ZoomSlack::ProcessDetector.for_platform).to be_instance_of(ZoomSlack::ProcessDetector::Mac) end end describe "#running" do it "should raise exc...
require 'spec_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to specify the controller code that # was generated by the Rails when you ran the scaffold generator. describe CupsController do def mock_cup(stubs={}) @mock_cup ||= moc...
class AddCustomerToFormatType < ActiveRecord::Migration[5.0] def change add_reference :format_types, :customer, index: true add_reference :format_types, :environment, index: true end end
# @param {Integer[]} nums1 # @param {Integer[]} nums2 # @return {Float} def find_median_sorted_arrays(nums1, nums2) array = (nums1 + nums2).sort mid = array.length.to_f / 2 if array.length.odd? return array[mid.floor] else return (array[mid-1] + array[mid]).to_f / 2 end end
class BusinessesController < ApplicationController before_action :signed_in_user, only: [:index] before_action :admin_user, only: [:new, :create, :edit, :update, :destroy] # GET /businesses # GET /businesses.json def index @businesses = Business.all end # GET /businesses/1 # GET /businesses/1.json...
module Boilerpipe::SAX::TagActions # for inline elements, which triggers some LabelAction on the # generated TextBlock. class InlineTagLabel def initialize(label_action) @label_action = label_action end def start(handler, name, attrs) handler.append_space handler.add_label_action(@l...
# frozen_string_literal: true require 'rails_helper' RSpec.describe Actions::CreatePayment do let(:user) { create :user } let(:event) { create :event } let(:reservation) { create :reservation, event: event, user: user } describe 'call' do let(:amount) { 100 } let(:token) { 'token' }...
# encoding: utf-8 # language: ru module NavigationHelpers # Maps a name to a path. Used by the # # When /^I go to (.+)$/ do |page_name| # # step definition in web_steps.rb # def path_to(page_name) case page_name when /Главная/ '/' when /Авторизация/ '/sign_in' ...
require 'spec_helper' # There is no User class within Forem; this is testing the dummy application's class # More specifically, it is testing the methods provided by Forem::DefaultPermissions describe User do subject { User.new } describe Forem::DefaultPermissions do it "can read forums" do assert subj...
require 'sinatra' require "sinatra/reloader" if development? set :bind, ENV['VCAP_APP_HOST'] || "0.0.0.0" set :port, ENV['PORT'] || "4567" def greeting ENV['GREETING'] || 'Howdy' end get '/' do "#{greeting}!" end get '/:name' do "#{greeting}, #{params[:name]}!" end
require 'benchmark' module RabbitJobs # Module to include in client jobs. module Job attr_accessor :created_at def expired? exp_in = self.class.expires_in.to_i return false if exp_in == 0 || created_at.nil? Time.now.to_i > created_at + exp_in end def to_ruby_string(*params) ...
FreshTomato::Application.routes.draw do resources:movies root :to => redirect('/movies') end
json.type @folder.class.name json.description 'A FavoriteFolder helps organize Submissions for a Profile.' json.folder { json.name { json.description 'Folder name.' json.type 'String' json.required true json.max_length 80 } json.is_private { json.description 'The Folder will be visia...
require "spec_helper" describe Song do it "should have basic information" do song =Song.create() song.should respond_to :title song.should respond_to :description song.should respond_to :duration song.should respond_to :track song.should respond_to :file_location end it "Album can have m...
require 'rails_helper' describe ServerController do describe 'GET show' do let(:action) { get :show } it 'returns server data' do action end end end
class CreateLocationRelationships < ActiveRecord::Migration def change create_table :location_relationships do |t| t.integer :location_id, null: false t.integer :locatable_id, null: false t.string :locatable_type, null: false t.timestamps end add_index :location_relationships, [:...
class ProbesGrid include Datagrid scope do Probe.order(:movie).order(:customer) end filter(:movie) filter(:customer) filter(:rating) include ActionView::Helpers::UrlHelper column(:movie) do |p| ActionController::Base.helpers.link_to(p.movie, Rails.application.routes.url_helpers.movie_path(p.movie)) e...
class EventrinfosController < ApplicationController before_action :load_user before_action :ensure_proper_user, only: [:create, :edit, :update, :destroy] def new @eventrinfo = Eventrinfo.new end def create # @eventrinfo = @user.eventrinfo.build(eventrinfo_params) @eventrinfo = Eventrinfo.new(:first...
ActiveAdmin.register VendorCode do menu :priority => 7 permit_params :email, :code, :user_name, :name index do column "User Name", :user_name column :email column :code column "Vendor", :name column :created_at column "" do |vendor_code| links = ''.html_safe links += link_to ...
# Have the function ThirdGreatest(strArr) take the array of # strings stored in strArr and return the third largest word # within in. So for example: if strArr is ["hello", "world", # "before", "all"] your output should be world because "before" # is 6 letters long, and "hello" and "world" are both 5, but # the output...
# Tealeaf Academy Prep Course # Intro to Programming # Exercises # Exercise 16 a = ['white snow', 'winter wonderland', 'melting ice', 'slippery sidewalk', 'salted roads', 'white trees'] a_parsed = a.map {|phrase| phrase.split}.flatten
class Apcl < ActiveRecord::Base self.table_name = "apcls" self.primary_key = "apclsid" has_many :apxs end
class TweetsController < ApplicationController before_action :set_tweet, only: %i[edit update destroy] def index @tweets = Tweet.all.select { |tweet| tweet.parent_id.nil? } @tweet = Tweet.new end def show @tweet = Tweet.find(params[:id]) @tweets = @tweet.replies end def create @tweets...
# Desenvolva uma classe que abstraia o funcionamento de uma conta bancária. # Deve ser possivel: # - Criar contas com no mínimo 50 reais # - Depositar dinheiro # - Sacar dinheiro # - Transferir dinheiro # Não deve ser possível: # - Sacar mais so que se tem # - Sacar ou depositar valores negativos require 'test/unit' ...
class Forms class Session include ActiveAttr::Model attribute :email attribute :password validates :email, presence: true validates :password, presence: true end end
# Build a program that randomly generates and prints Teddy's age. To get the age, # you should generate a random number between 20 and 200. # Understand the problem: # Call the method # Generate a rand num 20..200 # Print the number in a string # Return value isn't used # Test cases: # "Teddy is 69 years o...
#!/usr/bin/env ruby require 'pathname' require 'fileutils' TESTING = true TVSHOWS_FOLDERS = [ "/Volumes/Data/Videos/TV\ Shows" ].freeze ALLOWED_CHARS = /[^0-9A-Za-z]/ files = [ "/Volumes/Downloads/TV Shows/TV Shows - Favorites/The.Walking.Dead.S03E10.HDTV.XviD-AFG.avi", ] $stdout.reopen('filemover-shows.log','...
include Bootcamp describe Bootcamp::Book do before :each do @file_path = 'text.out' @file = "sdfsd ds fsdf sdf \n sdf sdfsdf s dfg df g d\n df" File.stub(:read).and_return(@file) allow(File).to receive(:exist?).with(@file_path).and_return(true) end it 'performs valid operations with book file' ...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
FactoryGirl.define do factory :supplement do name { Faker::StarWars.planet } description { Faker::StarWars.quote } end end
require "test_helper" feature "As a user, I would like to see the details of memories" do before do @user = users :user_1 sign_in @user end scenario "users can view other user's memory details" do # given one of another user's memories @memory = memories :user2_memory # when the user visits...
class User < ActiveRecord::Base has_many :authentications, :dependent => :destroy has_many :credentials, :dependent => :destroy has_many :trips, :dependent => :destroy # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, :lockable and :timeoutable devise :database...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
module EulerSolution def run raise 'Not implemented' end end def execute(problem) start_time = Time.now result = problem.run end_time = Time.now puts "Result: #{result}" puts "Time: #{((end_time - start_time) * 1000).to_i}ms" end
FactoryGirl.define do factory :email_user do email {Faker::Internet.email} association :user end end
class AddColumnsSpot < ActiveRecord::Migration[5.1] def change add_column :spots, :bathrooms, :string add_column :spots, :bedrooms, :string add_column :spots, :beds, :string end end
FactoryBot.define do factory :address do trait :invalid do valid false after(:build) { |address| address.errors.add(:street, "can't be blank") } end end end
require_relative "lib/characterize/version" Gem::Specification.new do |spec| spec.name = "characterize" spec.version = Characterize::VERSION spec.authors = ["Jim Gay"] spec.email = ["jim@saturnflyer.com"] spec.description = "Use plain modules like presenters" spec.summary = "Use plain modules like presente...
require 'date' class Logger def self.log(text, include_timestamp=true) if include_timestamp puts "#{DateTime.now.to_s} - #{text}" else puts text end end end
class CreateFineCancelTrackers < ActiveRecord::Migration def self.up create_table :fine_cancel_trackers do |t| t.integer :user_id t.decimal :amount, :precision => 5, :scale => 1, :default => 0 t.integer :finance_id t.string :finance_type t.date :date t.integer :transaction_id ...
require 'test_helper' class AboutUsControllerTest < ActionDispatch::IntegrationTest setup do @about_u = about_us(:one) end test "should get index" do get about_us_url assert_response :success end test "should get new" do get new_about_u_url assert_response :success end test "should...
class Admin::BlogsController < Admin::AdminController before_filter :set_previous_path, only: [:new, :edit] helper_method :previous_path def index @blogs = Blog.order('created_at desc') end def new @blog = Blog.new end def show @blog = Blog.find(params[:id]) end def edit @blog = ...
class UsersController < ApplicationController skip_before_action :authenticate_user, only: [:create] def show user = current_user render json: {userId: user.id, username: user.username, email: user.email, friendcode: user.friendcode} end def create user = User.new(auth_params) if user.save ...
class CheckoutController < ApplicationController def new @book = Book.find_by(slug: params[:book]) end def create if current_user.street_address.nil? flash[:notice] = "Please update your address to checkout." redirect_to account_settings_path else book = Book.find_by(slug: params[:b...
require 'rack/test' require File.join(File.dirname(__FILE__), 'arabic_number_translator.rb') set :environment, :test def app Sinatra::Application end describe 'Arabic Number Translator' do include Rack::Test::Methods it "should be valid" do get '/' last_response.body.should =~ /Western numerals using ...
require 'command_test' class TestGenerateLocalizationArchive < CommandTest def new_runner(twine_file = nil, options = {}) options[:output_path] = @output_path options[:format] = 'apple' unless twine_file twine_file = build_twine_file 'en', 'fr' do add_section 'Section' do add_def...
class StudentRollNumber def self.validate_if_roll_number_already_taken(stud_id, suffix, student_hash, batch_id) roll_number = suffix[:roll_number] in_student_hash = student_hash.select{|id, val| id != stud_id.to_s && val["roll_number"] == roll_number.to_s && val["roll_number"].present?} if in_student_has...
require 'addressable/uri' require "downloader/util" require 'downloader/loggable' module Downloader # Helper class for extracting and/or manipulating URL segments. # Uses Addressable::URI for parsing. class UrlHelper extend Loggable # Returns +url+ with extraneous special characters removed. # ...
class ChangedUsersAddedUgroupsCountAndDeletedGroupsCount < ActiveRecord::Migration def self.up add_column :users, :ugroups_count, :integer remove_column :users, :groups_count end def self.down add_column :users, :groups_count, :integer, :limit=>nil, :default=>nil remove_column :users, :ugroups_...
class Users::RegistrationsController < ::Devise::RegistrationsController layout 'user' respond_to :html, :json before_action :configure_sign_up_parameters, if: :devise_controller? after_action :transfer_guest_user_cart, if: -> { session[:guest_user_id].present? } def create build_resource(sign_up_params...
root = Rails.root.to_s namespace :db do desc 'Disconnect everyone from postgres database' task drop_connections: :environment do cnf = YAML.load_file(root + '/config/database.yml')[Rails.env] if cnf['adapter'] != 'postgresql' puts 'db:drop_connections(): Current database is not PostgreSQL! Ign...
class UserEventsController < ApplicationController respond_to :json def create begin user_event = UserEvent.new(params[:user_event]) user_event.record respond_with user_event rescue ArgumentError => error logger.info("#{error}") respond_with :status => :bad_request end end end
class Notice < ApplicationRecord belongs_to :user belongs_to :kind, polymorphic: true, optional: true default_scope -> { order(updated_at: :desc) } validates :user_id, presence: true validates :kind_id, presence: true validates :kind_type, presence: true def add_unread_count!...
namespace :tag_stat do desc "default task" task default: :environment do Tag.each do |t| TagStatWorker.perform_async(t.name) end end end