text stringlengths 10 2.61M |
|---|
class AddColToShows < ActiveRecord::Migration
def change
end
add_index :shows, :movie_id
end
|
FactoryGirl.define do
factory :user do
client_slug { nil }
sequence(:email_address) { |n| "user#{n}@example.com" }
sequence(:first_name) { |n| "FirstName#{n}" }
sequence(:last_name) { |n| "LastName#{n}" }
timezone { Time.zone.name }
trait :active do
active true
end
trait :inact... |
class CollectionDetailsPresenter < DetailsPresenter
def initialize(collection, collection_id=nil, token=nil, env='prod')
@collection = collection
@collection.id = collection_id
data_center = ''
data_center = collection_id.split('-').last if collection_id.is_a?(String)
if collection.xml
coll... |
# -*- ruby -*-
require 'rbconfig' # Ruby Standard Library
module LAAG
module Platform
HOST_OS = RbConfig::CONFIG['host_os'].downcase
SOEXT = RbConfig::CONFIG['SOEXT'] || RbConfig::CONFIG['DLEXT']
SOGLOB = (HOST_OS =~ /darwin/) ? "*.#{SOEXT}" : "#{SOEXT}.*"
end
end
|
require_relative 'mail_job'
class WelcomeMailer < MailWorker
def perform(user)
message = <<~MSG
<h3>Thanks for signing up for Dynaposted!</h3>
<p>Feel free to explore and update your dynamic posts.</p>
MSG
Mail.deliver do
to user['email']
from 'Dynaposted <admin@po-it.com... |
# Stack Machine Interpretation
=begin
(Understand the Problem)
Problem: Write a method that implements a miniature stack-and-register-based programming language that has the following commands
Inputs: String
Outputs: Integer
Questions:
1.
2.
Explicit Rules:
1. You should initialize t... |
class Admin::AdminController < ApplicationController
layout "admin"
before_filter :verify_admin
private
def verify_admin
redirect_to root_url unless current_user.role == "admin"
end
end
|
require 'rails_helper'
RSpec.describe RobotWeapon, :type => :model do
# pending "add some examples to (or delete) #{__FILE__}"
context "initialization" do
it "should have a health" do
robot_weapon = RobotWeapon.new
expect(robot_weapon).to check_health_at_empty_initialization
end
it "sho... |
# Documentation: https://github.com/driesvints/dotfiles/blob/master/Brewfile
# Taps
tap "caskroom/cask"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/versions"
# Binaries & Development
brew "autoconf" # Automatic configure script builder
brew "automake" # Tool for generating GNU Standard... |
json.choices do
json.array! @categories, :id, :name
end
json.size_lists @size_lists
json.brand_names @brand_names
json.brand_groups @brand_groups&.pluck(:name)
|
class RecordsController < ApplicationController
def create
#Create the new record.
project = Project.find(params[:record][:project_id])
@record = Record.new(params.require(:record).permit(:hours_worked, :observations, :project_id))
@record.student_id = current_user.id
if @record.save
redirect_to projec... |
# 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... |
class RemovePriorityFromKanbanCardTasks < ActiveRecord::Migration
def change
remove_column :kanban_card_tasks, :priority, :integer
end
end
|
require 'spec_helper'
describe Customer do
let!(:customer) { FactoryGirl.create(:customer) }
it { should have_valid(:name).when('David') }
it { should_not have_valid(:name).when(nil, '')}
it { should have_valid(:phone_no).when('4133203613')}
it { should_not have_valid(:phone_no).when(nil, '', '413-320-361... |
# frozen_string_literal: true
Sequel.migration do
change do
create_table(:wars) do
Integer :id, identity: true, primary_key: true
column :created, 'timestamp with time zone', null: false, default: Sequel.lit('CURRENT_TIMESTAMP')
column :updated, 'timestamp with time zone', null: false, default:... |
require_relative './art_library'
class UserInterface
attr_writer :rubagotchi_name
def initialize(art_library = ArtLibrary.new)
@rubagotchi_name = nil
@art_library = art_library
end
def render_main_menu
puts @art_library.main_title +
"Welcome to Rubagotchi!\n"\
... |
module Mutant
class Mutator
class Node
class Send
# Mutator for sends that correspond to a binary operator
class Binary < self
children :left, :operator, :right
private
# Emit mutations
#
# @return [undefined]
#
# @api p... |
class CreateWaterPurityReports < ActiveRecord::Migration[5.0]
def change
create_table :water_purity_reports do |t|
t.integer :user_id
t.string :reporter_name
t.string :location
t.decimal :lat, precision: 25, scale: 20
t.decimal :lng, precision: 25, scale: 20
t.integer :water_co... |
class User < ApplicationRecord
has_many :posts
validates :name, presence: true
validates :email, uniqueness: true, presence: true
validates :age, numericality: true
validates :introduction, length: { in: 10..30 }
end |
require "net/http"
require 'pry'
module CongressData
class LegislatorSeed
def create_legislators
data = { 'results' => true }
page = 0
while data['results']
data = get_congress_data(page += 1)
data['results'].each do |result|
create_legislator result
end
... |
module FacilitiesManagement::Procurements::ContractsHelper
include FacilitiesManagement::ProcurementsHelper
def warning_title
if @contract.closed?
'Closed'
else
WARNINGS[@contract.aasm_state.to_sym]
end
end
# rubocop:disable Metrics/AbcSize
def warning_message
warning_messages = ... |
require 'spec_helper'
describe SessionsController do
describe "POST create" do
let(:valid_attributes){attributes_for(:user).select{|key| [:password, :name].include? key }}
its("with invalid params") { expect( post :create ).to redirect_to(login_path) }
its("with valid params") do
create(:user)
... |
class LikesController < ApplicationController
def create
@post = Post.find params[:post_id]
respond_to do |format|
if current_user.toggle_like @post
format.html { redirect_to :back }
format.js { render :layout => false }
format.json { render :json => @post, :status => :created,... |
class Admin::UsersController < ApplicationController
before_action :set_user, only: [:balance, :show]
def index
@users_with_stripe = User.with_stripe_account
end
def show
end
private
def set_user
@user = User.find_by_id(params[:id])
end
end |
class Partner
class Review < ApplicationRecord
self.table_name = 'partner_reviews'
after_initialize :init
belongs_to :partner, class_name: 'Partner', required: false
belongs_to :user, class_name: 'User', required: false
has_one(
:user_profile,
-> { select(User::Profile.review_columns... |
require 'open-uri'
require 'json'
require 'nats/client'
require File.join(File.dirname(__FILE__), 'insteon.rb')
require File.join(File.dirname(__FILE__), 'x10.rb')
module SmartLinc
class Controller
include Insteon
include X10
attr_reader :options, :name
# constructor
def initialize(host, opts =... |
# your code goes here
require 'pry'
def begins_with_r(array)
array.each {|word| return false if word.start_with?("r") == false}
true
end
def contain_a(array)
array.select{|word| word.include? ("a")}
end
def first_wa(array)
array.detect {|word| word.to_s.start_with?("wa")}
end
def remove_non_strings(array... |
class Distillery < ActiveRecord::Base
attr_accessible :name
has_many :whiskeys
validates :name, { :presence => :true, :uniqueness => true }
def to_s
return self.name
end
end
|
class StorySubcategoriesController < ApplicationController
before_action :set_story_subcategory, only: [:show, :edit, :update, :destroy]
# GET /story_subcategories
# GET /story_subcategories.json
def index
@story_subcategories = StorySubcategory.all
end
# GET /story_subcategories/1
# GET /story_subc... |
# Using case / when statements ask user to enter the coffee shop they want
# to order from and then print: "Grande Latte" if they enter Starbucks
# and "Double Double" if they enter "Tim Hortons"
# and "Medium Coffee" if they enter Blenz
# and "I don't know this shop" if the enter something else.
puts "Welcome to coff... |
require 'spec_helper'
describe DoubleDice::Matrix do
describe 'its constructor' do
it 'sets cleartext and password without sanitizing them' do
cleartext, password = 'foo'.split(//), 'bar'.split(//)
subject = DoubleDice::Matrix.new cleartext, password
subject.cleartext.must_equal cleartext
... |
# frozen_string_literal: true
class TicketLabel < ApplicationRecord
belongs_to :ticket, dependent: :destroy
belongs_to :label, dependent: :destroy
end
|
require 'cgi'
require 'reverse_markdown'
require 'sanitize'
class Hash
def slice(*keys)
Hash[values_at(*keys).each_with_index.map {|v, i| [keys[i], v] }]
end
end
class Numeric
def megabytes
self * 1024 * 2014
end
end
class String
def escape_html
CGI.escapeHTML(self)
end
def numeric?
to... |
class Grupo < ActiveRecord::Base
belongs_to :user, :foreign_key => :alumno_id
belongs_to :profesor, :class_name => 'user', :foreign_key => :profesor_id
belongs_to :asignatura
validates :alumno_id, presence: true
validates :profesor_id , presence: true
validates :asignatura_id, presence: true
... |
class RecipeController < ApplicationController
#Create
get '/recipes/new' do
if logged_in?
erb :'/recipes/new'
else
flash[:message] = "You need to be logged in to view that page"
redirect to '/users/login'
end
end
post '/recipes' do
if params[:name].empty? || p... |
require 'rails_helper'
describe Space do
it {should belong_to :user}
it {should have_many :photos}
it {should have_many :bookings}
it {should validate_presence_of :address}
it {should validate_presence_of :description}
it {should validate_presence_of :cost}
end
|
class Admin::PromotionsController < ApplicationController
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
def index
@promotions = Promotion.all
end
def new
@promotion = Promotion.new()
end
def edit
end
def update
respond_to do |format|
if @promotion.update(pro... |
# frozen_string_literal: true
require_relative "helpers"
module FileReaderTest
def self.define_tests(prefix, unsupported: [], &block)
tests = Dir.glob(File.expand_path("tests/*.rb", __dir__))
.map { |path| File.basename(path).chomp(".rb") }
.reject { |name| name.end_with?("_unsuppo... |
# encoding: utf-8
require 'rails/generators/resource_helpers'
require "rails/generators/mongoid/model/model_generator"
module MongoidReactScaffold
module Generators
class ScaffoldControllerGenerator < ::Rails::Generators::NamedBase
include ::Rails::Generators::ResourceHelpers
source_root File.expand_... |
ActionController::Routing::Routes.draw do |map|
# mapped routes
map.admin '/admin', :controller => 'admin/blogs', :action => 'index', :conditions => { :method => :get }
map.signup '/signup', :controller => 'admin/users', :action => 'signup', :conditions => { :method => :get }
map.login '/... |
require "spec_helper"
describe ContentInfosController do
describe "routing" do
it "routes to #index" do
get("/content_infos").should route_to("content_infos#index")
end
it "routes to #new" do
get("/content_infos/new").should route_to("content_infos#new")
end
it "routes... |
class Product < ActiveRecord::Base
belongs_to :store
belongs_to :inventory
has_many :line_items
acts_as_list scope: :store
MEASURETYPE = ['Variance', 'Used']
UNITMEASURES = ['bt', 'pk', 'kg', 'ea', 'lt', '$']
end
|
#! /usr/bin/env ruby
#
# See https://github.com/attm2x/m2x-ruby#example for instructions
#
require "time"
require "m2x"
API_KEY = ENV.fetch("API_KEY")
DEVICE = ENV.fetch("DEVICE")
puts "M2X::Client/#{M2X::Client::VERSION} example"
@run = true
stop = Proc.new { @run = false }
trap(:INT, &stop)
trap(:TERM, &stop... |
class Kbuser < Kb3
hobo_user_model # Don't put anything above this
fields do
username :string, :name => true
lastname :string
firstname :string
email :string
password :string
worknumber :string
homenumber :string
status :string
pagernumber :string
end
... |
module Acts
module DataTable
module MultiColumnScopes
def self.included(base)
base.send :extend, ClassMethods
end
module ClassMethods
#
# Generates a scope to search for a given string in multiple
# columns at once. Columns may either be in the own table
... |
class User
include FakeModel
fake_columns :email, :full_name, :username
end
|
describe InboxController do
it "handles mandrill POST of inbound email" do
proposal = FactoryGirl.create(:proposal)
requester = proposal.requester
mandrill_event = [{
'event' => 'inbound',
'msg' => {
'subject' => 'please add my comment',
'from_email' => requester.email_address,... |
=begin
(Problem):
Write a method that counts the number of occurrences of each element in a given array.
(Understand the Problem):
• (Inputs): Array
• (Outputs):
- Hash (keys: each element in input array, values: # of occurences)
- The words in the array are case-sensitive
• (Rules):
o (Explic... |
require 'test_helper'
class UsersControllerTest < ActionController::TestCase
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should get new" do
get :new
assert_response :success
end
test "should redirect edit when not logged in" do
get :edit, id: @user
#get edit_u... |
require_relative 'tic_tac_toe'
class TicTacToeNode
def initialize(board, next_mover_mark, prev_move_pos = nil)
@board = board
@next_mover_mark = next_mover_mark
@prev_move_pos = prev_move_pos
end
def losing_node?(evaluator)
end
def winning_node?(evaluator)
end
# This method generates an ar... |
# encoding: UTF-8
# Add to rtesseract a image manipulation with QuickMagick
module QuickMagickProcessor
def self.setup
require 'quick_magick'
end
def self.a_name?(name)
%w(quick_magick QuickMagickProcessor).include?(name.to_s)
end
def self.image_to_tif(source, x = nil, y = nil, w = nil, h = nil)
... |
require 'bundler/setup'
require "bundler/gem_tasks"
require 'rake/testtask'
require 'date'
require 'rubygems'
require 'rubygems/package_task'
require 'yard'
require 'fog/core'
require 'fog/json'
#############################################################################
#
# Helper functions
#
#######################... |
class AddFNameAndLNameToBids < ActiveRecord::Migration[5.0]
def change
add_column :bids, :f_name, :string
add_column :bids, :l_name, :string
end
end
|
require 'credova/api'
module Credova
class FFL < Base
include Credova::API
CREATE_ATTRS = {
permitted: %i( license_number expiration address address_2 city state zip ).freeze,
required: %i( license_number expiration address city state zip ).freeze,
}
ENDPOINTS = {
create: ... |
# Advent of Code 2019 Day 10 part 1
# Asteroid Monitoring Station
# Find the asteroid that can see the most other asteroids in a 2-d grid
# 395 is too high
require 'prime'
class Asteroids
attr_accessor :all_asteroids
def initialize(initial_occupancy)
@all_asteroids = initial_occupancy
@max_row = @all_aste... |
class CompanyPolicy < ApplicationPolicy
def index?
user.instance_of?(Admin)
end
def show?
user.instance_of?(Admin) || user.company_id == record.id
end
def new?
user.instance_of?(Admin)
end
def create?
user.instance_of?(Admin)
end
end
|
require 'spec_helper'
describe LeaguesController do
render_views
describe "GET 'show'" do
let(:league) do
FactoryGirl.create(:league)
end
it "should be successful" do
get :show, :id => league
response.should be_success
end
it "should find the right league" do
get :show, :id => l... |
class UsersController < ApplicationController
before_action :confirm_logged_in, only: [:index, :edit, :update, :destroy]
before_action :confirm_matching, only: [:edit, :update]
before_action :confirm_admin, only: :destroy
#set all users
def index
@users = User.paginate(page: params[:page], per_page: 10)
... |
module OmniAuth
module Strategies
class WindowsLive < OmniAuth::Strategies::Windowslive
option :name, 'windows_live'
end
end
end
|
class CreateScientificLabs < ActiveRecord::Migration[5.1]
def change
create_table :scientific_labs, id: :uuid do |t|
t.integer :number_of_test_tubes, default: 0, null: false
t.integer :number_of_microscopes, default: 0, null: false
t.integer :number_of_shredders, default: 0, null: false
t.... |
class Api::V1::ProductionPlansController < Api::V1::BaseController
before_action :set_production_plan, only: [:show, :update, :destroy]
def index
json_response(ProductionPlan.all.paginate(page: params[:page], per_page: 20))
end
def show
json_response(@production_plan)
end
def create
productio... |
class Question < ActiveRecord::Base
has_secure_token :id_token
acts_as_taggable
belongs_to :user
default_scope -> { order(created_at: :desc) }
validates :user_id, presence: true
validates :title, presence: true
has_many :responses
def answers
responses.where(response_id: nil)
end
def to_p... |
class Creature < ApplicationRecord
validates :name, presence: true
before_save :default_values
def default_values
if rand > 0.5
self.shape ||= 'square'
else
self.shape ||= 'circle'
end
self.name ||= self.id
end
end
|
module Orocos
module Test
# Support for using ruby tasks in tests
module RubyTasks
def setup
@allocated_task_contexts = Array.new
super
end
def teardown
super
@allocated_task_contexts.each(&:dispose)... |
class AddIsResetToStockChange < ActiveRecord::Migration
def change
add_column :stock_changes, :is_reset, :boolean, default: false, null: false
add_column :stock_changes, :kind, :integer, null: false
add_index :stock_changes, :is_reset
end
end
|
require 'logger'
module Rogu
module Concern
# Enable logging where needed.
#
# Modified version of the Concurrent::Concern::Logging module, without
# the timestamp field as it is automatically added by Heroku.
module Logging
include Logger::Severity
# Logs through {Concurrent.global... |
class RenameTableCandidateEducationsToEducations < ActiveRecord::Migration
def self.up
rename_table(:candidate_educations, :educations)
end
def self.down
rename_table(:educations, :candidate_educations)
end
end
|
module LenticularCms
class Category < ApplicationRecord
extend FriendlyId
friendly_id :name, use: :slugged
has_many :category_joins_posts
has_many :posts, through: :category_joins_posts
validates :name, presence: true
validates :name, uniqueness: true
end
end
|
class Dog < Animal
def to_s
"#{@name} the dog, age #{age}"
end
end |
class Resident
include DataMapper::Resource
property :id, Serial
property :resident_name, String
property :phone_number, String
property :phone_number2, String
property :email_address, String
property :email_address2, String
property :unit, Integer, :required => true, :index => true
property :licen... |
class OrangeTree
def initialize
@feet = 1
@years = 0
@oranges = 0
end
def one_year_passes
@years = @years + 1
@feet = @feet + rand(4) + 1
if @years > 3
@oranges = @oranges + rand(6) + 1
end
if @years > 8
puts 'Your tree died'
exit
end
end
def height
pu... |
class RemoveCategoryFromEvent < ActiveRecord::Migration[5.1]
def change
remove_column :events, :category
add_column :events, :category_id, :integer, null: false
end
end
|
#!/usr/bin/ruby
class Fixnum
n = Array(1..42)
n.each do |nbr| define_method("multiply_by_#{nbr}") do self * nbr end end
end
|
# == Schema Information
#
# Table name: owners
#
# id :integer(4) not null, primary key
# ticket_id :integer(4)
# employee_id :string(255)
# created_at :datetime
# updated_at :datetime
#
class Owner < ActiveRecord::Base
belongs_to :employee
belongs_to :ticket
end
|
# Tealeaf Academy Prep Course
# Intro to Programming
# Basics
# Exercise 1
puts "Exercise 1:"
my_name = "Beth " + "Secor"
puts my_name
# Excercise 2
puts "Exercise 2:"
number = 2376
thousands = number/1000%10 # thousands
hundreds = number/100%10 # hundreds
tens = number/10%10 # tens
ones = number/1%10 # ones
puts "Th... |
require 'spec_helper'
describe PlanetsController do
describe 'given a planet' do
before :each do
@mars = Planet.new
@mars.name = 'Mars'
@mars.life = false
@mars.image_url = 'http://space-facts.com/wp-content/uploads/mars.jpg'
@mars.save
end
describe 'GET index' do
... |
class SurveyOpenQuestion < ActiveRecord::Base
include Accessable
include Attachable
include ResourceVisibility
belongs_to :user
has_many :questions, as: :questionable, class_name: 'SurveyQuestion', dependent: :destroy
has_many :subscriber_surveys, as: :survey, dependent: :destroy
has_many :answers, t... |
class DocumentStatus < ActiveRecord::Base
has_many :documents
include HasValueField
default_value_method :unpublished, :published, :hidden
end
|
class Form < ActiveRecord::Base
belongs_to :user
has_many :elements
has_attached_file :image, :styles=>{:small=>"400X160"}
validates :title, :presence=> true
validates_attachment_presence :image
end
|
require_relative 'sales_engine'
require_relative 'invoice_analyst'
require_relative 'item_count_analyst'
require_relative 'item_price_analyst'
require_relative 'invoice_top_days'
require_relative 'merchant_analyst'
class SalesAnalyst
include InvoiceAnalyst
include ItemCountAnalyst
include ItemPriceAnalyst
incl... |
class MessageSerializer < ActiveModel::Serializer
attributes :id, :message, :username
def username
self.object.user.username
end
end
|
# encoding: utf-8
module SamlIdp
VERSION = '0.3.3'
end
|
class User < ActiveRecord::Base
attr_accessible :email, :name
has_many :micoposts
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
def load_user
@user = User.find_by_email(params[:email])
current_user ||= @user
end
def authenticate_with_token
if !params[:email]
render :json => {:error => "email is empty"}
return
elsif !params[:auth_token]
... |
require 'rails_helper'
RSpec.describe ParticipantsController do
before :each do
sign_in
@protocol = create(:protocol)
@participant = create(:participant, protocol_id: @protocol.id)
end
describe "GET #index" do
it "should get participants" do
get :index, {
protocol_id: @protocol.id... |
require 'test_helper'
class MongoServiceTest < ActiveSupport::TestCase
test "initialize object" do
service = MongoService.new
assert_not service.database_host.blank?
assert_not service.database_port.blank?
end
test "initialize object with variables" do
service = MongoService.new({ "page_size" =... |
class ConnectionsController < ApplicationController
before_filter :require_user
before_filter :load_user
before_filter :require_authorized_user
before_filter :load_connection, :only => [:delete, :destroy]
before_filter :require_connection, :only => [:delete, :destroy]
before_filter :require_user_to_ow... |
#!/usr/bin/env ruby
require_relative "../config/environment"
logger = Logger.new('/home/deploy/kairos/log/update_summaries.log', 5, 1024000)
begin
period_start = Time.zone.now.beginning_of_month
period_end = period_start + 1.month
User.update_summaries period_start, period_end
if Time.zone.now.day <= 10
... |
class User::Action::SendCreatedUserEmail
include Strategy
def initialize(hashed_user)
@hashed_user = hashed_user
end
def execute
puts "Send email about users's creation..."
end
end
|
class Bmi < ApplicationRecord
belongs_to :user
# validates
validates :mass, presence: true, numericality: { only_float: true }
validates :height, presence: true, numericality: { only_float: true }
# methods
def self.calculate(mass, height)
(mass / height**2) * 10000
end
end
|
class RolePolicy < ApplicationPolicy
def index?
user.role.can_view_role
end
def create?
user.role.can_create_role
end
def update?
user.role.can_update_role
end
def destroy?
user.role.can_destroy_role
end
end |
class FontWhisper < Formula
head "https://github.com/google/fonts/raw/main/ofl/whisper/Whisper-Regular.ttf", verified: "github.com/google/fonts/"
desc "Whisper"
homepage "https://fonts.google.com/specimen/Whisper"
def install
(share/"fonts").install "Whisper-Regular.ttf"
end
test do
end
end
|
namespace :data do
desc 'Fix out of order visits groups'
task fix_visit_group_positions: :environment do
class VisitGroup < ActiveRecord::Base; end
count = `wc -l /tmp/data.csv`.split.first
bar = ProgressBar.new(count.to_i)
CSV.foreach '/tmp/data.csv', headers: true do |row|
bar.increment! ... |
class Leads2sController < ApplicationController
before_action :set_leads2, only: [:show, :edit, :update, :destroy]
# GET /leads2s
# GET /leads2s.json
def index
@leads2s = Leads2.all
end
# GET /leads2s/1
# GET /leads2s/1.json
def show
end
# GET /leads2s/new
def new
@leads2 = Leads2.new
... |
# frozen_string_literal: true
FactoryBot.define do
factory :user do
sequence :email do |n|
"test_user_#{n}@example.com"
end
password 'password'
display_name FFaker::Name.name
factory :admin do
roles { [Role.where(name: 'admin').first_or_create] }
end
end
end
|
class BookmarkedJobsController < ApplicationController
before_action :authenticate_user!, only: [:unbookmark_job]
def bookmark_job
unless user_signed_in?
redirect_to new_user_session_path, alert: 'Log in and build your resume now'
return
end
@user = current_user
@job = Job.find(params[:... |
class PostClosingPage < GenericBasePage
include DataHelper
#class HeaderPage < GenericBasePage
element(:creditSuisseExports) {|b| b.link(xpath: "//li[@id='post_closing_credit_suisse_exports_#']/a")}
#Selections within Credit Suisse Reports drop down menu
element(:postPurchase) {|b| b.link(text: "Post Pu... |
class PartnershipsController < ApplicationController
respond_to :html, :json
def create
params[:partnership].delete(:partner_name)
@partnership = Partnership.new( params[:partnership] )
@person = Person.find( params[:partnership][:person_id] )
respond_to do |format|
if @partnership.save
... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_current_user
before_action :set_cart_user
before_action :transfer_session_cart
protected
def configure_permitted_paramet... |
# frozen_string_literal: true
# rubocop:disable Rails/CreateTableWithTimestamps
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :user_email
t.text :body
end
end
end
# rubocop:enable Rails/CreateTableWithTimestamps
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.