puts '我开心就好'
puts '我开心就好'
puts '我开心就好'
#5 @adamshen 3l delete 了
今天我也遇到了这个问题,解决方法
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
成功治好了我的颈椎病
gem uninstall mysql2 gem install mysql2 可能会解决这个问题
已投简历,期望回复
已投简历,期望回复
save 和 save! 的区别在于,save! 保存失败会抛出异常,save 保存失败结果是 false。你的问题不太清楚
def save(*)
create_or_update
rescue ActiveRecord::RecordInvalid
false
end
# File activerecord/lib/active_record/persistence.rb, line 141
def save!(*)
create_or_update || raise(RecordNotSaved.new("Failed to save the record", self))
end
# File activerecord/lib/active_record/persistence.rb, line 260
def update!(attributes)
# The following transaction covers any possible database side-effects of the
# attributes assignment. For example, setting the IDs of a child collection.
with_transaction_returning_status do
assign_attributes(attributes)
save!
end
end
update! 调用了 save! 方法,如果保存失败 save! 方法会抛出异常,如果有说明错误的地方请指正。