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
| WITH table_scans as ( | |
| SELECT relid, | |
| tables.idx_scan + tables.seq_scan as all_scans, | |
| ( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
| pg_relation_size(relid) as table_size | |
| FROM pg_stat_user_tables as tables | |
| ), | |
| all_writes as ( | |
| SELECT sum(writes) as total_writes | |
| FROM table_scans |
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 :assets do | |
| task :check do | |
| root_dir = File.join(File.dirname(__FILE__),"..","..") | |
| assets_last_modified_at = Dir["#{root_dir}/app/assets/**/**"].map { |p| File.mtime(p) }.sort.last | |
| assets_last_compiled_at = Dir["#{root_dir}/public/assets/**/**"].map { |p| File.mtime(p) }.sort.last | |
| if assets_last_modified_at > assets_last_compiled_at | |
| fail "Assets need to precompiled; last asset modified at #{assets_last_modified_at}" | |
| end | |
| end |
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 :generate do | |
| desc 'Generate a timestamped, empty Sequel migration.' | |
| task :migration, :name do |_, args| | |
| if args[:name].nil? | |
| puts 'You must specify a migration name (e.g. rake generate:migration[create_events])!' | |
| exit false | |
| end | |
| content = "Sequel.migration do\n up do\n \n end\n\n down do\n \n end\nend\n" | |
| timestamp = Time.now.to_i |
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
| # A formtastic input which incorporates carrierwave uploader functionality. | |
| # | |
| # Intelligently adds the cache field, displays and links to the current | |
| # value if there is one, adds a class to the wrapper when replacing an | |
| # existing value, allows removing an existing value with the checkbox | |
| # taking into account validation requirements. | |
| # | |
| # There are several options: | |
| # | |
| # * Toggle the replacement field with `replaceable: true/false`. |
NewerOlder