text
stringlengths
10
2.61M
module IControl::LocalLB ## # The ProfileDiameter interface enables you to manipulate a local load balancer's Diameter # profile. class ProfileDiameter < IControl::Base set_id_name "profile_names" class ProfileDiameterStatisticEntry < IControl::Base::Struct; end class ProfileDiameterStatistics < I...
class PartnerProductsWidenPartnerKey < ActiveRecord::Migration def self.up change_table :partner_products do |t| t.change :partner_key, :string, :limit => 128 end end def self.down change_table :partner_products do |t| t.change :partner_key, :string, :limit => 16 end end ...
# # Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands. # # This file is part of New Women Writers. # # New Women Writers is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundat...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? rescue_from ActiveRecord::RecordNotFound, wit...
class AddEnailIndexToKitchens < ActiveRecord::Migration def self.up add_index :kitchens, :email, :unique => true end def self.down remove_index :kitchens, :email end end
class AprofilesController < ApplicationController before_filter :authenticate_academic! def new @aprofile = Aprofile.new @aprofile.academic_id = current_academic.id @departments = Department.order(:title) end def create @aprofile = Aprofile.new(params[:aprofile]) @aprofile.academic_id ...
require "./q7/menu" class Q7::Food < Q7::Menu attr_accessor :calorie def initialize(name:, price:, calorie:) super(name: name, price: price) @calorie = calorie end end
class CreateSports < ActiveRecord::Migration def change create_table :sports do |t| t.string :name, index: true, null: false t.references :user, index: true, foreign_key: true, null: false end end end
module Syouhai KACHI = 0 AIKO = 1 MAKE = 2 end #module-end
require "rails_helper" RSpec.feature "Admin Manage User", :type => :feature do before do @admin = create(:admin) sign_in(@admin) click_link 'User Management' expect(page).to have_content('Listing Users') end it "can create user" do click_link 'New User' fill_in 'user_fullname', with: 'Ne...
module DataSource class Middleman def initialize(resource) @resource = resource end def title @resource.data[:title] end # Episode paths look like this: # episodes/001-business-travel.html # # This method will parse out a 1 from the example path. def episode_numbe...
class RelatedTransaction < ActiveRecord::Base belongs_to :get_transaction, class_name: :transaction end
class ArticlesController < ApplicationController before_filter :load_article, :only => [:show, :edit, :destroy] before_filter :upcaser, :only => [:index] before_filter :filter_comments, :only => [:show] around_filter :flash_apology, :only => [:index] # around_filter :flash_apology, :only => [:show, :edit, :de...
require 'spec_helper' describe "Pages" do subject { page } describe "Home page" do it "should have the title 'MBlizz'" do visit root_path expect(page).to have_title("MBlizz") end describe "for signed in user" do let(:user) { FactoryGirl.create(:user) } before d...
require 'minitest/reporters' Minitest::Reporters.use! require 'minitest/autorun' class HelloTest < Minitest::Test def test_greeting assert_equal 'hello world!!', greeting end end def greeting 'hello world' end
require 'rails_helper' feature 'post new question', %Q{ As a user I want to post a question So that I can receive help from others } do # Acceptance Criteria # - I must provide a title that is at least 40 characters long # - I must provide a description that is at least 150 characters long # - I must be ...
require 'rubygems' require 'xmlparser' module OSMLib module Stream # Stream parser for OpenStreetMap XML files using Expat. class Parser::Expat < OSMLib::Stream::ParserBase # Create new StreamParser object. Only argument is a hash. # # call-seq: OSMLib::Stream::Parser.new(:filename => 'f...
class History < ApplicationRecord belongs_to :concrete_history, polymorphic: true belongs_to :card validates :card, presence: true validate :read_history_validates def read_history_validates if concrete_history.kind_of? ReadHistory if concrete_history.page_count >= card.book.page errors.a...
class Carousel < ApplicationRecord has_many :timeline_posts, dependent: :nullify has_many :timelines, through: :timeline_posts has_many :images, -> { order(:position) }, as: :container end
# == Schema Information # # Table name: languages # # id :integer not null, primary key # name :string(255) # links_count :integer # created_at :datetime # updated_at :datetime # class Language < ActiveRecord::Base has_many :tags, inverse_of: :language has_many :links, through: :tag...
class Birthday @@filepath = nil def self.filepath=(path=nil) @@filepath = File.join(APP_ROOT, path) end #checks if the file we are looking exists in the correct directory def self.file_exists? if @@filepath && File.exists?(@@filepath) return true else return false end end #c...
module UserTodoRules::Common module AddFunFacts def rule_triggerable?(user); Answer.count(:joins=>"JOIN questions on question_id = questions.id JOIN users on user_id=users.id", :conditions => ["user_id = ? AND questions.question_type='fun fact'", user.id]) == 0; end def rule_link_url(user); { :profile_mode...
class AddressComponent include Mongoid::Document attr_reader :long_name, :short_name, :types def initialize hashkeys @long_name = hashkeys[:long_name] @short_name = hashkeys[:short_name] @types = hashkeys[:types] end end
class CapsuleCRM::User < CapsuleCRM::Base attr_accessor :username attr_accessor :name attr_accessor :currency attr_accessor :timezone attr_accessor :logged_in attr_accessor :party_id define_attribute_methods [:username, :name, :currency, :timezone, :logged_in, :party_id] def self.get_path '/api/...
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? rescue_from CanCan::AccessDenied do |excepti...
class AddSmColumnsToSmData < ActiveRecord::Migration def change add_column :sm_data, :movie_title, :string add_column :sm_data, :fb_page_name, :string add_column :sm_data, :fb_handle, :string add_column :sm_data, :twitter_handle, :string add_column :sm_data, :twitter_hashtag, :string add_colum...
class Admin::DashboardController < ApplicationController before_filter :authenticate_admin_user! layout "admin" def index if params[:id] @user=User.find(params[:id]) @user.update_attribute("role_id", params[:role]); end @unauthorized_users = User.where("role_id is NULL") @recent_l...
class Question < ActiveRecord::Base validates :title, null: false, length: {minimum: 1} validates :comment, null: false, length: {maximum: 200, minimum: 1} has_many :answer, dependent: :destroy end
require 'ostruct' module RSpecSystem # This class represents a result from a helper command class Result < OpenStruct # Returns the value of a member. def [](name) @table[name.to_sym] end end end
module Wunderlist class Client BASE_URL = "https://a.wunderlist.com/api/v1" attr_reader :client_id, :access_token def initialize(client_id, access_token) @client_id = client_id @access_token = access_token end def get(url, params = {}) make_request(:get, url, params) end ...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'kilomeasure/version' Gem::Specification.new do |spec| spec.name = 'kilomeasure' spec.version = Kilomeasure::VERSION spec.authors = ['Wegonauts'] spec.email = ...
class LikesController < ApplicationController # before_actionに「:authenticate_user」を追加してください before_action :authenticate_user # createアクションを追加してください def create @like = Like.new(user_id: @current_user.id, topic_id: params[:topic_id]) @like.save redirect_to("/topics/#{params[:topic_id]}") end ...
require File.dirname(__FILE__) + '/../test_helper' require 'visitors_controller' # Re-raise errors caught by the controller. class VisitorsController; def rescue_action(e) raise e end; end class VisitorsControllerTest < ActionController::TestCase # Be sure to include AuthenticatedTestHelper in test/test_helper.rb i...
class CreatePropertyListings < ActiveRecord::Migration def change create_table :property_listings do |t| t.integer :bhk t.string :address t.string :property_type t.integer :buildup_area t.integer :bathrooms t.string :furnish_type t.integer :rent t.integer :security_...
module ApplicationHelper # Returns the full title on a per-page basis. def full_title(page_title) base_title = "OneTeam" if page_title.empty? base_title else "#{base_title} | #{page_title}" end end def current_employee=(employee) @current_employee = employee end def curren...
class ApplicationController < ActionController::Base before_action :authenticate_user! def current_company @current_company ||= current_user.company end end
Help::Engine.routes.draw do root to: "help_wanteds#index" scope 'admin' do resources :help_offereds resources :help_wanteds end scope 'api' do scope '1' do resources :help_offereds, controller: 'api/v1/help_offereds' resources :help_wanteds, controller: 'api/v1/help_wanteds' end end end
require 'rails_helper' feature "user sees new notifications" do before(:each) do user = FactoryBot.create(:user) @notification_1 = user.notifications.create(message: "hello there!") @notification_2 = user.notifications.create(message: "goodbye!") sign_in user visit root_path end scenario...
# coding: utf-8 require 'date' $:.unshift File.dirname(__FILE__) require 'jyear' # # 日付関係 # class GovDate # # 西暦⇒和暦変換 # #date :: 西暦年月日 # #返り値:: 和暦年月日 def to_jdate(date) date.to_time.strftime("%K年%m月%d日") end # # 和暦⇒西暦変換 # #jdate :: 和暦年月日 # #返り値:: 西暦年月日 def to_date(jdate) Date.par...
module Sources class TheHackerNews extend CD::RssParser def self.parse get_feed('https://feeds.feedburner.com/TheHackersNews') do |xml| parse_feed(xml) do |item| { title: item.at('title').text, description: CGI.escape_html(item.at('description').text.strip), ...
require 'test_helper' class SproutsControllerTest < ActionDispatch::IntegrationTest setup do @sprout = sprouts(:one) end test "should get index" do get sprouts_url assert_response :success end test "should get new" do get new_sprout_url assert_response :success end test "should cre...
class Puppy def fetch(toy) puts "I brought back the #{toy}!" toy end def speak(num) counter = 0 while counter < num puts "woof" counter += 1 end end def roll_over puts "*Rolls over*" end def dog_years(human_yrs) human_yrs * 7 end def pee_itself puts "*We...
class Libraries::DownloadSoftwaresController < ApplicationController before_filter :authenticate_user!, :only => [:index, :new, :create, :edit, :update ] protect_from_forgery with: :null_session, :only => [:destroy, :delete] def index @soft = DownloadSoftware.where("type_of_cost_center LIKE '"+CostCenter.find...
class Round < ActiveRecord::Base belongs_to :competition has_many :matches end
# Fact: has_infiniband # # Purpose: Determine if the system's hardware supports InfiniBand. # # Resolution: # Returns true or false based on output from `lspci`. # # Caveats: # Currently only tested with Mellanox and Qlogic cards installed in a system. # require 'facter/util/infiniband' Facter.add(:has_infiniband...
# frozen_string_literal: true require_relative 'balance' class Account def transactions if ledger.empty? puts 'No transactions yet' else ledger.each do |transaction| puts "Amount: #{transaction.first}, Date: #{transaction[1]}, Type: #{transaction.last}" end end end def cur...
require 'httparty' require 'json' class Skyscanner BASE_URL_SKY_ROUTES = 'http://partners.api.skyscanner.net/apiservices/browseroutes/v1.0/' BASE_URL_SKY_QUOTES = 'http://partners.api.skyscanner.net/apiservices/browsequotes/v1.0/' BASE_URL_SKY_LOC = 'http://partners.api.skyscanner.net/apiservices/autosuggest/v1....
require 'compiler_helper' module Alf class Compiler describe Default, "quota" do subject{ compiler.call(expr) } let(:summarization){ Summarization[{ max: Aggregator.max{ qty } }] } let(:ordering){ Ordering.new([[:b, :asc]]) } shared_examples_fo...
class SpaceStatusValidationValidator < ActiveModel::Validator def validate(record) items = [record.equipment_info, record.basic_info, record.description, record.space_image, record.plan] unless items.all? {|item| item.present? } record.errors[:status] << "未入力の情報があります" end end end
# coding: utf-8 feature 'ゲストとして、Twitterでログインしたい' do def mock_hash { "provider" => "twitter", "uid" => 1234567, "info" => { "nickname" => 'test_user_twitter', "image" => '...test.png' } } end background do OmniAuth.config.test_mode = true OmniAuth.config....
class Task < ApplicationRecord validates :title, presence: true validates :done, inclusion: { in: [true, false] } belongs_to :tag, optional: true end
#!/usr/bin/env ruby require 'pry' require 'fileutils' require 'open-uri' require 'colorize' include FileUtils cmd = ARGV[0] project_name = ARGV[1] def make_project(project_name) # make app repo mkdir(project_name) # and do all the work there... cd(project_name) do # assets folders = %w( publi...
#!/usr/bin/env ruby1.9 -ryaml # encoding: UTF-8 # Lets YAML know that valid UTF-8 strings are not binary data. # This will get you a double-quoted string output, meaning all # non-ASCII characters will be escaped in \xDD format. # The good news is that double-quoted strings, when imported back # by ruby 1.9's YAML::lo...
module Sdc3 class Image < Struct.new(:url, :available, :dimensions, :x, :y) include Sdc3::StructHelper def initialize(tag) super return unless tag self.available = Sdc3.first_attr(tag, 'available') self.x = Sdc3.first_attr(tag, 'width') self.y = Sdc3.first_attr(ta...
class Signup < ActiveRecord::Base include PayPal::SDK::REST attr_protected def self.sept_fees {:participant => 375, :student => 30, :clergy => 175, :guest => 175, :dinner => 190} end def self.fees if Time.now.to_i < 1473048000 {:participant => 325, :student => 30, :clergy => 150, :guest => 150, :dinner =>...
require 'rails_helper' describe Tagging, type: :model do before :each do @post = FactoryGirl.create(:post) @tagging = @post.taggings.take end subject { @tagging } it { is_expected.to belong_to(:tag) } it { is_expected.to belong_to(:post) } describe "Class Methods" do context "#post_count(tag...
class ParticipantResponse < ActiveRecord::Base belongs_to :participant belongs_to :participant_survey has_and_belongs_to_many :multiple_choices, :class_name => 'SurveyQuestionChoice' belongs_to :single_choice, :class_name => 'SurveyQuestionChoice' belongs_to :question, :class_name => 'SurveyQuestion' valid...
class Country < ActiveRecord::Base #Countryインスタンスの人口が1000人以上だったら # manyを999人以下だったらfewを返す命令(method) def many_or_few if self .population > 1000 'many' else 'few' end end end
class Driver attr_reader :name @@all = [] def initialize(name) @name = name @@all << self end def passengers # passengers = [] # Ride.all.each do |ride| # passengers << ride.passenger if ride.driver == self # end # passengers ...
class User < ActiveRecord::Base has_many :articles has_secure_password attr_accessor :remember_token VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :score_in, presence: true, numericality: { greater_than_or_equal_to: 0 } validates :score_out, presence: true, numericality: { greater_than_or...
module UploadImageRetainLowQuality class S3 CONFIG_FILE = ".upload_image_retain_low_qualityrc" def initialize file = if FileTest.file?(CONFIG_FILE) CONFIG_FILE else [Dir.home, CONFIG_FILE].join("/") end raise "no aws config file" unles...
module RobotMaker def RobotMaker.create(x=0, y=0, direction="EAST", allowed_to_move=true) Class.new { define_method(:allowed_to_move?) { allowed_to_move } define_method(:x) { x } define_method(:y) { y } define_method(:direction) { direction } define_method(:enter_arena) { false } ...
require 'net/http' require 'guard' require 'guard/guard' require 'guard/watcher' module Guard # The Jasmine guard that gets notifications about the following # Guard events: `start`, `stop`, `reload`, `run_all` and `run_on_change`. # class Jasmine < Guard autoload :Inspector, 'guard/jasmine/inspector' ...
require 'rails_helper' feature 'Cloning sampled structures', :omniauth, :js do let!(:user) { create(:user) } let!(:audit) { create(:audit, user: user) } let!(:common_area_type) do create(:audit_strc_type, name: 'Common Area', parent_structure_type: audit.audit_structure.audit_strc_type)...
class DeleteArtistIdFromGenres < ActiveRecord::Migration[5.2] def change remove_column :genres, :artist_id end end
require 'oystercard' describe Oystercard do let(:station){ double :station } it 'should have a balance of 0' do expect(subject.balance).to eq(0) end it "should top up oystercard" do expect {subject.top_up(5)}.to change { subject.balance }.by(5) end it "should throw error if =>£90" do max_li...
class RemoveColumnsFromSongs < ActiveRecord::Migration[6.0] def change remove_column :songs, :spotify_url, :string remove_column :songs, :qq_url, :string remove_column :songs, :net_ease_url, :string end end
require 'r_package_extractor' class PackageRefinementJob @queue = :r_packages # Method to update Package ad Version with details from Description file of a package # It also creates an Author for the version, is it doesnt already have one # TODO: Separate into smaller methods # def self.perform(version_id...
# How does count treat the block's return value? How can we find out? ['ant', 'bat', 'caterpillar'].count do |str| str.length < 4 end # Per Ruby documentation for count with a block: issues a warning, ignores the block, and returns the count of elements eql? to obj. # => 2 # LS Explanation: # If a block is given, c...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable devise :omniauthable, omniauth_providers: [:facebook] ...
module Autogrid module Formatter class << self # TODO: make changeable! def boolean(view, value, options = {}) if options == :image return value ? view.image_tag('ui_check.png') : view.image_tag('ui_status_inactive.png') end if options == :inverse or options == ...
class Validator class << self def validate(schema_path, json_body) JSON::Validator.validate!( Rails.root.join("app/models/schemas/#{schema_path}.json").to_s, json_body ) rescue JSON::Schema::ValidationError => e message = e.message.gsub /did not match the regex.*/, "was i...
# encoding: utf-8 namespace :sections do desc "Import regions" task :import_regions => :environment do regions_json = JSON.parse(File.read(Rails.root.to_s + "/db/seeds/regions.json")) regions_json.each do |region_hash| id = region_hash.delete("id") region = Region.new(region_hash) region...
module AdminArea module CardRecommendations # Mark as 'expired' all recommendations which: # # a) were recommended to the user more than [setting] days ago # b) have not been interacted with by the user (clicked, declined, or # applied for) # c) are not already expired # # Users won...
class UsersController < ApplicationController include FinduserHelper before_action(:find_user, {only: [:edit, :index ,:update, :show, :destroy] }) def new @user = User.new render(:new) end def create @user = User.new(user_params) if @user.save session["user_id"]=@user.id red...
#! /usr/bin/env ruby # TODO # # 3. The ability to control output "select rhs.field lhs.field" # 4. More efficient disk storage systems (+my/sql/ite) # 5. Threading on disk reads # 6. ETAs and better output # # # Large CSV merging app. uses an index construction method to merge CSVs in excess of memory size requir...
class GroupsController < ApplicationController def index # query values limit = (params[:limit] || 20).to_i page = (params[:page] || 1).to_i groups = if params[:trending].present? Group.trending(current_user).page(page).per(limit).groups elsif params[:user_id].present? User.find(param...
class Photo < ActiveRecord::Base validates_presence_of :title, :content after_create :create_event before_destroy :destroy_event include TheComments::Commentable include Likeable belongs_to :user belongs_to :album belongs_to :blog belongs_to :novelty has_many :photo_sources, dependent: :dest...
class Auction < ActiveRecord::Base belongs_to :user has_many :bids, dependent: :destroy validates_presence_of :title validates :reserve_price, presence: true, numericality: {greater_than_or_equal_to: 1} default_scope order("created_at DESC") scope :published, -> { where(state: :published) } after_initial...
class EasyTimeEntryBaseQuery < EasyQuery def self.permission_view_entities :view_time_entries end def query_after_initialize super self.sort_criteria = {'0'=>['spent_on', 'asc']} if self.sort_criteria.blank? self.display_project_column_if_project_missing = false end def available_filters ...
class RemoveAncestryDetailsFromTasks < ActiveRecord::Migration def change remove_column :tasks, :ancestry_depth, :integer, :default => 0 remove_index :tasks, :ancestry remove_column :tasks, :ancestry, :string end end
class FormSubjectsController < ApplicationController before_filter :check_autentication, only: [:edit, :update, :destroy] layout "page" # GET /form_subjects # GET /form_subjects.json def index @form_subjects = FormSubject.all respond_to do |format| format.html # index.html.erb f...
class User < ActiveRecord::Base ROLES = %w(non_member member admin) validates :username, :kind, presence: true has_many :posts, dependent: :destroy def admin? ROLES[kind] == 'admin' end def member? ROLES[kind] == 'member' end def non_member? ROLES[kind] == 'non_member' end def self.authentication...
class CreateJobs < ActiveRecord::Migration def change create_table :jobs do |t| t.string :title t.string :company_name t.integer :occupation, default: 0 t.integer :job_type, default: 0 t.string :location t.string :url t.text :description t.text :apply_information ...
When /^I confirm my email$/ do get "/confirmation?token=#{@user.perishable_token}" assert_response :redirect assert_redirected_to dashboard_url follow_redirect! end Then /^a new user with the email "(.*)" should be created$/ do |email| @user = User.find_by_email(email) assert_not_nil @user end Then /^the ...
module Locomotive module Liquid module Tags # Carousel a collection # Carousel is like a paginate, but it includes all pages for client-side switching # Usage: # # {% carousel contents.projects by 5 %} # #myCarousel.carousel.slide # {{ carousel.prev_link }} ...
module MyServiceName module Helpers module Authenticator NoApiKeysConfigured = Class.new(StandardError) def self.call(auth_keys:, submitted_key:) if auth_keys.nil? || auth_keys.empty? raise NoApiKeysConfigured, 'Please configure API_KEYS environment variable (see the README.md).' ...
require 'test_helper' class EventsControllerTest < ActionController::TestCase # Replace this with your real tests. context "cities action" do should "return subcategories of some place" do @ev = Place.make :title => 'xxx' @child = Place.make :parent_id => @ev.id, :title => 'asdf' get :cities...
require 'spec_helper' describe MoviesController do before(:all) do 10.times do |n| FactoryGirl.create(:movie) end end it "should display a list of the latest movies as the default" do get :index, :page => 1 expect(assigns(:movies)).to eq(Movie.latest.page(1).per(10)) end it "...
class AddItemToProfiles < ActiveRecord::Migration[6.0] def change add_column :profiles, :gender, :integer add_column :profiles, :age, :integer end end
# class Rdf::Owl::RestrictionsController < ApplicationController # include Cms::BaseFilter # include Cms::CrudFilter # # model Rdf::Owl::Restriction # # navi_view "cms/main/navi" # # before_action :set_class # # private # def set_vocab # return if @vocab.present? # @vocab = Rdf::Vocab.site(@...
describe Movies::UseCases::Index do let(:params) { {} } let(:call_class) { described_class.new(params: params).call } before do create_list(:movie, 10) end it 'returns 5 records' do params[:offset] = 0 params[:limit] = 5 expect(call_class.count).to eq(5) end it 'returns all records' do ...
# frozen_string_literal: true module Api # Base Api Controller class BaseController < ActionController::Base protect_from_forgery with: :null_session include JSONAPI::Deserialization include Knock::Authenticable def render_json(serializer_instance) render json: serializer_instance.serializa...
class ApplicationMailer < ActionMailer::Base default from: "noreply.esv@gmail.com" layout "mailer" end
class Trailer < ActiveRecord::Base def self.released where('release_date <= ?', Date.today.year).order('release_date desc') end end
class SetMemberNicknameDefaultToBlank < ActiveRecord::Migration def change change_column :members, :namenick, :string, :default => "" end end
class DiseasesController < ApplicationController layout 'internal' before_action :authenticate_user! before_action :block_crossprofile_access before_action :recover_profile def index @diseases = @profile.diseases end def new end def edit @disease = D...
module WebEx module Events class EventSummaryRequest WEBEX_EMPTY_RESULTS_EXCEPTION_ID = "000015" attr_accessor :start_date, :end_date def initialize(options = {}) @start_date, @end_date = options[:start_date], options[:end_date] end def find_events! eve...
require 'test_helper' require 'exchange_rates_api_service' require 'validation_helper' class ExchangeRateApiServiceTest < ActiveSupport::TestCase def setup @api = ExchangeRatesApiService.new end test "raise error on base length != 3" do check_for_error "US" end test "raise error on base lower case"...
class Picture < ApplicationRecord belongs_to :user has_many :favorites, dependent: :destroy has_many :favorite_users, through: :favorites, source: :user mount_uploader :image, PictureImageUploader attr_accessor :action_required validates :image_or_content, presence: true private def image_or_content ...