当前位置: 首页 > news >正文

tip

Me No Blog Hella Ugly!

April 10th, 2009
2 comments

Welcome to the 2000’s, self!

I’m ever so excited to be blogging at a blog that not only understands code highlighting, but doesn’t look like it was crafted by a mad scientist with cataracts in 1992. Now it looks more like it was crafted by a mad scientist without cataracts circa 2008 — which is an entirely more accurate representation of the truth.

That’s the good news.

The bad news?  That I have don’t anything meaningful to report in this post.

Maybe I’ll just write some highlighted code instead.

# ---------------------------------------------------------------------------
# options[:except_list]: list of symbols that we will exclude form this copy
# options[:dont_overwrite]: if true, all attributes in from_model that aren't #blank? will be preserved
def self.copy_attributes_between_models(from_model, to_model, options = {})
	return unless from_model && to_model
	except_list = options[:except_list] || []
	except_list << :id
	to_model.attributes.each do |attr, val|
		to_model[attr] = from_model[attr] unless except_list.index(attr.to_sym) || (options[:dont_overwrite] &amp;&amp; !to_model[attr].blank?)
	end
	to_model.save if options[:save]
	to_model
end

相关文章:

  • 关于MySQL备份还原的几种方案
  • DLL导入
  • 机械版CG 附加实验1 中点画线算法
  • N多JPG图片如何转换成PDF文档
  • PHP反射的一些特性
  • 思维导图培训六:思维导图的用途
  • dedecms模版制作使用方法
  • [CCIE历程]CCIE # 20604
  • 关于 TApplication 详解 四 ---- TControl
  • mockcpp testngpp在2010.7~11月的改进
  • 我想了解一下嵌入式软件开发
  • EP2C8Q PLL深入浅出解析
  • OSPF的虚连接
  • 第一周上课总结
  • 这些道理不懂,你注定就是穷打工的命!
  • CAP理论的例子讲解
  • CEF与代理
  • CSS实用技巧
  • Gradle 5.0 正式版发布
  • Java Agent 学习笔记
  • JavaScript 无符号位移运算符 三个大于号 的使用方法
  • ReactNative开发常用的三方模块
  • SpiderData 2019年2月25日 DApp数据排行榜
  • ubuntu 下nginx安装 并支持https协议
  • unity如何实现一个固定宽度的orthagraphic相机
  • 从地狱到天堂,Node 回调向 async/await 转变
  • 基于 Babel 的 npm 包最小化设置
  • 力扣(LeetCode)21
  • 面试题:给你个id,去拿到name,多叉树遍历
  • 深入浅出Node.js
  • 数组大概知多少
  • 微信如何实现自动跳转到用其他浏览器打开指定页面下载APP
  • ionic入门之数据绑定显示-1
  • 关于Android全面屏虚拟导航栏的适配总结
  • ​Kaggle X光肺炎检测比赛第二名方案解析 | CVPR 2020 Workshop
  • ​软考-高级-信息系统项目管理师教程 第四版【第14章-项目沟通管理-思维导图】​
  • #前后端分离# 头条发布系统
  • #微信小程序:微信小程序常见的配置传旨
  • (delphi11最新学习资料) Object Pascal 学习笔记---第8章第5节(封闭类和Final方法)
  • (初研) Sentence-embedding fine-tune notebook
  • (附源码)ssm基于jsp的在线点餐系统 毕业设计 111016
  • (转)fock函数详解
  • (转)大道至简,职场上做人做事做管理
  • *p++,*(p++),*++p,(*p)++区别?
  • .bat文件调用java类的main方法
  • .libPaths()设置包加载目录
  • .net web项目 调用webService
  • .NET/C# 利用 Walterlv.WeakEvents 高性能地定义和使用弱事件
  • .net打印*三角形
  • .NET微信公众号开发-2.0创建自定义菜单
  • .net专家(张羿专栏)
  • .pyc文件是什么?
  • /usr/bin/perl:bad interpreter:No such file or directory 的解决办法
  • :=
  • [ MSF使用实例 ] 利用永恒之蓝(MS17-010)漏洞导致windows靶机蓝屏并获取靶机权限