Skip to content

Instantly share code, notes, and snippets.

use strict;
use warnings;
use LWP::UserAgent;
use File::Slurp;
use POSIX qw//;
my $ua = LWP::UserAgent->new;
my $resolv_conf_localhost = <<EOF;
class Sample2 < ActiveRecord::Base
validate :check_start_date_and_end_date
def check_start_date_and_end_date
if start_date.nil?
errors.add(:start_date, "start date should not be nil")
end
if end_date.nil?
errors.add(:end_date, "end date should not be nil")
end
def check_date
errors.add(:start_date, '開始時刻を入力してください') if start_date.nil?
errors.add(:end_date, '終了日を入力してください') if end_date.nil?
return unless errors.empty?
check_start_date_before_end_date(start_date, end_date)
check_start_date_and_end_date_gap(start_date, end_date)
end
def check_start_date_before_end_date(start_date, end_date)
column "campaign name" do |resource|
c = Campaign.where(id: resource.campaign_id)
c.first.name if c.exists?
end
@zentooo
zentooo / 1
Created June 2, 2023 00:34
1
1