This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AllCheckToggle(){ | |
var target = $("form[name=f] input[type=checkbox]"); | |
var trigger = $("#allCheckToggle"); | |
var event = "change"; | |
this.execute = function() { | |
//checkboxのチェックがトリガーじゃない場合の想定が抜けてる | |
if (trigger.is(':checked')) { | |
this.check(); | |
} else { | |
this.uncheck(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
namespace :migrate do | |
Dir::glob("lib/migration/*.rb").each do |file| | |
target = File.basename(file, ".rb") | |
desc "migration task from \"lib/migration/#{target}.rb\"" | |
task target => :environment do | |
require file | |
klass = target.split("_").map {|word| word.capitalize}.join("") | |
data_source = YAML.load_file(Rails.root.join('config', 'old_migration_database.yml')) | |
data_source.each do |system, ds| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
def detect_env | |
ENV['RAILS_ENV'] || 'development' | |
end | |
def truncate(table) | |
begin | |
case @config["adapter"] | |
when "mysql", "mysql2" | |
ActiveRecord::Base.connection.execute("TRUNCATE #{table}") | |
puts "Table #{table} truncated!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
namespace :seed do | |
Dir::glob("db/seeds/*.rb").each do |file| | |
target = File.basename(file, ".rb") | |
desc 'CRUD operation from "db/seeds/'+target+'.rb"' | |
task target => :environment do | |
require file | |
end | |
end | |
end |