Method | Uses Default Accessor | Validations | Callbacks | Touches updated_at | Readonly check |
---|---|---|---|---|---|
update | ✅ | ✅ | ✅ | ✅ | ✅ |
update_attributes | ✅ | ✅ | ✅ | ✅ | |
update_columns | ✅ | ||||
User::update | ✅ | ✅ | ✅ | ✅ | ✅ |
User::update_all |
This file contains 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 | |
desc "Convert your database into seeds!" | |
task :export_seeds => :environment do | |
Rails.application.eager_load! | |
models = ObjectSpace.each_object(Class).select { |c| c < ActiveRecord::Base } | |
ignored_keys = %w[created_at updated_at id] | |
models.each do |model| | |
puts "### #{model}s ######################################" |
This file contains 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
QUESTION 6: Write a function multi_gsub that performs multiple, simultaneous | |
search-and-replace operations on a string. | |
Example: | |
"Lorem Ipsum #9191".multi_gsub([[/[a-z]/i, '#'], [/#/, 'P']]) | |
=> "##### ##### P9191" |
This file contains 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
config.gem "rspec", :lib => false | |
config.gem "rspec-rails", :lib => false | |
config.gem "cucumber", :lib => false | |
config.gem "thoughtbot-factory_girl", :lib => false, :source => "http://gems.github.com" | |
config.gem "faker", :lib => false | |
config.gem "carlosbrando-remarkable", :lib => "remarkable", :source => "http://gems.github.com" | |
config.gem "haml" | |
config.gem "webrat" | |
config.gem "htmlentities" | |
config.gem "json" |
This file contains 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
require 'rubygems' | |
# Only load paths from the folder 'gems' under the current | |
# dir - e.g. ./gems/ | |
# To freeze use gem install <name> -i gems | |
Gem.clear_paths | |
File dsl | |
Gem.path.unshift (PWD / 'gems').absolute_path | |
end |