text
stringlengths
10
2.61M
module Jaguar class Server def initialize(server_proxy, **options) @options = options @reactor = Reactor.supervise(as: :reactor, args: [server_proxy, options]) end def run(&action) Celluloid::Actor[:reactor].async(:run, action) end def num_connections Celluloid::Actor[:r...
require 'undies' require 'stringio' module Xmlss class Writer class Markup; end # Xmlss uses Undies to stream its xml markup # The Undies writer is responsible for driving the Undies API to generate # the xmlss xml markup for the workbook. # Because order doesn't matter when defining style and ...
# 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 rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class EmailsController < ApplicationController layout 'email' load_and_authorize_resource :except => [:create] def index @emails = Email.all respond_to do |format| format.html # index.html.erb format.json { render json: @emails } end end def create @email = Email.new(params[:em...
ONE_WEEK_IN_SECONDS = 7 * 86_400 VOTE_SCORE = 432 KEY_GLOBS = ['article:*', 'voted:*', 'score:*', 'time:*', 'group:*'] def cleanup(conn) keys = KEY_GLOBS.flat_map { |k| conn.keys(k) } conn.multi do |multi| keys.each { |k| multi.del k } end end def post_article(conn, user, title, expires_in: ONE_WEEK_IN_SEC...
class MembershipsController < ApplicationController before_action :set_agent before_action :check_user_rights def index render partial: 'index', locals: { agent: @agent } end def new render partial: 'new', locals: { errors: [], users: "" } end def create memberships_creator = MembershipsCre...
require 'rails_helper' feature 'my home page' do scenario 'hello world message' do visit('/') expect(page).to have_content("Hello World!") end end
class Tag < ApplicationRecord has_many :taggossips has_many :gossips, through: :taggossips end
ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'minitest/reporters' require 'capybara/rails' require 'database_cleaner' Minitest::Reporters.use! class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alp...
Rails.application.routes.draw do root 'recipes#index' # resources :recipes, only: [:show] get "/recipes", to: "recipes#show" end
# frozen_string_literal: true class CreateResourceConnectionAuthors < ActiveRecord::Migration[6.0] def change create_table :resource_connection_authors, id: :uuid do |t| t.belongs_to :resource, null: false, foreign_key: { on_delete: :cascade }, type: :uuid t.belongs_to :author, null: false, foreign_k...
require('minitest/autorun') require('minitest/rg') require_relative('../room') require_relative('../song') require_relative('../guest') class TestRoom < MiniTest::Test def setup @room = Room.new("Jazz") @song = Song.new("The only way is up") @song2 = Song.new("Hips don't lie") @playlist = ["Hips d...
require 'test_helper' class PersonEmailsControllerTest < ActionDispatch::IntegrationTest setup do @person_email = person_emails(:one) end test "should get index" do get person_emails_url assert_response :success end test "should get new" do get new_person_email_url assert_response :succ...
class TransactionsController < ApplicationController def index @transactions = user_transactions.all end def show @transaction = find_transaction end def new @transaction = Transaction.new(date: Date.today) end def edit @transaction = find_transaction end def create @transacti...
class AddPrimaryReferencesToContacts < ActiveRecord::Migration[6.0] def change add_reference :contacts, :primary_address, null: true, foreign_key: { to_table: :addresses } add_reference :contacts, :primary_phone, null: true, foreign_key: { to_table: :phones } add_reference :contacts, :primary_email, null:...
def line(array) line_string = "The line is currently:" if array.length < 1 puts "The line is currently empty." else array.each_with_index do |name, number| line_string << " #{number + 1}. #{name}" end puts line_string end end def take_a_number(array, name) array << "#{name}" puts "W...
require 'account' require 'transaction' require 'statement' require 'transaction_history' describe 'Printing Statement' do let(:account) { Account.new } it 'prints the correct statement' do account.deposit(1000, '10-01-2012') account.deposit(2000, '13-01-2012') account.withdraw(500, '14-01-2012') a...
require "logger" require "require_all" require_all "lib" logger = Logger.new($stdout) task :safe_restart, :environment do |_, args| unless %w[staging production].include?(args["environment"]) abort 'An environment of "staging" or "production" must be specified' end environment = args.fetch(:environment) ...
require 'test_helper' class CoinControllerTest < ActiveSupport::TestCase include Coin def setup @email = 'hoge@email.com' @to = User.new(name: 'hoge', nickname: 'hogechan', email: @email, password: 'hogefuga') @to.save @email2 = 'hogehoge@e...
require 'fernet' Fernet::Configuration.run do |config| config.enforce_ttl = false end module AttrSecure class Secure attr_reader :secret def initialize(secret) self.secret = secret end def secret=(val) @secret = if val.is_a? Array val else ...
module ModelsHelper def model_class(type) Object.const_get(type.to_s.classify) end def build_without_trait(model, ancestr = nil, trait = nil) params = [trait, ancestr].select { |e| !!(e) } # byebug params.empty? ? FactoryBot.build(model) : FactoryBot.build(model, *params) end def build_db_ob...
class HardWorker include Sidekiq::Worker def perform puts "I'm a hard worker" end end
require "forwardable" module GemBench class Team EXCLUDE = [ 'bundler','gem_bench','i18n-airbrake','devise-async','km','vestal_versions','omniauth-facebook', 'flag_shih_tzu','pry-remote','koala','simple_form','thumbs_up','memoist','cancan','friendly_id', 'faker'] # A comment p...
class Person attr_accessor :name, :age def initialize(name, age) @name = name @age = age end def greet "My name is #{@name}. I am #{@age} years old." end end p1 = Person.new("Bob", 42) puts p1.greet
module Ai class Cache def initialize @col = Mongo::Connection.new(MongoConfig[:host], MongoConfig[:port]) .db(MongoConfig[:db]).collection(MongoConfig[:col]) end def [] key data = @col.find_one _id: key return nil if data.nil? [data['value'], data['choice'], data['depth']] end def []= key, ...
# == Schema Information # Schema version: 20110316100624 # # Table name: access_grants # # id :integer not null, primary key # code :string(255) # access_token :string(255) # refresh_token :string(255) # access_token_expires_at :datetime # user_...
module QBIntegration module Helper def lookup_value!(hash, key, ignore_case = false, default = nil) hash = Hash[hash.map{|k,v| [k.downcase,v]}] if ignore_case if default value = hash.fetch(key, default) else value = hash[key] end raise LookupValueNotFoundException.n...
FactoryGirl.define do factory :user do email "test@example" name "Kevin Curtin" nickname "kevin" end end
Pod::Spec.new do |s| s.name = 'PermissionKit' s.version = '1.5.1' s.summary = 'An elegant permission manager written in swift' s.homepage = 'https://github.com/lixiang1994/PermissionKit' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'LEE' => '18611401994@163.com' }...
class User < ApplicationRecord has_many :games has_many :scenarios, through: :games validates :user_id, :presence => true, :uniqueness => {:case_sensitive => true} end
require 'test/unit' require 'xsd/codegen/classdef' module XSD; module CodeGen class TestClassDefCreator < Test::Unit::TestCase include XSD::CodeGen include GenSupport def test_classdef_simple c = ClassDef.new("Foo") assert_equal(format(<<-EOD), c.dump) class Foo end EOD end def t...
class FontTenaliRamakrishna < Formula head "https://github.com/google/fonts/raw/main/ofl/tenaliramakrishna/TenaliRamakrishna-Regular.ttf", verified: "github.com/google/fonts/" desc "Tenali Ramakrishna" homepage "https://fonts.google.com/specimen/Tenali+Ramakrishna" def install (share/"fonts").install "Tenal...
name 'ohai_plugins_test' maintainer 'Rackspace Hosting' maintainer_email 'ryan.walker@rackspace.com' license 'Apache 2.0' description 'Cookbook to prepare for testing Ohai plugins' #long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.0.1' depends...
class Site < ApplicationRecord validates_presence_of :url, :user_id validates_uniqueness_of :url validates :url, url: true before_validation :add_url_protocol belongs_to :user has_many :bookmarks, dependent: :destroy private def add_url_protocol if !self.url.nil? unless se...
class FontFreeMonoTengwar < Formula version "2013-07-21" sha256 "11a33522a6a7aa43120f0e9f98862d922a89228ed762738809132e3b26784907" url "https://downloads.sourceforge.net/freetengwar/FreeMonoTengwar.#{version}.zip" desc "FreeMonoTengwar" desc "Unicode tengwar monospaced font" homepage "http://freetengwar.sou...
class AddLinksToBars < ActiveRecord::Migration def self.up add_column :bars, :facebook, :string add_column :bars, :twitter, :string end def self.down remove_column :bars, :twitter remove_column :bars, :facebook end end
class AddColumnToUser < ActiveRecord::Migration[5.0] def up add_column :users, :userid, :string, unique: true end def down remove_column :users, :userid end end
class DeleteDeviseTable < ActiveRecord::Migration[5.1] def change drop_table :devises end end
class AddColumnCommonResourceToAssetTypes < ActiveRecord::Migration def change add_column :asset_types, :common_resource, :boolean end end
class Comment < ApplicationRecord include ActionView::Helpers::DateHelper mount_uploader :image, ImageUploader validates :content, presence: true belongs_to :timeline belongs_to :commenter, polymorphic: true default_scope { order(created_at: :asc) } def as_json(options) super(options).merge(owner_...
node(:status) { 'success'} node(:images) do child @images, :object_root => false do node(:image_url) { |image| image.image.try(:url) } child(:attachable) do attributes :content, :id, :post_type, :likes_count node(:created_at) { |post| post.created_at.utc.strftime("%Y-%m-%d %H:%M:%S") } node(:user_like...
require_relative './post.rb' class Author @@all = [] attr_accessor :name def initialize(name) @name = name @@all.push(self) end def posts() author_posts = [] Post.all.each do |post| if post.author == self author_posts.push(post) ...
class Item < ActiveRecord::Base belongs_to :category validates :name, :description, :image_url, :dao, :price, presence: true validates :name, uniqueness: true validates :price, numericality: true before_validation :establish_daoism, :establish_image_url def establish_daoism if name self.dao = nam...
class Compiler def initialize(input=$stdin, output=$stdout) require 'pp' @input = input @output = output end attr_reader :look @look = '' def compile() init expression end def init @look = @input.read(1) raise("Look is nil") unless @look end def getChar @look = @inp...
class AddBeaconUuidToEquipment < ActiveRecord::Migration[5.0] def change add_column :equipment, :beacon_uuid, :string add_column :equipment, :beacon_latitude, :float add_column :equipment, :beacon_longitude, :float add_column :components, :beacon_uuid, :string add_column :components, :beacon_latit...
class Task < ApplicationRecord # I coded data model task.rb def self.searching(search) where('lower(name) LIKE ? OR lower(complete) LIKE ? OR lower(due_date) LIKE ? OR lower(term) LIKE ?', "%#{search}%".downcase, ...
class Api::ProjectsController < Api::ApiController include Concerns::Blobed before_action :check_authenticated_project, except: [:create] # POST /api/projects def create raise AppError.new I18n.t "errors.project.over" unless create_project? new_project = Project.create!( project_params.merge(a...
Gem::Specification.new do |s| s.name = 'cef_logger' s.version = '1.4.0' s.authors = ['Szikszai Gusztáv'] s.email = 'guszti5@hotmail.com' s.homepage = 'https://github.com/gdotdesign/cef_logger' s.summary = 'CEF Logger' s.description = 'Logger to log in CEF format to syslog.' s...
require 'rails_helper' RSpec.describe 'JS part', watir: true do describe 'user' do it 'should be created' do expect(Referrer::User.count).to eq(0) @browser.goto(@url) Watir::Wait.until{Referrer::User.count == 1} user = Referrer::User.last Watir::Wait.until{Referrer::Session.count ==...
# encoding: UTF-8 class RequirementMailer < ActionMailer::Base default :from => "Portal" def new_requirement(requirement, email) @requirement = requirement mail(to: email, subject: "Novo requerimento, " + requirement.type_requirement.description ) end def update_requirement_aluno(re...
# --- Day 16: Aunt Sue --- # Your Aunt Sue has given you a wonderful gift, and you'd like to send her a thank you card. However, there's a small problem: she signed it "From, Aunt Sue". # You have 500 Aunts named "Sue". # So, to avoid sending the card to the wrong person, you need to figure out which Aunt Sue (which...
# frozen_string_literal: true module Decidim module Opinions # A command with all the business logic when a user withdraws a new opinion. class WithdrawOpinion < Rectify::Command # Public: Initializes the command. # # opinion - The opinion to withdraw. # current_user - The current...
Refinery::Application.routes.draw do # public facing new subscription page # helper is new_subscription_url etc get '/subscribe', :to => 'subscriptions#new', :as => 'new_subscription' # all other public facing urls start /subscribe # the only true rest action is create # the rails helpers use subscription...
require 'rails_helper' RSpec.describe CommentsController, type: :controller do let(:user) { create(:user) } let(:article) { create(:article) } subject { response } before :each do @request.env['devise.mapping'] = Devise.mappings[:user] sign_in user end describe '#create' do let(:params) { a...
xml.instruct! :xml, :version => '1.0' xml.rss :version => '2.0' do xml.channel do xml.title 'Listado de articulos en primera mano - Banco Temático' xml.description 'Listado de articulos de interes general dentro de los registros del Banco Temático' xml.link formatted_primera_manos_url(:rss) for primer...
class WishListController < ApplicationController before_action :signed_in_user before_action :correct_user, only: [:edit, :update, :show, :destroy, :edit] def games @remember_token = User.hash_token(cookies[:remember_token]) @user = User.find_by(remember_token: @remember_token) @wish_list = GamesWishList....
#!/usr/bin/env ruby # # This file is gererated by ruby-glade-create-template 1.1.4. # require 'libglade2' class TelaGlade include GetText attr :glade def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE) bindtextdomain(domain, localedir, nil, "UTF-8") @glade =...
FactoryBot.define do factory :contact do name { "#{Faker::Name.first_name} #{Faker::Name.last_name}".gsub /([^\w -])/, '' } email { Faker::Internet.email } # random format birthdate within allowed [dob_formatted, dob_iso].sample address { Faker::Address.full_address } # random format phone num...
class AddMessageToShare < ActiveRecord::Migration def up add_column :shares, :message, :string, :default => '', :null => false, :after => :shareable_type # recipient is optional, and index doesn't need to be unique remove_index :shares, :name => :user_recipient_shareable add_index :shares, [:user...
class Lesson < ActiveRecord::Base has_many :bookings belongs_to :gym end
require 'rails_helper' RSpec.describe Page, type: :model do describe "Valid Attributes" do it { is_expected.to have_attribute :url } it { is_expected.to have_attribute :content } end describe "Validations" do it { should validate_presence_of(:url) } it "expects url is not valid nor accesible" ...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'spec_helper' describe TwitterCldr::Tokenizers::NumberTokenizer do describe "#tokenize" do let(:number) { 10 } it "gets tokens for a latin language (i.e. Portuguese)" do data_reader = TwitterCldr::Da...
=begin Report.for(:monthly_balance).run(Date.new(2018,1,1), Date.new(2018,4,30)) =============== Monthly Balance =============== January 2018 Paid In: XXX.XX Paid Out: -XXX.XX Balance: -XXX.XX February 2018 Paid In: XXX.XX Paid Out: -XXX.XX Balance: -XXX.XX March 2018 ...
require 'spec_helper' describe Journal do before :each do DataFile.destroy_all end it 'mush have name' do j = create_journal j.name = nil j.should_not be_valid end it 'must have num' do j = create_journal j.num = nil j.should_not be_valid end it 'num must be > 1' do j =...
class Friendship < ActiveRecord::Base belongs_to :user belongs_to :friend, :class_name => "User" def self.friends_with?(friend_id) friend = find_by_friend_id(friend_id) friend.present? && friend.status == 1 end def self.requested?(friend_id) friend = find_by_friend_id(friend_id) friend.present? && fri...
class BlogPostAddition < ActiveRecord::Base attr_accessible :emotions, :section_id belongs_to :section end
class FontGlowSansTcCompressed < Formula version "0.93" sha256 "e5598b8fc3bc39432cbb063d3060f4b532e2050a1b3d9db86b49c1fbd8992459" url "https://github.com/welai/glow-sans/releases/download/v#{version}/GlowSansTC-Compressed-v#{version}.zip" desc "Glow Sans TC Compressed" homepage "https://github.com/welai/glow-...
class CreateAnswers < ActiveRecord::Migration def self.up create_table :answers do |t| t.string :title t.boolean :correct t.integer :score, numericality: true t.references :question, index: true, foreign_key: true t.timestamps null: false end end def self.down drop_tabl...
require 'rails_helper' describe MessagesController do let(:user) { create(:user) } let(:group) { create(:group) } let(:groups) { create(:group) } let(:message) { create(:message, user_id: user.id, group_id: group.id) } let(:messages){ create_list(:message, 5, user: user, group: group )} context 'sign_in us...
require "sequel" class Colore #elenco colori @colori=["Bianco","Larice","RovereNaturale","Corda","RovereTabacco","OlmoPerla","OlmoNaturale","OlmoLava","Mandarino","Girasole","Magnolia","Alabastro","Avio","VerdePrimavera","Glicine","Acero","Punto","Riga","AcxBianco","AcxTortora","Moro"] #elenco opzioni color...
require_relative('fish.rb') class River attr_reader :name, :fish_in_river def initialize(name) @name = name # so every time a new River instance is created, there are no fish, but we need to add fish to river via add_fish method @fish_in_river = [] end # function to add fish to river, takes an a...
module Admin class MainslidesController < BaseController load_and_authorize_resource def index @mainslides = Mainslide.all.priority.sequential end def new @mainslide = Mainslide.new end def create @mainslide = Mainslide.new(mainslide_params) if @mainslide.save ...
class AssessmentsController < ApplicationController respond_to :json def index if !current_user || current_user.guest respond_to do |format| format.json { render :json => {}, :status => :unauthorized } end end @assessments = Assessment.includes(:definition).where('user_id = ?', curren...
# == Schema Information # # Table name: pages # # id :integer not null, primary key # title :string # position :integer # content :text # slug :string # created_at :datetime # updated_at :datetime # require 'test_helper' class PageTest < ActiveSupport::TestCase let :page do ...
class SyojiTsController < ApplicationController before_action :set_syoji_t, only: [:show, :edit, :update, :destroy] # GET /syoji_ts # GET /syoji_ts.json def index @syoji_ts = Syoji.where(user_id: session[:usr]).order(notification_time: "DESC") end # GET /syoji_ts/1 # GET /syoji_ts/1.json def show ...
class Week < ActiveRecord::Base belongs_to :season has_many :games, dependent: :destroy has_many :picks, dependent: :destroy has_one :random_pick, dependent: :destroy def scoring_week !random_pick.correct? end def game_for(team) games.where("home_team_id = ? OR away_team_id = ?", team.id, team.i...
class Api::ItemsController < ApplicationController #display all items def index #get all items from db and save to instance variable @items = Item.all render json: @items end #display a specific item def show #get the item id from the url params item_id = params[:id] #use `item_...
class AddServiceProviderTypeIdToService < ActiveRecord::Migration def change add_column :services, :service_provider_type_id, :integer end end
# frozen_string_literal: true module GraphQL class Schema class Directive < GraphQL::Schema::Member # This is _similar_ to {Directive::Feature}, except it's prescribed by the server, not the client. # # In this case, the server hides types and fields _entirely_, unless the current context has ce...
require "application_system_test_case" class StatementFlowTest < ApplicationSystemTestCase setup do @alessandro = login(:alessandro) end test "statement index" do visit statements_path assert_text "Extratos" assert_selector ".total-statements", text: @alessandro.statements.count assert_sel...
require "spec_helper" describe GenerateData do let!(:type) { "boolean" } let!(:size) { nil } let!(:element) { nil } let!(:value) { nil } let!(:description) do { "type" => type, "value" => value, "size" => size, "element" => element, } end subject { described_class.new(des...
module Yito module Model module Booking class MySQLActivityQueries def initialize(repository) @repository = repository end def count_received_orders(year) query = <<-QUERY select count(*) FROM orderds_orders where YEAR(cre...
class Semaphore def initialize(key) unless CONFIG.nil? @key = "semaphore:#{key}" @redis = Redis.new({ host: CONFIG['redis_host'], port: CONFIG['redis_port'], db: CONFIG['redis_database'] }) end end def lock # CONFIG['timeout'] sets the max time for a page to be parsed, # so the lock d...
class UserSerializer < ActiveModel::Serializer attributes :avatar_url, :username def avatar_url object.avatar.url(:thumb) end end
class AddDatasetToTraits < ActiveRecord::Migration[5.1] def change add_reference :traits, :dataset, foreign_key: true end end
# frozen_string_literal: true require 'test_helper' module Nls module EndpointInterpret class TestLanguage < NlsTestCommon def setup super Nls.remove_all_packages Interpretation.default_locale = '*' package = Package.new('language') determiner = package.new_inte...
class DebateVotesController < ApplicationController before_action :set_debate_vote, only: [:show, :edit, :update, :destroy] before_action :authenticate_user!, except: [:create] # GET /debate_votes # GET /debate_votes.json def index @debate_votes = DebateVote.all end # GET /debate_votes/1 # GET /...
require 'spec_helper' describe Logobox, :vcr do describe '::generate_logo_url' do context 'no size is given' do it "creates basic url for logobox logo" do expect(Logobox.generate_logo_url(27169278)).to eq 'http://www.logobox.cz/getimage.ashx?id=CZ27169278' end end context 'size is gi...
# (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
class BeefEvaluation < ApplicationRecord belongs_to :beef belongs_to :evaluation end
class ApplicationController < ActionController::Base alias_method :devise_current_user, :current_user include Response rescue_from ActiveRecord::RecordInvalid, with: :render_unprocessable_entity_response rescue_from ActiveRecord::RecordNotFound, with: :render_not_found_response def render_unprocessable_entity_r...
class Category < ApplicationRecord has_many :children, class_name: Category.name, foreign_key: :parent_id belongs_to :parent, class_name: Category.name, foreign_key: :parent_id, optional: true has_many :song_categories, dependent: :destroy has_many :songs, through: :song_categories has_many :album_categories,...
class CargoPart < Part def initialize(volume) super(volume) @type = 'грузовой' @free_space = volume.to_i @volume = volume.to_i @temp_volume = volume.to_i end def occupy_space(volume) @free_space = @temp_volume - volume @temp_volume = @free_space end def release_space(volume) ...
# frozen_string_literal: true # rspec ./spec/lib/statistic_calcs/distributions/Hyperpascal_spec.rb require 'statistic_calcs/distributions/hyperpascal' RSpec.describe StatisticCalcs::Distributions::Hyperpascal do subject { StatisticCalcs::Distributions::Hyperpascal.new(options) } before { subject.calc! } descri...
module Api::V1 class UsersController < ApiController before_action :authenticate_user! before_action :set_user, only: [:show, :update] # GET /v1/users def index #puts "Header: { uid: " + request.headers['uid'] + "}" #puts "Header: { access-token: " + request.headers['access-token'] + "}...
require 'active_record' require_relative '../reward_type.rb' class RewardType::ValueOff < ActiveRecord::Base validates :value, presence: true, uniqueness: true def calculate_deduction(original_amount, number_of_deductions) new_amount = value * number_of_deductions original_amount > new_amount ? new_amount...
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :lists root "lists#index" delete '/lists' ,to: 'lists#deleteall', as: 'deleteall' patch '/lists/:id/finished' ,to: 'lists#finished', as: 'finished' end
class ApplicationController < ActionController::Base protect_from_forgery helper_method :current_user private # Helper function to get the current user from the session_id def current_user begin @current_user ||= User.find(session[:user_id]) if session[:user_id] rescue Mongoid::Errors::Document...
today_mood = 'anxious' case today_mood when 'tired' puts "Take a nap." when 'hungry' puts "Have a snack." when 'thirsy' puts "Where's your mimosa?" when 'anxious' puts "Take a chill pill." when 'lonely' puts "Call a friend." when 'excitd' puts "Scream and shout!" else puts "Guess you must be one with the uni...
module ApplicationHelper def display_person_count "There are #{Person.count} people in the app" end def persons_relations_count(person) person.relatives.count end end