text
stringlengths
10
2.61M
class AddDefaultValueToColumnWidthInPost < ActiveRecord::Migration def change change_column_default(:posts, :column_width, 'One Column') end end
#!/usr/bin/ruby # Programmer: Chris Bunch (cgb@cs.ucsb.edu) require 'common_functions' require 'custom_exceptions' require 'neptune' require 'neptune_manager_client' require 'task_info' # The promise gem gives us futures / promises out-of-the-box, which we need # to hide the fact that babel jobs are asynchronous. re...
class AddPswordToUser < ActiveRecord::Migration def self.up add_column :users, :psword, :string end def self.down remove_column :users, :psword end end
class AwsServices::DocumentStorage BUCKET_NAME = 'eduba' def initialize(doc) @doc = doc @s3 = Aws::S3::Resource.new @obj = @s3.bucket(BUCKET_NAME).object(storage_key) end def write(file) @obj.upload_file(file.tempfile) end def remove @obj.delete end def public_url @obj.publi...
require 'rails_helper' RSpec.describe Product, type: :model do describe 'Validations' do let (:category){ Category.create(name: "categoryHere")} subject { described_class.new(name: "here", price_cents: 10, quantity: 10, category_id: category.id) } # validation tests/examples here it "is valid with va...
require 'spec_helper' describe Project do describe "validations" do it "should always have a name" do project = Project.new name: nil project.valid?.should be_false end end end
class ValuesDistribution def initialize(values) @values, @occurence_spread = values, Hash.new(0) @values.each do |item| item = 'Unknown' if item.nil? @occurence_spread[item] += 1 end end def most_occured return nil unless most_occured_value = @occurence_spread.max_by { |...
require "rails_helper" RSpec.describe AdBookingsController, type: :routing do describe "routing" do it "routes to #index" do expect(:get => "/ad_bookings").to route_to("ad_bookings#index") end it "routes to #new" do expect(:get => "/ad_bookings/new").to route_to("ad_bookings#new") end ...
# Write an RSpec test for an array with 2 elements. # Declare the subject to be [1, 2]. # Write an example that uses expect(subject) to test whether the array is equal to [1, 2]. # Write an example that uses the one-liner is_expected syntax. # Which do you prefer? RSpec.describe Array do subject(:arr) do [1, 2] ...
require_relative 'spec_helper' require 'rugged' #TODO rugged stuff should be refactored out into an external mushin-ext to be used with others as well. #TODO developing exts is like developing methods, first you put all one place then refactor out based on common sense. describe "Gitlapse" do before do #`rm -rf ...
class RemovePlayerIdFromPenalties < ActiveRecord::Migration[5.1] def change remove_column :penalties, :player_id, :integer remove_column :penalties, :referee_id, :integer remove_column :penalties, :match_id, :integer end end
class Prompt < ActiveRecord::Base attr_accessible :category_type, :description, :rating_id, :requirements has_many :party_type_prompts, dependent: :destroy has_many :party_types, through: :party_type_prompts has_many :event_prompts, dependent: :destroy belongs_to :rating validates :description, presence: ...
#!/usr/bin/ruby def meepmeep() puts 'Meep meep!' end meepmeep()
require 'rails_helper' RSpec.describe "FundingRounds", type: :request, js: true do describe 'Ananonymous User' do before(:each) do @funding_round = FactoryGirl.create :funding_round visit funding_rounds_path expect(page).to have_selector(get_html_id(@funding_round)) expect(page).to_not h...
Rails.application.routes.draw do get 'welcome/index' resources :dir_strs do resources :file_strs end # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'dir_strs#index' end
cask "luna-secondary" do version "4.5.0" sha256 "38fca2cafa45cc08d12dedf5973850b1dcf99f35ab20428927ca4fa7c6a91dda" url "https://s3.amazonaws.com/s3.lunadisplay.com/downloads/LunaSecondary-#{version}.dmg", verified: "s3.amazonaws.com/s3.lunadisplay.com/" name "Luna Secondary" desc "Turn a computer or ta...
module AnalyticsLogger module Error BadVersionError = Class.new(StandardError) MissingParamsError = Class.new(StandardError) BadTokenError = Class.new(StandardError) end end
require 'spec_helper' describe StudiosHelper do describe ".copyright_for" do let(:studio) { Factory.build :studio, :copyright_notice => "abc" } it "doesn't blow up when passed an empty template" do studio.copyright_notice = "" helper.copyright_for(studio).should == "\n" end it "runs the...
class CreateData < ActiveRecord::Migration def change create_table :data do |t| t.string :campaign_name t.integer :impressions t.integer :clicks t.float :cost t.timestamp :timestamp t.timestamps null: false end end end
class StaticPagesController < ApplicationController caches_page :show def show @page = @static_pages_list.select {|p| p.permalink == params[:permalink]}.first end end
gem 'minitest' require 'minitest/autorun' require 'minitest/pride' require './lib/enumerable_method' require './lib/test_suite' class TestSuiteTest < Minitest::Test def test_suite_with_each suite = TestSuite.new(:group_by, :each, []) assert_equal "GroupByPatternTest", suite.name assert_equal "group_by_pa...
#!/usr/bin/env ruby require 'rubygems' require 'bundler/setup' $:.unshift(File.dirname(__FILE__)) require 'TestSetup' require 'MockPGconn' class SavepointTest < Test include SqlPostgres include TestUtil def testSuccess Connection.mockPgClass do connection = Connection.new assertEquals(MockPGc...
# frozen_string_literal: true require 'spec_helper' RSpec.describe Robots::DorRepo::Dissemination::Cleanup do subject(:robot) { described_class.new } let(:druid) { 'druid:bb222cc3333' } let(:process) { instance_double(Dor::Workflow::Response::Process, lane_id: 'default') } describe '#perform' do let(:ob...
class ApplicationMailer < ActionMailer::Base default from: 'no-reply@test-guru.com' layout 'mailer' end
class Pin < ActiveRecord::Base belongs_to :user belongs_to :board has_many :tags has_many :captions, through: :tags end
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_filter :authorize def authorize if session[:user_id] && user = User.find_by_id(session[:user_id]) ...
class Apm < ActiveRecord::Base has_many :teamleads has_many :projects belongs_to :employ end
require 'spec_helper' describe StoryCommit do let(:command) { StoryCommit.new(['-m', 'msg', '-a', '-z', '--foo']) } before { command.stub(:story_branch).and_return('62831853-tau-manifesto') } subject { command } it { should respond_to(:message) } shared_examples "story-commit with known options" do su...
require 'test_helper' class Publish::GetStocksControllerTest < ActionController::TestCase include Devise::TestHelpers def setup @foreigner = publishers(:jane) @publisher = publishers(:john) @publisher.confirm! sign_in @publisher end test 'a bare proper index page' do get :index, :publishe...
class AddColumnsToProgram < ActiveRecord::Migration def change add_column :programs, :rec_childcare, :boolean add_column :programs, :ward, :integer add_column :programs, :class_computer_literacy, :boolean add_column :programs, :hours_per_week, :integer add_column :programs, :rec_night_classes, :bo...
class Building < ActiveRecord::Base has_many :building_users has_many :posts end
module MDB class Status < ActiveRecord::Base attr_accessible :title, :short validates_presence_of :title, :short before_create :set_short def to_s title end private def set_short self.short = title.downcase if self.short.empty? end en...
# frozen_string_literal: false require_relative "rss-testcase" require "rss/maker" module RSS class TestSetupMaker09 < TestCase def test_setup_maker_channel title = "fugafuga" link = "http://hoge.com" description = "fugafugafugafuga" language = "ja" copyright = "foo" managin...
class SessionsController < ApplicationController before_action :ensure_signed_in, only: [:destroy] def new @user = User.new render :new, locals: {user: @user} end def create if session_params[:username] == "ReddundancyGuest" login_as_guest! redirect_to "/" and return end @user ...
class JudgesController < ApplicationController def index if params[:query].present? @judge = Judge.search(params[:query]) else @judge = Judge.paginate(:page => params[:page], :per_page => 20) end end def show @judge = Judge.find(params[:id]) end def create @judge = Judge.new...
require "authclient/version" require "httparty" module Authclient include HTTParty base_uri "http://olacaretest.olacabs.com:8888/v1" def self.current_session_info(session_id) if session_id user_info = self.info(session_id) return user_info ? user_info : false else return false end ...
require_relative 'highest_product' require 'minitest/autorun' require 'minitest/pride' class HighestProductTest < Minitest::Test def setup @hp = HighestProduct.new end def test_HighestProduct_exits assert HighestProduct end def test_returns_highest_product integers = [1, 4, 3, 2] assert_e...
require 'player' describe Player do subject(:mara) { Player.new('Mara') } subject(:harry) { Player.new('Harry') } describe '#name' do it 'returns name' do expect(mara.name).to eq 'Mara' end end describe '#hit_points' do it 'returns the hit points' do expect(harry.hit_points).to eq de...
class Membership < ActiveRecord::Base validates :beer_club_id, uniqueness: {scope: :user_id, message: "you are already a member"} belongs_to :user belongs_to :beer_club end
# == Schema Information # # Table name: hobbies # # id :integer not null, primary key # name :string(255) # description :text # created_at :datetime # updated_at :datetime # require 'spec_helper' describe Hobby do it { should respond_to :name } it { should respond_to :description }...
pg_ver = input('pg_version') pg_dba = input('pg_dba') pg_dba_password = input('pg_dba_password') pg_db = input('pg_db') pg_host = input('pg_host') pg_log_dir = input('pg_log_dir') pg_audit_log_dir = input('pg_audit_log_dir') control "V-72947" do title "PostgreSQL must be able to generate audit records when p...
require 'rails_helper' RSpec.describe Hostname, type: :model do it "is valid with hostname" do expect(Hostname.new(hostname:"teste.com")).to be_valid end it "is not valid without hostname" do expect(Hostname.new).to_not be_valid end end
#!/usr/bin/env ruby require_relative 'CompositeExpression' class ConjunctiveExpression < CompositeExpression def satisfied? res = true @expressions.each do |expr| res = (res and expr.satisfied?) end res end def to_s s = "conjunction:\n\t" @expr...
class Image include Mongoid::Document include Mongoid::Paperclip include Rails.application.routes.url_helpers field :event_id, type: Integer attr_accessible :image belongs_to :event has_mongoid_attached_file :image def to_jq_upload { "name" => read_attribute(:image_file_name), "size" => ...
class Docker < Thor desc 'update_odania_gem', 'updates odania gem' def update_odania_gem directory = File.join $git_folder, 'odania-gem' require File.join(directory, 'lib', 'odania', 'version.rb') puts "Building odania gem (#{Odania::VERSION})" `cd #{directory} && rake build` gem_file = File.join directory...
class Node include Comparable attr_accessor :data, :left_child, :right_child def initialize(data) @data = data @left_child = nil @right_child = nil end def <=>(other_node) @data <=> other_node.data end end class Tree attr_accessor :root, :ary def initialize(ary) @ary = ary @ro...
require 'RedCloth' class String def to_html RedCloth.new(self).to_html end def wiki_link self.gsub(/\s+([A-Z][a-z]+[A-Z][A-Za-z0-9]+)\s+/) do |page| unless Page.by_name(page).empty? %Q{<a class="existing_link" href="/#{page}">#{page}</a>} else %Q{<a class="nonexisting_link" ...
class PointsController < ApplicationController def next @point = Point.find(params[:pt_id]) @options = @point.options.order(:order).to_json @return = { :options => @options, :dataType => "text", :status_code =>"200", :success => "success", :error => false, :response => "Added", :partial => render_to_st...
# frozen_string_literal: true require "spec_helper" require_relative "./validator_helpers" describe GraphQL::Schema::Validator::NumericalityValidator do include ValidatorHelpers expectations = [ { config: { less_than: 10, greater_than: 2, allow_null: true }, cases: [ { query: "{ validated(...
class TokenAuthMiddleware < Faraday::Middleware attr_reader :klass, :app def initialize(app, klass) super(app) @klass = klass end def call(environment) environment[:request_headers]['Authorization'] = "Token token=#{@klass.auth_token}, email=#{@klass.email}" @app.call(environment) end end
# == Schema Information # # Table name: notas_pedidos # # id :integer not null, primary key # numeroserie :string # fecha :date # created_at :datetime not null # updated_at :datetime not null # class NotaPedido < ActiveRecord::Base has_many :detalles, as: :detallable, c...
# == Schema Information # Schema version: 20110223063317 # # Table name: events # # id :integer not null, primary key # name :string(255) # occur_type :string(255) # location :string(255) # start_date_time :datetime # end_date_time :datetime # all_day :boolea...
class FuturesController < ApplicationController # before_filter UserAuthTokenVerifier include UserAuthTokenVerifier def grid user = params[:user_id] futures = Future.where(user_id: user) render json: futures end def scan user = params[:user_id] risks = Future.where(user_id: user) r...
class CreateActivityTables < ActiveRecord::Migration def self.up create_table :activities do |t| t.belongs_to :done_by t.string :name t.datetime :created_at end add_index :activities, :done_by_id create_table :versions do |t| t.belongs_to :trackable, :polymorphic => true ...
module PUBG class Match class Telemetry attr_reader :name, :description, :createdAt, :URL def initialize(args) @name = args["attributes"]["name"] @description = args["attributes"]["description"] @createdAt = args["attributes"]["createdAt"] @URL = args["attributes"]["URL"] end end end end
RSpec.describe Response::Failure do describe '.call' do let(:subject) { Response::Failure.new(errors) } let(:errors) { ['an error occured'] } describe '#success?' do it 'returns false' do expect(subject.success?).to be false end end end end
class Problem_two attr_accessor :problem_two def inialize @problem_two = [1,2] end def sum (x, num) (x + num) end def problem_two_iterator () while < |totalmax| x + num = sum x.each { |num| sum += num if num.even? } if sum.even? problem_two << 'The sum of even numbers is #{su...
require 'spec_helper' describe "social_networks/index.html.slim" do before(:each) do client = assign(:client, stub_model(Client, :name => "Client Name", :id => 1)) Client.stub(:find).and_return(client) info_social_network = assign(:info_social_network, stub_model(InfoSocialNetwork, :name => 'Info Social...
require "./display" class RandomDisplay < Display def initialize(impl:) super(impl: impl) end def random_display(times:) open display_count = rand(1..times) display_count.times do |time| print end close end end
class SectionsController < ApplicationController before_action :fetch_standard def index @sections = @standard.sections.all end def new @section = @standard.sections.new end def create @section = @standard.sections.new(section_params) if @section.save flash[:success] = "Successfully...
# frozen_string_literal: true require 'spec_helper' require 'bolt_server/config' describe BoltServer::Config do let(:configdir) { File.join(__dir__, '..', 'fixtures', 'server_configs') } let(:missingconfig) { File.join(configdir, 'non-existent.conf') } let(:emptyconfig) { File.join(configdir, 'empty-bolt-server...
require 'gdata' class YoutubeVideo < ActiveRecord::Base belongs_to :campaign validates_presence_of :title validates_presence_of :youtube_id CLIENT = GData::Client::YouTube.new BASE_URL = "http://gdata.youtube.com/feeds/api/videos/" def xml_data CLIENT.get(BASE_URL + "#{self.youtube_id}").to...
class TestSuitesController < ApplicationController before_filter :find_suite, :only => [:show, :edit, :update, :destroy, :associate, :dissociate, :execute, :archive, :unarchive, :enable, :disable] before_filter :authorize_global helper :tests def new @suite = TestSuite.new render :form end def c...
# frozen_string_literal: true module BoltSpec module Plans class UploadStub < ActionStub def matches(targets, _source, destination, options) if @invocation[:targets] && Set.new(@invocation[:targets]) != Set.new(targets.map(&:name)) return false end if @invocation[:destina...
RSpec.describe NxtPipeline::Pipeline do CustomError = Class.new(ArgumentError) OtherCustomError = Class.new(CustomError) context 'when there are no errors' do subject do NxtPipeline.new do |pipeline| pipeline.constructor(:service) do |word, step| step.to_s = step.argument.name ...
module JsonTableSchema module Data attr_reader :errors def cast_rows(rows, fail_fast = true, limit = nil) @errors ||= [] parsed_rows = [] rows.each_with_index do |r, i| begin break if limit && (limit <= i) r = r.fields if r.class == CSV::Row parsed_row...
require 'test_helper' class ChatSessionTest < ActiveSupport::TestCase test 'Create a simple ChatSession' do chat_session = ChatSession.new( user: users(:admin), bot: bots(:weather_bot) ) assert chat_session.save end test 'locale validation' do chat_session = ChatSession.new( ...
require 'rubygems' Gem::Specification.new { |s| s.name = "rationalize" s.version = "0.0.1" s.date = "2012-10-01" s.author = "Shugo Maeda" s.email = "shugo@ruby-lang.org" s.homepage = "http://github.com/shugo/rationalize" s.platform = Gem::Platform::RUBY s.summary = "Refinement version of mathn" s.file...
module Oshpark class Address REQUIRED_ARGS = %w|name address_line_1 address_line_2 city country| def self.attrs %w| name company_name address_line_1 address_line_2 city state zip_or_postal_code country phone_number is_business | end include Model attrs.each {|a| attr_accessor a } def ...
class ApplicationController < ActionController::Base protect_from_forgery with: :exception protected def shopping_cart @cart ||= begin session[:cart] = {} unless session[:cart] ShoppingCart.new(session) end end def save_cart_state shopping_cart.build_from_params(params) end # O...
RSpec.describe 'CMS sign in' do let!(:admin_user) { create :admin_user, email: 'test@example.com', password: '11111111' } before do visit '/admin/login' fill_in 'Email', with: email fill_in 'Password', with: password end context 'with OK credentials' do let(:email) { admin_user.email } let...
class Message < ActiveRecord::Base validates_presence_of :body,:on=>:create, :if =>Proc.new{|message| message.message_attachments_attributes.nil?}, :message=>"#{t('message_blank')}" xss_terminate belongs_to :message_thread belongs_to :sender, :class_name => 'User' has_many :message_recipients, :dependent=>...
class Correntista < ActiveRecord::Base # has_one :user has_many :contas, :class_name => "Conta" validates_associated :contas validates_presence_of :cpf, message: ("não pode ficar em branco") with_options :allow_blank => false do |v| v.validates_presence_of :nome, message: ("não pode ficar em branco") ...
class Long < Contract def self.multiplier 1 end end
class Comment class CreateOrUpdateFromPayload method_object :payload def call comment = find_or_initialize comment.commit_sha = payload.fetch(:commit_id) comment.payload = payload comment.json_payload = payload.to_json comment.author = create_or_update_author comment.save!...
# frozen_string_literal: true module GoogleServicesHelper delegate :ad_client, :analytics_tracking_id, to: "Rails.application.config.x.google" end
require 'spec_helper' describe Stack do subject(:stack) { described_class.new(size) } describe 'with one space' do let(:size) { 1 } it 'add the element' do subject.push(1) expect(subject.top).to eq(1) end end describe 'without space' do let(:size) { 0 } it 'rejects to add an...
=begin Write your code for the 'Hamming' exercise in this file. Make the tests in `hamming_test.rb` pass. To get started with TDD, see the `README.md` file in your `ruby/hamming` directory. =end class Hamming def self.compute(a, b) raise ArgumentError if a.length != b.length (0..a.length-1).map{|i| a[i] ==...
class Mashable def initialize @resource = (Service.new("http://mashable.com/stories.json")).resource end def get_news news = [] @resource['new'].each do |item| news << FilterNews.new(item) end news end private class FilterNews attr_reader :title, :author, :date, :url, :source def initialize...
require "q/version" require "q/callback" require "q/defer" require "q/promise" module Q def self.defer(&block) defer = Q::Defer.new block.call(defer) defer.promise end def self.when(promises) defer = Q::Defer.new @results = [] promises.each do |promise| promise.then do |result|...
module Logical::Naf module LogParser class Runner < Base attr_accessor :invocations_ids def initialize(params) super(params) @invocations_ids = {} end def logs retrieve_logs end private def insert_log_line(elem) output_line = "<span><p...
class CreateFinanceFeeDiscounts < ActiveRecord::Migration def self.up create_table :finance_fee_discounts do |t| t.references :finance_fee_particular, :null => false t.references :finance_fee, :null => false t.references :fee_discount, :null => false t.decimal :discount_amount, :precision ...
class CreateGamesTeams < ActiveRecord::Migration def self.up create_table :games_teams, :force => true do |t| t.references :games t.references :teams end end def self.down drop_table :games_teams end end
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'fileutils' require 'nokogiri' module TwitterCldr module Resources class AliasesImporter < Importer # only these aliases will be imported ALIAS_TAGS = %w(languageAlias territoryAlias zoneAlias) ...
class RenameSearchHistoryToSearch < ActiveRecord::Migration[5.1] def change rename_table :search_histories, :search end end
# frozen_string_literal: true module MetaBuilder class Paginate < BaseOperation def call(collection) { current_page: collection.current_page, next_page: collection.next_page, prev_page: collection.prev_page, page_count: collection.page_count, record_count: collection...
require 'spec_helper' require 'auctionet/client' describe Auctionet::Client do subject(:client) { Auctionet::Client.new } describe "#fetch" do before(:each) do sample = File.read "spec/assets/items.json" allow(client).to receive(:perform_request).and_return sample end it "fetch items" do ...
# Encoding: utf-8 # Report /etc/pam.d configurations Ohai.plugin(:Pam) do depends 'etc' provides 'etc/pam' def parse_pam_files response = {} files = Dir.glob('/etc/pam.d/*').select { |f| !File.directory? f } files.each do |file| name = File.basename(file) response[name] = [] so = s...
class StockItem < ApplicationRecord validates :name, :price, presence: true belongs_to :store end
class UpdateProductQuantityFromStringToInt < ActiveRecord::Migration[5.1] def change change_column :products, :quantity, 'integer USING CAST(products.quantity AS integer)' end end
module CacheHelpers ActionController::Base.public_class_method :page_cache_path class CacheMatcher def initialize(method = :cached?) @method = method end def matches?(actual) (@actual = actual).send @method end def failure_message "Expected path #{@actual.inspect} ...
class Doc < ActiveRecord::Base has_many :doc_items, dependent: :destroy after_update :delete_doc_items def doc_text docs = Doc.last[:file] docs end def information distribution = {DocItem::TYPE_INPUT_CALL => [], DocItem::TYPE_OUTPUT_CALL => [], DocItem::TYPE_INPUT_SMS => [],...
class SendgridForm include ActiveModel::Model attr_accessor :first_name, :last_name, :email validates :email, email: true validates_presence_of :first_name, :email def subscribe return false unless valid? result = create_recipient result['persisted_recipients'].each do |recipient_id| add_t...
class NewUser < User self.table_name = "users" before_save :downcase_email before_save :downcase_mysizeid validates :password, presence: { message: "Passwordを入力してください" }, length: { minimum: 6, message: "Passwordは6文字以上で入力してください", ...
require 'rails_helper' RSpec.describe Customer, :type => :model do include ModelHelper let(:new_customer) { Customer.new } it 'Customer class exists' do expect(class_exists?(Customer)).to eq(true) end it 'Type should equal to Customer' do expect(new_customer.type).to eq('Customer') end it ' has...
class RemoveNotNullConstraintFromEventTime < ActiveRecord::Migration def up change_column :events, :event_time, :time, :null => true end def down change_column :events, :event_time, :time, :null => false end end
CATEGORIES_COUNT = SELLERS_COUNT = MANOFACTURERS_COUNT = 8 PRODUCTS_COUNT = 500 Faker::Config.random = Random.new(42) ActiveRecord::Base.transaction do # clears all Product.destroy_all [Category, Manofacturer, Seller].each(&:delete_all) # create categories categories = [] CATEGORIES_COUNT.times do ca...
class Product < ActiveRecord::Base belongs_to :user has_many :purchases has_many :buyers, through: :purchases has_attached_file :image, :styles => { :preview => "600x600#", :comic => "300x425#", :medium => "300x300>", :thumb => "100x100#" } validates_attachment_content_type :image, :content_type => ["image/jpg"...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable ROLES = %w[building_owner company_owner worker] val...
require_relative '../../lib/google_calendar_helper' class EventsController < ApplicationController before_action :authenticate_user!, except: [:index, :show, :translate] before_action :find_event, only: [:show, :edit, :update, :destroy] before_action :get_categories, only: [:new, :create, :edit, :update] befor...