text
stringlengths
10
2.61M
require 'rails_helper' RSpec.feature "User edits an existing song" do scenario "they see the updated data for the song and a link to the artist page" do artist = create(:artist) song = create(:song) updated_title = "Three Little Birds" visit song_path(song) click_on "Edit" fill_in "song_titl...
module Adminpanel class User < ActiveRecord::Base include Adminpanel::Base has_secure_password belongs_to :role, touch: true default_scope do includes(:role) end #role validation validates_presence_of :role_id #name validations validates_presence_of :name validates_len...
class AddHintToQuestions < ActiveRecord::Migration def change add_column :notequestions, :hint, :string add_column :notequestions, :solution_explain, :string end end
module Dry module System module Plugins # @api public module Decorate # @api public def decorate(key, decorator:) original = _container.delete(key.to_s) if original.is_a?(Dry::Container::Item) && original.options[:call] && decorator.is_a?(Class) registe...
require 'dockerspec' require 'dockerspec/serverspec' describe docker_build('.', tag: 'zuazo/irssi-tor') do let(:home) { '/home/irssi' } it do should have_entrypoint( '/usr/bin/proxychains_wrapper -u irssi /usr/bin/irssi' ) end it { should have_env 'IRSSI_HOME' => home } it { should have_env 'I...
require 'test_helper' class ApicastV1DeploymentServiceTest < ActiveSupport::TestCase class_attribute :rolling_updates self.rolling_updates = false def setup Logic::RollingUpdates.stubs(skipped?: !rolling_updates) @provider = FactoryBot.create(:provider_account) @provider.proxies.update_all(apicast...
json.meta do json.total @order_set_items.total_count json.current_page page json.per_page per_page end json.urls do if @order_set_items.total_count > (page * per_page) json.next url_for(params: {page: page + 1}) end if page > 1 json.prev url_for(params: {page: page - 1}) end end json.data do j...
class UsersController < ApplicationController require 'date' before_action :authenticate_user!, except: [:new, :create, :forgot_password, :send_email, :password_reset] before_action :find_restrictions, only: [:preferences, :delete_restriction] def new @user = User.new end def create @user = Us...
class AddImageToArticleComments < ActiveRecord::Migration def change add_column :article_comments, :image, :string end end
require_relative 'logger/logfile' require_relative 'file_operations' require_relative 'network_activity' require_relative 'os_finder' require_relative 'process_runner' module EDRTest class Tester def initialize @logfile = EDRTest::Logger::Logfile.new @curr_os = OSFinder.set_os end def execu...
class RuleEngine def next_states_by_neighbour result = {} result.default = :dead (2..3).inject(result) do |memo, num| memo[num] = :alive memo end end def next_state_for_cell_with(property) next_states_by_neighbour[property[:neighbours]] end end class Cell attr_reader...
#this example demonstrates the use of until loop and until modifier loop #syntax of until loop =begin until condition do body of loop will be executed until the condition is false end =end #syntax of until-modifier loop =begin begin loop body will be executed until condition is false end until condition =end ...
class Teacher < ActiveRecord::Base validates :name, uniqueness: true validates :email, uniqueness: true has_many :students end
class ChangeStringForSubscriptionIdToUsers < ActiveRecord::Migration def self.up change_column :users, :subscription_id, :string end def self.down change_column :users, :subscription_id, :integer end end
ActiveAdmin.register ViewHistory do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters # # permit_params :list, :of, :attributes, :on, :model # # or # # permit_params do # permitted = [:permitted, :attribute...
class Array def self.warp(*args) return 'Warp drive is not available yet. Did you mean Array.wrap?' end def sort_with_nil(nil_on_start=true) sort{|a, b| a && b ? a <=> b : (a ? (nil_on_start ? 1 : -1) : (nil_on_start ? -1 : 1))} end def sort_by_with_nil(default, &block) raise ArgumentError, 'Th...
class AnswerQuestion < ActiveRecord::Migration[5.1] def change add_reference :answers, :question end end
require 'rails/generators' module Twirp class RspecGenerator < Rails::Generators::Base desc 'Install twirp rspec helpers into rails_helper.rb' def inject_rspec_helper in_root do unless File.exist?('spec/rails_helper.rb') log :inject_rspec, 'spec/rails_helper.rb is not found' ...
class ChangeNullsThesaurus < ActiveRecord::Migration[5.0] def change change_column_null :thesaurus, :name, false change_column_null :thesaurus, :cvalue, false change_column_null :thesaurus, :f, false change_column_default :thesaurus, :f, true end end
require "spec_helper" describe Gpdb::InstanceOwnership do let!(:old_owner) { gpdb_instance.owner } let!(:owner_account) { FactoryGirl.create(:instance_account, :gpdb_instance => gpdb_instance, :owner => old_owner) } let!(:new_owner) { FactoryGirl.create(:user) } describe ".change_owner(instance, new_owner)" d...
# Encoding: utf-8 require 'spec_helper' require 'component_helper' require 'java_buildpack/container/jboss' describe JavaBuildpack::Container::Jboss do include_context 'component_helper' it 'detects WEB-INF', app_fixture: 'container_tomcat' do expect(component.detect).to include("jboss=#{version}") e...
class Player < ActiveRecord::Base has_many :games has_many :scores, through: :games validates :name, presence: true validates :hand, inclusion: { in: %w(left right), message: "%{value} is not a valid hand" } validates :grade, numericality: { greater_than_or_equal_to: 0, ...
require 'test_helper' class GithubAction::AssignPrLabelTest < ActiveSupport::TestCase def test_actionable_events_constant assert_equal GithubAction::AssignPrLabel::ACTIONABLE_EVENTS, ['pull_request'] end def test_labels_to_assign_constant assert_equal GithubAction::AssignPrLabel::LABELS_TO_ASSIGN, ['Se...
class ModifyColumnsUsers < ActiveRecord::Migration def change change_table :users do |t| t.column :force_change_password, "ENUM('Y','N')" end end end
# == Schema Information # # Table name: polls # # id :integer not null, primary key # name :string(255) # hidden_vote :boolean # user_id :integer # created_at :datetime # updated_at :datetime # finished_at :datetime # class Poll < ActiveRecord::Base attr_accessible :name, :hidden...
class ChangeDateToDatetimeInRides < ActiveRecord::Migration def self.up change_column :rides, :date, :datetime end def self.down change_column :rides, :date, :date end end
# frozen_string_literal: true require 'rspec_sonarqube_formatter' RSpec.describe RspecSonarqubeFormatter, type: :helper do before :each do @output = StringIO.new @formatter = RspecSonarqubeFormatter.new(@output) @example = RSpec::Core::ExampleGroup.describe.example_group 'anonymous group', :exclude ...
class Api::V1::MoviesController < ApplicationController def index @movies = Movie.all render json: @movies, status: :ok end def show @movie = Movie.find(params[:id]) render json: @movie, status: :ok end def review review = Review.create({ content: params[:content], user: Use...
# frozen_string_literal: true require "net/http" class HttpClient def self.construct_url(base_url, params) parsed_url = URI.parse(base_url) new_params = params.map { |key, value| "#{key}=#{value}" } parsed_url.query = new_params.unshift(parsed_url.query).compact.join("&") parsed_url.to_s rescue UR...
module Confirmable extend ActiveSupport::Concern included do # validation validates :name, presence: true validates :email, presence: true validates :memo, presence: true # new -> confirm validates :submitted, acceptance: true # confirm -> create validates :confirmed, acceptance: t...
# Conway's Game of Life # Supported types: [:block, :toad, :blinker, :random] # class GameOfLife @@x = 6; @@y = 6; @@oscillator_count = 50 attr_accessor :type # # initialize # def initialize end # # oscillate # def oscillate construct_array_with_default_live_cells next_array = @star...
class DeleteAwsVault < AwsRequest def call begin glacier.delete_vault(account_id: '-', vault_name: vault.name) vault.destroy rescue Aws::Glacier::Errors::ServiceError => e log_aws_error(e) add_aws_error(e) end end private attr_reader :vault_id def post_initialize_hook(a...
require 'spec_helper' RSpec.describe Smite::Client do let(:dev_id) { 1234 } let(:auth_key) { 'ABCD' } describe '#initialize' do it 'accepts only valid languages' do [1,2,3,7,9,10,11,12,13].each do |lang| client = described_class.new(dev_id, auth_key, lang) expect(client.lang).to eq(l...
require_relative '../../../gilded_rose' require_relative '../../../lib/vault/item_behavior' describe Vault::ItemBehavior do subject { described_class.new(item) } describe '#new' do before(:each) do subject end context 'when item quality starts bigger than MAX_QUALITY' do let(:item) { Item...
require 'rails_helper' RSpec.describe OrderV1API, type: :request do describe "查询小C的订单详情" do before(:all) do @zhengzhou_userinfo = FactoryGirl.create(:userinfo, {:province => '河南省', :city => '郑州市'}) end after(:all) do @zhengzhou_userinfo.destroy end it "除退款成功外的情况" do #发送一个查找请求 ...
def bombard(row, col, m) bomb = m[row][col] damage = 0 (-1..1).each do |row_offset| (-1..1).each do |col_offset| is_the_same_cell = row_offset.zero? && col_offset.zero? target = { row: row + row_offset, col: col + col_offset } next unless !is_the_same_cell && in_range(target[:row], target[...
# frozen_string_literal: true COMPLEMENT = lambda do |predicate| lambda do |args| !predicate.call(args) end end
class RtReviewLoader def self.load(id) new(id).load end def self.enqueue(id) RtReviewLoadWorker.perform_async(id) end attr_reader :movie def initialize(id) @movie = Movie.find(id) end def load return unless movie.rt_api_review_link response = Typhoeus::Request.new( "#{movie...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable,:omniauthable, :omniauth_providers => [:facebook] ...
# frozen_string_literal: true require 'stannum/constraints/uuid' require 'support/examples/constraint_examples' RSpec.describe Stannum::Constraints::Uuid do include Spec::Support::Examples::ConstraintExamples subject(:constraint) do described_class.new(**constructor_options) end let(:constructor_option...
class Item < ActiveRecord::Base belongs_to :repair_order has_many :uploads has_many :text_uploads end
require 'faraday' require_relative 'error' require_relative 'version' Dir[File.expand_path('../resources/*.rb', __FILE__)].each { |f| require f } module Closeio class Client include Closeio::Client::Activity include Closeio::Client::BulkAction include Closeio::Client::Contact include Closeio::Client...
require "application_system_test_case" class ConscesionariaTest < ApplicationSystemTestCase setup do @conscesionarium = conscesionaria(:one) end test "visiting the index" do visit conscesionaria_url assert_selector "h1", text: "Conscesionaria" end test "creating a Conscesionarium" do visit ...
# frozen_string_literal: true require 'spec_helper' require 'timecop' RSpec.describe 'RailsAdmin::Adapters::ActiveRecord::Property', active_record: true do describe 'string field' do subject { RailsAdmin::AbstractModel.new('Player').properties.detect { |f| f.name == :name } } it 'returns correct values' do...
class CheckItemResult < ActiveRecord::Base belongs_to :user belongs_to :check_item belongs_to :survey validates_presence_of :user validates_presence_of :survey validates_presence_of :check_item before_validation(on: :create) do self.user_id = survey.user_id unless survey.blank? end end
class AddDateColumnsToMoney < ActiveRecord::Migration def self.up [:easy_money_expected_expenses, :easy_money_expected_revenues, :easy_money_other_expenses, :easy_money_other_revenues].each do |tbl| add_column(tbl, :tyear, :integer, {:null => true}) unless column_exists?(tbl, :tyear) add_column(tbl,...
class ChangeDetailsFromStringToTextInEscapes < ActiveRecord::Migration def self.up change_column :escapes, :details, :text end def self.down change_column :escapes, :details, :string end end
module Noizee module_function CONFIG_PATH = "#{ENV['HOME']}/.noizee" def make_some_noise *args require 'fileutils' FileUtils.touch Noizee::CONFIG_PATH require_relative 'noizee/gestalt' gestalt = Noizee::Gestalt.new require_relative 'noizee/internal' Noizee::Internal.event "Noizee initial...
## # NilClass ISO Test assert('NilClass', '15.2.4') do NilClass.class == Class end assert('NilClass#&', '15.2.4.3.1') do not NilClass.new.& and not NilClass.new.&(nil) end assert('NilClass#^', '15.2.4.3.2') do NilClass.new.^(true) and not NilClass.new.^(false) end assert('NilClass#|', '15.2.4.3.3') do NilCl...
class AddColumnAge < ActiveRecord::Migration[6.0] def change add_column :trainers, :age, :integer, default: 18 end end
class ProductPhoto < ApplicationRecord validates :product, presence: true belongs_to :product, inverse_of: :product_photos has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: "default_photo.png" validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/ end
class ContentType < ActiveRecord::Base #Added by Jan Uhlar ZPRAVA = 1 SLOUPEK = 2 KOMENTAR = 3 GLOSA = 4 ANALYZA = 5 ESEJ = 6 RECENZE = 7 KRITIKA = 8 REPORTAZ = 9 DOKUMENT = 10 ROZHOVOR = 11 FEJETON = 12 ZIVE = 13 TIP = 14 VZPOMINKA = 15 VYPRAVENI = 16 POLEMIKA ...
class GamesController < ApplicationController before_action :authenticate_user! before_action :load_user before_action :verify_user before_action :load_game before_action :verify_game def show @matches = @game.matches @title = @game.name end private def load_game @game = current_user....
# frozen_string_literal: true require 'spec/spec_helper' require 'lib/expander' RSpec.describe Expander do describe '#call' do context 'when expanding minutes' do subject(:expand_minutes) { described_class.new(format).call.fetch(:minutes) } context 'when every minute' do let(:format) { '* ...
class ChangeArrivalTime < ActiveRecord::Migration[5.2] def change change_column :session_councilmen, :arrival, :time, default: '00:00:00' # Ex:- change_column("admin_users", "email", :string, :limit =>25) end end
class OfferController < ApplicationController def initialize super @var = OfferDecorator.new @var.link = { I18n.t("cmn_sentence.listTitle", model:Offer.model_name.human)=>{controller:"offer", action:"index"}, I18n.t("cmn_sentence.newTitle", model:Engineer.model_name.human)=>{controller:"offer", action:"ne...
class ThomasController < ApplicationController before_action :set_thoma, only: %i[ show edit update destroy ] # GET /thomas or /thomas.json def index @thomas = Thoma.all end # GET /thomas/1 or /thomas/1.json def show end # GET /thomas/new def new @thoma = Thoma.new end # GET /thomas/1/...
module StoreDemo class PricingRule @@rules ||= {} def initialize(name, conditional, affect, product_code) @@rules[name] = {conditional: conditional, affect: affect, product_code: product_code} end def self.get_totals(co_rules, co_items) price_list = [] co_rules.each do |rule| ...
class ListsController < ApplicationController before_action :is_authenticated? before_action :get_list, except: [ :index, :new, :create ] def new @list = List.new end def create @list = List.new ( list_params ) if @list.save redirect_to lists_url ( @list ) else flash.now[:alert]...
require 'spec_helper' describe Flatrack::View::TagHelper do include Flatrack::FixtureHelper describe '#html_tag' do let(:expected){ render_template 'html_tag.html' } context 'using haml' do it 'should properly render' do template_content = render_template 'html_tag.html.haml' expect...
class Position < ActiveRecord::Base include Coded serialize :reaches # Starting position may change depending on the situation, for now though # we'll always leave it as "Standing Apart" def self.starting_position lookup('standing_apart') end # Not sure if we're going to need this support class or...
class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_cache_buster # Method to prevent browser caching def set_cache_buster response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" response.headers["Pragma"] = "no-cache" respo...
class Medium < ActiveRecord::Base validates :name, length: { minimum: 1 } has_many :artworks, inverse_of: :medium, dependent: :destroy end
class CreateTheLevelUps < ActiveRecord::Migration def change create_table :the_level_ups do |t| t.integer :app_id t.string :api_key t.string :client_secret t.string :app_access_token t.timestamps end end end
module Api module V1 class GallerySerializer < Api::V1::BaseSerializer attributes :id, :title belongs_to :user end end end
class AddReferralToVillageItems < ActiveRecord::Migration def change add_column :village_items, :referral_id, :integer add_column :village_items, :owner_id, :integer end end
require "spec_helper" describe ContasController do describe "routing" do it "routes to #index" do get("/contas").should route_to("contas#index") end it "routes to #new" do get("/contas/new").should route_to("contas#new") end it "routes to #show" do get("/contas/1").should rou...
class DropNotifications < ActiveRecord::Migration[5.0] def change drop_table :notifications remove_column :accounts, :unseen_notifications_count, :integer, default: 0, null: false end end
require 'rails_helper' RSpec.describe Status, type: :model do subject { create :status } context 'with right parameters' do it 'creates a status' do expect(subject.status).to eq(Status.last.status) end end context 'with wrong parameters' do it "can't have the same status" do same_stat...
#!/usr/bin/env ruby require 'bibtex' require 'citeproc' require 'csl/styles' require 'optparse' require 'set' require 'sqlite3' usage = """Usage: bibtex-to-sqlite [--style=CSL-STYLE] [--separator=SEPARATOR] [--name=DB-NAME] file.bib [sql-query]""" options={:style => 'gost-r-7-0-5-2008', :separator => '|'} OptionParse...
require 'spec_helper' describe 'EmployeeIntegration', :type => :feature do it 'sign up employee' do visit '/' expect(page).to have_content 'Welcome to Textile.Co' click_link 'Sign up' current_path.should == '/employees/sign_up' expect(page).to have_content 'Sign up' fill_in :employee_name, :...
# Implement your object-oriented solution here! class Prime def initialize(num) @num = num end def is_prime?(i) !(2..(i**0.5)).any? {|d| i % d == 0} end def number i = 3 arr = [2] until arr.size == @num arr << i if is_prime?(i) ...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable, :timeoutable#, :omniau...
class Record < ActiveRecord::Base belongs_to :user belongs_to :project validates :user_id, presence: true validates :project_id, presence: true, :uniqueness => {:scope => [:user_id, :date]} validates :date, presence: true end
class AddRefCustomerAndOwnerToQuotationRequests < ActiveRecord::Migration[6.0] def change add_reference :quotation_requests, :customer, foreign_key: true add_reference :quotation_requests, :store_owner, foreign_key: true end end
class MoviesController < ApplicationController $count = 0 def show id = params[:id] # retrieve movie ID from URI route @movie = Movie.find(id) # look up movie by unique ID # will render app/views/movies/show.<extension> by default end def index if ($count == 0) session.clear $cou...
module Admin::TemplatesHelper def templates_scripts <<-JS var template_parts_index = 0; var template_part_partial = new Template(#{blank_template_part}); function new_template_part(){ var parts = $('parts'); if(parts.down('.template_part')){ var id = parts.select('.t...
class User < ApplicationRecord REGEX_USERNAME = /\w+/ has_many :messages validates :username, presence: true, uniqueness: { case_sensitive: false }, format: { with: /\A#{REGEX_USERNAME}\z/i }, length: { minimum: 3, maximum: ...
class CreateUnclaimedCommissions < ActiveRecord::Migration def change create_table :unclaimed_commissions do |t| t.references :user, index: true, foreign_key: true t.string :order_num t.integer :rakuten_commission t.integer :system_improvement_fee t.integer :tax t.boolean :dest...
class Caterer < ActiveRecord::Base has_many :CatererDates, dependent: :destroy belongs_to :Vendor end
class CreateSurveys < ActiveRecord::Migration def change create_table :surveys do |t| t.string :name t.references :survey_type t.integer :scale_weightage t.text :merit_weightage t.references :political_party t.string :survey_scale t.timestamps end add_index :surv...
class FixHealthRatingStandardColumns < ActiveRecord::Migration[5.2] def up remove_column :health_rating_standards, :float remove_column :health_rating_standards, :weight add_column :health_rating_standards, :weight, :float, default: 0, null: false end end
# encoding: UTF-8 require_relative "../initialize.rb" class Google def initialize(_city, _type) @type =_type @city = _city @con = Connector.makeConnect(DBConfig::HOSTNAME, DBConfig::DB_USER, DBConfig::DB_PASS, DBConfig::DB_NAME) @source = "google"+_type @linkTable = "#{@city}_#{@source}_link" ...
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu/trusty64" config.vm.provider "virtualbox" do |v| v.memory = 1024 end config.vm.provision "shell", path: "vagrant/locale.sh", privileged: false config.vm...
class FriendshipsController < ApplicationController def create friend = User.find_by(email: friend_params[:email]) if friend.present? if current_user.friends_emails.include?(friend.email) || friend.email == current_user.email flash[:error] = "Unable to Add User" else new_friend = F...
require 'rails_helper' RSpec.describe Product, type: :model do subject { Product.new(name: "Socks", price_cents: 1000, quantity: 10, category_id: 1) } describe 'Validations' do context "adding a new product" do it "is valid if all field are present" do expect(subject).to be_valid end ...
class RoomsController < ApplicationController before_action :authenticate_user! def index @rooms = Room.all end def show @room = Room.find(params[:id]) @room_message = RoomMessage.new room: @room @room_messages = @room.room_messages.includes(:user) end def new @room = Room.new end ...
require_relative 'player_big' class PlayerSprite < Sprite attr_accessor :animation def initialize(x, y, image = nil) image = Image.load("images/tamachang_big.png") image.set_color_key([255,255,255]) super self.angle = 0 @cell_x = x % self.image.width @cell_y = y % self.image.hei...
module Rets module Metadata class RetsClass attr_accessor :tables attr_accessor :name attr_accessor :visible_name attr_accessor :description attr_accessor :resource def initialize(rets_class_fragment, resource) self.resource = resource self.tables = [] ...
class AddColumnsToDivision < ActiveRecord::Migration def change add_column :divisions, :url, :string, default: '' add_column :divisions, :reference, :integer end end
class FixReviews < ActiveRecord::Migration[5.0] def change remove_foreign_key(:specialists, :reviews) remove_column(:specialists, :review_id, :integer, {:index=>true}) add_reference :reviews, :specialist, foreign_key: true, index: true end end
# frozen_string_literal: true class PersonSerializer < BaseSerializer attributes :id, :first_name, :last_name, :full_name, :gender, :current_age, :city, :state_code, :country_code %i[phone email birthdate].each { |att| attribute att, if: :show_personal_info? } link(:self) { api_v1_person_path(object) } has_m...
class Account < ActiveRecord::Base attr_accessible :name belongs_to :user has_many :projects, :dependent => :destroy validates_uniqueness_of :name end
class SubstancesPrintView < Dry::View::Controller configure do |config| config.paths = ["#{App.root}/app/templates"] config.layout = "print" config.template = "substances_print" end expose :results end
#!/usr/bin/env ruby VERSION_NOTE = %(\ 金魚草 v2.1.0 Copyright 2020, Rew Howe https://github.com/rewhowe/snapdragon ).freeze require_relative 'src/errors' require_relative 'src/interpreter/errors' require_relative 'src/interpreter/processor' require_relative 'src/tokenizer/errors' require_relative 'src/tokenizer/re...
class Users::FavouritesController < ApplicationController before_action :authenticate_user! load_and_authorize_resource before_action :set_user before_action :set_favourite, except: :index def index @favourites = @user.favourites.positioned.page params[:page] end def destroy @favourite.destroy...
garage_inventory = [] garage_inventory << {:name => 'computer', :price => '100.00', :quantity => 1} garage_inventory << {:name => 'book', :price => '3.50', :quantity => 5} # Using the array, print out a list of each item with their price and quantity available using each. garage_inventory.each do |item| item.each do ...
class PathBuilder def initialize(args) args.each_pair do |k,v| instance_variable_set "@#{k}", v end end def build_list_page File.join @host, "dashboard/project/list/all/#{@project}" end def expand relative_build_log_uri File.join @host, relative_build_log_uri end...
class Review < ActiveRecord::Base has_ancestry belongs_to :app, :counter_cache => true belongs_to :reviewer, :class_name => "User" attr_accessible :body, :parent_id default_scope { order("upvotes_count DESC") } has_many :upvotes, :as => :upvotable # return a string of how long ago this review w...
MESSAGES = { "welcome" => { "en" => "Welcome to Calculator! Enter your name:" }, "hello" => { "en" => "Hello" }, "enter_num1" => { "en" => "What's the first number?" }, "enter_num2" => { "en" => "What's the second number?" }, "invalid_name" => { "en" => "Make sure to use a valid na...