text
stringlengths
10
2.61M
class WodController < ApplicationController layout 'nav' def new @wod = Wod.new @gym = current_user.gym @workouts = current_user.gym.workouts.map{ |group| [group.name, group.id]} end def create @wod = Wod.new(wod_params) if @wod.save! flash[:notice] = "Your Popup Workout is ready to go!" ...
class Concern < ApplicationRecord has_many :user_concern has_many :users, through: :user_concerns end
class CreateQualifications < ActiveRecord::Migration def change create_table :qualifications do |t| t.references :user t.references :agency t.boolean :is_qualified t.integer :qualified_rent_amount t.integer :voucher_amount t.timestamp end end end
require 'citrus' class Contact attr_accessor :name, :address, :phone end class AddressBook def contacts @contacts ||= [] end end module InnerText def value matches[1].text end end # Load the grammar file. Citrus.load(File.expand_path('../addressbook', __FILE__)) if $0 == __FILE__ require 'test/...
class HouseholdsController < ApplicationController before_action :set_household, only: [:show, :edit, :update, :destroy, :add_service_provider, :create_user, :external_view, :schedule_sitter ] before_filter :authenticate_user! authorize_resource except: [:external_view] # GET /ho...
require './graph' RSpec.describe Graph do before(:all) do file = "test.data" @graph = Graph.new(file) end describe "#New" do it "Creates Graph Object" do correct_response = Graph test_response = @graph.class expect(test_response).to eq(correct_response) end end describe "#R...
require 'rails_helper' RSpec.describe CheckWebsiteJob, type: :job do let(:website) { build(:website) } it 'calls Services::CheckWebsite#call' do expect(Services::CheckWebsite).to receive(:call).with(website) CheckWebsiteJob.perform_now(website) end end
require "spec_helper" describe BuddhasController do describe "routing" do it "routes to #index" do get("/buddhas").should route_to("buddhas#index") end it "routes to #new" do get("/buddhas/new").should route_to("buddhas#new") end it "routes to #show" do get("/buddhas/1").shou...
# == Schema Information # # Table name: auctiontags # # id :bigint not null, primary key # created_at :datetime not null # updated_at :datetime not null # auction_id :bigint # tag_id :bigint # # Indexes # # index_auctiontags_on_auction_id (auction_id) # index_auctiontags_on...
# Require the dependencies file to load the vendor libraries require File.expand_path(File.join(File.dirname(__FILE__), 'dependencies')) class VmwareVsphereVirtualmachineCheckstatusV1 # Include the necessary Java classes to be used for this handler include_class java.net.URL include_class com.vmware.vim25.mo.Fol...
puts "Digite o nome do restaurante" nome = gets #Interpolação de Strings #Declaração da variável %%nome%% print "Nome do restaurante: #{nome.capitalize}" #puts nome
class Tag < ApplicationRecord has_many :types has_many :gossips, through: :types end
require 'puppet/provider/rbac_api' Puppet::Type.type(:rbac_role).provide(:ruby, :parent => Puppet::Provider::Rbac_api) do desc 'RBAC API provider for the rbac_role type' mk_resource_methods def self.instances Puppet::Provider::Rbac_api::get_response('/roles').collect do |role| Puppet.debug "RBAC: Ins...
class RegistrationsController < ApplicationController def new @user = User.new end def create @user = User.create(user_params) if @user.save == true redirect_to user_path(@user) session[:user] = @user.id flash[:notice] = "You have successfully been signed up" else render :new end end pri...
class TicketStatuses::FormDataSerializer < ApplicationSerializer object_as :ticket_status attributes :name end
class MonthlyInterestsController < ApplicationController before_filter :authenticate_user! #load_and_authorize_resource # GET /monthly_interests # GET /monthly_interests.json def index @monthly_interests = MonthlyInterest.all respond_to do |format| format.html # index.html.erb format.jso...
require_relative "../get_servers" require "test/unit" require "ipaddr" require "yaml" Constraints = Struct.new(:count, :limit, :fd_choice, :ru) # provide a mock error for tests module Vagrant module Errors class VagrantError < Exception end end end class TestConstraints < Test::Unit::TestCase def setup spec...
class GatherRecipes::Scraper def self.scrape_categories page = Nokogiri::HTML(open("https://www.halfbakedharvest.com/category/recipes/")) categories = page.css("ul.children li")[11..14] categories.each do |c| name = c.css("a").text GatherRecipes::Categ...
module Foursquare class TipProxy def initialize(foursquare) @foursquare = foursquare end def find(id) Foursquare::Venue.new(@foursquare, @foursquare.get("tips/#{id}")["tip"]) end def search(options={}) raise ArgumentError, "You must include :ll" unless options[:ll] @fours...
# exercise_6.rb words = ['demo', 'none', 'tied', 'evil', 'dome', 'mode', 'live', 'fowl', 'veil', 'wolf', 'diet', 'vile', 'edit', 'tide', 'flow', 'neon'] def anagrams(array) result = {} array.each do |value| key = value.split('').sort.join if result.has_key?(key) result[key]...
require 'rails_helper' RSpec.describe "settings/show", type: :view do before(:each) do @setting = assign(:setting, Setting.create!( :id => "", :nama_aplikasi => "Nama Aplikasi", :email_default => "Email Default", :alamat => "MyText", :default_password => "Default Password", :z...
require 'spec_helper' describe "StaticPages" do subject { page } describe "Home page" do before do mock_geocoding! @team = FactoryGirl.create(:team) Team.stub(:find).and_return(@team) theTailgate = FactoryGirl.create(:tailgate, team:@team, official:true) visit root_path ...
class Comment < ApplicationRecord belongs_to :gossip belongs_to :user has_many :comments, as: :commentable #permet de creer des commentaires polymorphiques pour pouvoir commneter des commentaires has_many :likes end
class DataRunner::Base def initialize(widget) raise TypeMismatchError unless self.class.works_with?(widget.class) @widget = widget end def update raise NonImplementedError end def self.possible_widgets [] end def self.works_with?(widget) if self.possible_widgets.include?(wi...
module CommentsHelper include ContentHelper include ActionView::Helpers::DateHelper include ActionView::Helpers::TextHelper def build_comment_tree(comments) comments.map do |comment| comment_as_json(comment) end end def child_tree(comment) comment.children.collect do |child| commen...
class QuestionsController < ApplicationController before_action :authenticate_user! before_action :find_question, except: [:index, :show, :create] def destroy @question.destroy render json: { message: 'Question successfully destroyed' }, status: :ok end private def find_question @question ...
require 'fileutils' class AssetsController < ActionController::Base if Assetify.cache_mode == 'page' caches_page :show caches_page :dynamic end def show response.headers['Cache-Control'] = 'public, max-age=43200' # Cache for 12 hours respond_to do |wants| wants.js do rend...
module Log2Carbon module Configuration def self.check_connection_to_carbon!(server) begin Socket.getaddrinfo(server[:address],nil) if server[:protocol]==:udp carbon_socket = UDPSocket.new carbon_socket.connection(server[:address], server[:port]) carbon_socket.cl...
class AddFoodToRestaurants < ActiveRecord::Migration def change add_reference :restaurants, :food, index: true add_foreign_key :restaurants, :foods end end
require 'chef-rundeck/node' describe ChefRundeckX::Node do it 'converts array to string in update' do n = ChefRundeckX::Node.new() n.update({ 'name' => 'server.example.com', 'chef_environment' => 'development', 'roles' => [ 'role1', 'role2' ], 'tags' => [ 'tag1', 'tag2'] }) ...
# 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...
# -*- encoding : utf-8 -*- class AddDietitianIdToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :dietitianID, :integer end end
require 'rails_helper' RSpec.describe Content, type: :model do describe 'content新規登録' do before do user = FactoryBot.create(:user) @content = FactoryBot.build(:content, user_id: user.id) end context '内容に問題ない場合' do it 'すべての値が正しく入力されていれば保存できること' do expect(@content).to be_valid ...
ActiveAdmin.register Transaction do menu label: 'Transactions' scope :all scope :pending scope :not_pending scope :paid scope :not_paid permit_params :paid filter :id, label: 'Transaction ID' filter :user_id, label: 'User ID' filter :vendor_id, label: 'Vendor ID' index do selectable_colum...
#Pour chaque partie, nous aurons 2 joueurs. #Le joueur a un nom, un variable (true ou false) disant si c'est ou non à lui de jouer, #Ainsi qu'un variable indiquant si le joueur a gagné ou non (là aussi true ou false). #Le premier booléen nous permet de créer une seule fonction pour le tour du joueur 1 ou 2. #Le deuxiè...
# frozen_string_literal: true Pod::Spec.new do |s| s.name = 'CRRefresh' s.version = '2.0.0' s.summary = 'An easy way to use pull-to-refresh' s.homepage = 'https://github.com/CRAnimation/CRRefresh' s.license = 'MIT' s.author = { 'W_C__L' => 'wangchonglei93@icloud.com' ...
# == Schema Information # Schema version: 57 # # Table name: videos # # id :integer(11) not null, primary key # user_id :integer(11) # name :string(255) # description :string(255) # university :string(255) # class_number :string(255) # professor :s...
class CreateAreasSupplementals < ActiveRecord::Migration def up create_table :areas_supplementals, :id => false do |t| t.integer :area_id t.integer :supplemental_id end end def down drop_table :areas_supplementals end end
class AddExternalIdToTestScenario < ActiveRecord::Migration[5.0] def change add_column :test_scenarios, :dev_external_id, :string add_column :test_scenarios, :qa_external_id, :string add_column :test_scenarios, :stg_external_id, :string end end
class AddSettingTypeToUserOauths < ActiveRecord::Migration def change #默认是绑定用户 add_column :user_oauths, :setting_type, :integer, :limit => 3, :default => APP_DATA['user_oauths']['setting_type']['binding'] end end
class CommentsController < ApplicationController before_action :set_comment, only: [:show, :edit, :update, :destroy] # GET /comments # GET /comments.json def index @comments = Comment.all end # GET /comments/1 # GET /comments/1.json def show end # GET /comments/new def new @comment = Co...
module DNSimple module Tinydns class Record attr_reader :name attr_reader :content attr_reader :ttl def initialize(name, content, ttl=3600) @name = name @content = content if ttl.nil? or ttl == '' @ttl = 3600 else @ttl = ttl.to_i ...
class Exemplar < ActiveRecord::Base scope :with_nome_vulgar, lambda {|parameter| where('nome_vulgar like ?', "%#{parameter}%")} #Equivalente a: SELECT exemplars.nome_vulgar, filos.descricao FROM exemplars INNER JOIN filos ON exemplars.filo_id = filos.id ORDER BY filos.descricao #scope :filos, joins("filos").o...
class Stuff < ActiveRecord::Migration def change remove_column :isolates, :sensitivities end end
class Stack def initialize @stack = [] end def add(el) @stack << el end def remove @stack.pop end def show @stack.dup end end class Queue def initialize @queue = [] end def enqueue(el) @queue.unshift(el) end def dequeue @queue.pop end def show @que...
class PlayerstatsController < ApplicationController before_filter :authenticate_user!, :only => [:new, :create, :destroy] def new @title = "New Playerstat" @game = Game.find(params[:game_id]) @playerstat = Playerstat.new(:game_id => @game.id, :teamstat_id => params[:teamstat_id]) end def create ...
FactoryBot.define do factory :user do nickname {"test"} email {Faker::Internet.email} password {"00000000"} last_name {"テスト"} first_name {"テスト"} last_name_kana {"テスト"} first_name_kana {"テスト"} birthday ...
module ControllersHelper def valid_model_attrs(model, parent = nil) FactoryBot.attributes_for model, ancestr(parent) end def ancestr(parent) # TODO: Fix memoization helper # @last_parent ||= parent # @ancestr ||= create_parent parent create_parent parent end def invalid_model_attr(model,...
class FollowingActivity < Activity belongs_to :trackable, :class_name => "Following" end
module TinyCI module Shell class CommandExecutionFailed < StandardError end end end
class AddSidesToPages < ActiveRecord::Migration def change add_column :pages, :side, :string add_column :pages, :other_side, :string end end
require 'Minitest/autorun' # require "minitest/reporters" # Minitest::Reporters.use! require_relative 'cash_register' require_relative 'transaction' class CashRegisterTest < Minitest::Test def setup @register = CashRegister.new(1000) @transaction = Transaction.new(25) @transaction.amount_paid = 50 end...
require 'pg' require_relative 'pg_datasource' class RedshiftDatasource < PgDatasource def set_copy(s3url = @s3url, access_key_id = @access_key_id, secret_access_key = @secret_access_key, schema = @schema, table = @table) @s3url = s3url @access_key_id = access_key_id @secret_access_key = secret_access_key...
# module Shout # def self.yell_angrily(words) # words + "!!!" + " :(" # end # def self.yelling_happily(words) # ":D <3 " + words + " :D <3" + "!!!" # end # end # puts Shout.yell_angrily("WTF?") # puts Shout.yelling_happily("I Love You") module Shout def yell_angrily(angry_words) "%$#@ " + an...
# -*- ruby -*- require 'rubygems' require 'spec/rake/spectask' require 'cucumber/rake/task' require 'rcov/rcovtask' $:.unshift(File.join(File.dirname(__FILE__), 'lib')) task :verify_rcov => [:spec, :features] task :default => :verify_rcov desc "Run all specs" Spec::Rake::SpecTask.new do |t| t.spec_files = FileLis...
class Ball attr_reader :x, :y, :w, :h def initialize(window) @window = window @x, @y = 400, 270 @vx, @vy = 5, 5 @w, @h = 20, 20 @image = Gosu::Image.new(@window, 'ball.png', false) end def draw @image.draw(@x, @y, 1) end def bounce @vx = -1 * @vx end def move @x += @vx @y += @vy if hit_t...
class Api::CardsController < ApplicationController def create @card = Card.new(card_params) @lists = [List.find(card_params[:list_id])] @list_ids = [@lists[0].id] if @card.save! render :show else render :json, @card.errors.full_messages, status: 422 end end def show @bo...
class Integer def prime? case # simple cases for performance when self < 2 then false when self == 2 then true when self == 3 then true when self % 2 == 0 then false when self % 3 == 0 then false #general prime test else test_top = Math.sqrt(self).ceil # get the lowest int...
Rails.application.routes.draw do resources :provinces resources :customers root to: 'finder#index' get 'alphabetized' => 'finder#alphabetized', as: 'alphabetized' get'missing_email' => 'finder#missing_email', as: 'missing_email' end
class CreateMenus < ActiveRecord::Migration def self.up create_table :menus do |t| t.integer :parent_id t.integer :klass t.string :name t.string :desc t.string :icon t.string :link t.integer :pos t.integer :children_count t.integer :lft t.intege...
class DoctorsController < ApplicationController include DoctorsHelper before_action :find_doctor, only: %i[edit update_password show destroy appointments] before_action :redirect_unless_admin, only: :destroy def new @doctor = Doctor.new end def create @doctor = Doctor.new(doctor_par...
require 'test_helper' class PlayerTest < ActiveSupport::TestCase def setup setup_players_and_global end test "player validations" do p = FactoryGirl.build(:player, email: nil) assert !p.save, 'Player was saved without email.' p = FactoryGirl.build(:player, password: 'no matching') assert !...
class Event < ActiveRecord::Base belongs_to :calendar has_and_belongs_to_many :house_members end
Rails.application.routes.draw do # Sessions resources :sessions, only: [:new, :create, :destroy] get 'signin', to: 'sessions#new', as: :signin delete 'signout', to: 'sessions#destroy', as: :signout # Users resources :users do resources :marathons, except: [:show, :index] end get 'signup', to: 'user...
class Order < ApplicationRecord belongs_to :user has_many :dishes, through: :selections has_many :selections, dependent: :destroy monetize :amount_cents end
require "rails_helper" RSpec.describe DestroyeHistoriesController, :type => :routing do describe "routing" do it "routes to #index" do expect(:get => "/destroye_histories").to route_to("destroye_histories#index") end it "routes to #new" do expect(:get => "/destroye_histories/new").to route_...
# frozen_string_literal: true require "lite_cable/version" require "lite_cable/internal" require "lite_cable/logging" # Lightwieght ActionCable implementation. # # Contains application logic (channels, streams, broadcasting) and # also (optional) Rack hijack based server (suitable only for development and test). # # ...
require_relative 'router/route' module Framework class Router attr_reader :routes def initialize @routes = [] end def get(path, handler, path_name) add_route(:get, path, handler, path_name) end def post(path, handler, path_name) add_route(:post, path, handler, path_name) ...
class Admin::SectionsController < Admin::BaseAdminController load_and_authorize_resource before_action :build_sub_sections, only: %i[new edit] def new; end def index @sections = @sections.roots.order(name: 'asc') end def show; end def edit; end def create if @section.save flash[:notic...
class CreateMeds < ActiveRecord::Migration def change create_table :meds do |t| t.string :med_name t.string :dosage t.string :time_of_day t.string :prescriber t.timestamps end end end
class PasswordsController < DeviseTokenAuth::PasswordsController swagger_controller :passwords, "Passwords manager" swagger_api :update do summary "change volunteer's password" param :header, 'access-token', :string, :required, "Your token" param :header, 'client', :string, :required, "Your client tok...
require 'seismograph' module Circuitry module Middleware class Seismograph attr_reader :namespace, :stat def initialize(options = {}) self.namespace = options.fetch(:namespace, 'circuitry') self.stat = options.fetch(:stat) end def call(topic, _message, &block) ta...
# By default, command runs only when story is finished class FinishedCommand < Command def run! check_finishes unless override? system cmd end private # Checks to see if the most recent commit finishes the story # We look for 'Finishes' or 'Delivers' and issue a warning if neither is # in t...
Dado(/^he presionado el botón "(.*?)" del menú principal$/) do |boton| step %{presiono el botón "#{boton}"} end Dado(/^que hay (\d+) grupos creados\.$/) do |cantidad, table| # table is a Cucumber::Ast::Table @groups = Group.create!(table.hashes) assert_equal cantidad.to_i, @groups.count end Entonces(/^veo un ...
class Rack::Attack throttle("logins/email", :limit => 5, :period => 2.minutes) do |req| if req.path == '/login' && req.post? # return the email if present, nil otherwise req.params['email'].presence end end end
require 'rails_helper' describe Interest do it "must have a name" do interest = Interest.new(name: 'TDD') expect(interest).to be_valid end it "should belong to a user" do expect(interest).to belong_to(:user) end end
require "test_helper" class AccountTest < ActiveSupport::TestCase setup do @checking = accounts(:checking) @savings = accounts(:savings) end test "valid account" do assert @checking.valid? assert @savings.valid? end test "invalid without account_type" do @checking.account_type = nil ...
require 'test_helper' class PagesControllerTest < ActionDispatch::IntegrationTest def setup @base_title = "Reggie Barnett's site" end test "should get home" do get root_path assert_response :success assert_select "title", "#{@base_title}" end test "should get projects" do get project...
require 'gosu' White = Gosu::Color.argb(0xFF_FFFFFF) Red = Gosu::Color.argb(0xFF_FF0000) Yellow = Gosu::Color.argb(0xFF_FFFF00) Green = Gosu::Color.argb(0xFF_008000) Azure = Gosu::Color.argb(0xFF_4080FF) Blue = Gosu::Color.argb(0xFF_000080) Black = Gosu::Color.argb(0xFF_000000) class Rect attr_accessor :x,...
# -*- coding: UTF-8 -*- # # Author:: lnznt # Copyright:: (C) 2011 lnznt. # License:: Ruby's # module GMRW module Extension extend self private def mixin(to, &block) #:nodoc: mod = Module.new(&block) dups = to.instance_methods & mod.instance_methods dups.empty? or raise "#{to}: duplicat...
module MinimedRF module PumpEvents class ChangeBolusWizardSetup < Base def self.event_type_code 0x4f end def bytesize 39 end def to_s "ChangeBolusWizardSetup #{timestamp_str}" end def timestamp parse_date(2) end end end end...
json.array!(@users) do |user| json.extract! user, :firstname, :lastname, :conactnumber, :address, :city, :state, :zipcode json.url user_url(user, format: :json) end
class Users::RegistrationsController < Devise::RegistrationsController def new @user = User.new end def create if params[:sns_auth] == 'true' pass = Devise.friendly_token params[:user][:password] = pass params[:user][:password_confirmation] = pass end @user = User.new(sign_up_p...
class Lista include Comparable attr_reader :a, :len attr_writer :a, :len def initialize(a) @a = a @len = @a.length end def to_s @a.to_s end def <=>(arg) self.len <=> arg.len end end list_1 = Lista.new([1,1,1]) list_2 = Lista.new([1,1,1,1]) puts list_1 == list_2 puts list_1 < list...
class CreateClientEarnings < ActiveRecord::Migration def change create_table :client_earnings do |t| t.integer :round_id t.integer :player_id t.integer :client_id t.integer :earning t.integer :fee_payout t.timestamps end end end
# frozen_string_literal: true module Slack class Token attr_reader :value def initialize(params) @value = params[:value] || $app_config.call(:slack_access_token) end end end
class Emo < ApplicationRecord validates :text, presence: true serialize :words_points serialize :words_colors serialize :color end
class OfficialDiary < ActiveRecord::Base audited belongs_to :user belongs_to :sphere has_one :address, :as => :addresstable, dependent: :destroy accepts_nested_attributes_for :address has_many :responsibles, :as => :responsibletable, dependent: :destroy accepts_nested_attributes_for :responsibles, allow_destr...
require 'test_helper' class ParentActivitiesControllerTest < ActionController::TestCase setup do @parent_activity = parent_activities(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:parent_activities) end test "should get new" do get :new...
class Pick < ApplicationRecord belongs_to :entry belongs_to :contestant validates :entry, :contestant, presence: true scope :excluding_contestants, ->(contestant_ids) { where.not(contestant_id: contestant_ids) } end
class MessagesController < ApplicationController def index @messages = Message.all respond_to do |format| format.html # index.html.erb format.json { render json: @messages } end end def new @message = Message.new @request = Request.find(params[:request_id]) respond_to do |fo...
require 'rails_helper' RSpec.describe IncomingWebhooksController, type: :controller do describe '#invoke' do def invoke(command, token, params) @request.headers['Content-Type'] = 'application/json' post 'invoke', params: { token: token }, body: ({ command: command }.merge(params)).to_...
class CreateCategories < ActiveRecord::Migration def change create_table :categories do |t| t.string :type t.string :name t.string :description t.integer :pid, null: false, default: 0 t.timestamps end add_index :categories, [:name, :pid, :type], name: :category_name, uniqu...
require 'spec_helper' require_relative '../../app/models/rating_updater' RSpec.describe RatingUpdater do let(:rating_updater) { RatingUpdater.new(winner_rating, loser_rating) } let(:winner_rating) { 1000 } let(:loser_rating) { 1000 } it "calculates correct ratings ...
PROJECT_ROOT = File.dirname(File.dirname(__FILE__)) require PROJECT_ROOT + "/tools/helpers/sequence_path_iterator" require PROJECT_ROOT + "/tools/helpers/local_b_file" require PROJECT_ROOT + "/tools/helpers/official_b_file" class TestBuilder def initialize(sequence_id, number_of_terms = nil, language = :ruby) r...
Rails.application.routes.draw do root to: 'articles#index' resources :articles do get 'drafts' => 'articles#drafts', on: :collection end resources :users, except: [:new, :create, :edit, :update] resources :invites, only: [:index, :create, :destroy] # Sign up get '/sign_up' => 'users#new', ...
class ConcertSerializer include FastJsonapi::ObjectSerializer attributes :date, :price_range, :upcoming belongs_to :location belongs_to :artist attribute :artist_name do |concert| "#{concert.artist.name}" end attribute :location_json do |concert| { city: concert.location.city, state:...
require 'rails_helper' describe "Valid Event" do it "is valid with name, rsvp, location, paid_event, price, members, language_id" do event = Event.new( name: "bypassing", rsvp: false, location: "Hayleeland, 1241 Johnpaul Groves, 22111-5368", paid_event: false, price: "25.45", ...
require 'rails_helper' RSpec.describe 'カレンダー', type: :system do before do driven_by(:rack_test) end let(:user) { create(:user)} let!(:wasting1) { create(:wasting, user_id: user.id) } let!(:wasting2) { create(:wasting, name: 'お酒', price: 500 , user_id: user.id) } describe '無駄遣い管理' do describe '未ログ...
# show how to remove remote # add in new remote # add delete method # If we have :id in our route, we definitely need to find our object! delete '/posts/:id' do @post = Post.find_by_id(params[:id]) @post.destroy redirect "/posts" end # delete form <h2>Would you like to delete this...