上大学那个时候,拥有一个罗技的光电鼠标对我来说还是非常奢侈的东西,我们晚上熄灯后寝室兄弟从应急灯上接电到宿舍,玩 Diabio II 天天晚上如此,一个月时间硬是把我的新鼠标给玩坏掉了,为此恨了他一个学期。
问题好大,拆一下吧,比如
我想去杭州~
认识肤浅的人,总会觉得自己已经掌握了。 认识达到一定深度的人,总会感觉自己所知还太少,还有很多东西要学习和研究。 我觉得可以用这个作为尺度来衡量自己是否已经深入掌握了吧。
我是重度刷 unread count 的用户,以后要习惯去点“社区”连接了,新的首页很有意思,大家多给些 Feedback 吧。
来自薄荷网的@vincent 拟定下次跟大家分享关于 Rails 里面的搜索,全文检索方面的话题。
A Rails Engine is a method for embedding one Rails applicaiton into another. Engines have been available as a plugin around for years, but it is now built in to Rails 2.3. RailsCasts: Rails Engine
All attempts at creating high-level business components that can be re-used and re-configured have failed previously. This failure has not been for technical reasons - it happens because the requirements that yielded the original component interface were sufficiently different from the new requirements so as to require re-writing massive chunks of functionality.
Engines fill a fairly specific need that we (my team) have, which is the development of multiple distinct Rails applications which share common components (authentication, reporting, importing data from hellish Excel), and ensuring that a means to apply patches & bug fixes across each of these applications, including models, controllers and views with the minimum of developer time spend on managing those updates. Need to roll-back to a previous version of the Reporting system? Just change the SVN external and everything within the Engine goes back to the way it was. With generators (less so with those that come with plugins, but this still holds true), the code would have to be regenerated back into the /app directory.
……
Engines have not recieved the blessing of the RoR core team, and I wouldn't expect any different, because it would be madness to include them in the core Rails. It's a mechanism far too easily [ab]used for things it's not actually suitable for. I did speak to Jamis (cc'd to DHH) about them quite some time ago, before plugins existed in a released form. Their advice was to reimplement our mechanism as a plugin, and if anything we were doing could not be achieved in this way, they would re-examine their plugin mechanism to see what could be adapted.
As it turns out, we can do everything we need within their plugins architecture, so we have a happy coexistance - Rails stays clean, but is flexibly enough to support our (hopefully not too outlandish) needs. It's not like we're forking the project or taking digging our heels in and taking a stand against anything.
So what am I saying? That engines should be stopped? Of course not. But I am saying that Rails will continue to send a signal with what’s included in the core that this is a sideshow project. It satisfies some needs for some people and that’s great. But the goal of Rails is to create a world where they are neither needed or strongly desired. Obviously, we are not quite there yet.
简单的说,如果不用 Subsctuct,节约出来的时间和精力足够我把 Substruct 作的事情推翻重做三遍以上了。
Rails engines allow our gem to have controllers, models, helpers, views, and routes…
For Rails 2.3, in order to make Engine work, Rails had to hook into Rubygems and check each gem that was loaded.
For Rails 3.x, we needed an explicit way to create engines, allowing it to work in any scenario, not only with Rubygems. Whit that in mind, Rails now ships with a new class Called Rails::Engine.
In Rails 3, a Rails::Engine does not have hard-coded paths. This means we are not required to place our models or controllers in app/
.
module MyEngine
class Engine < Rails::Engine
paths.app.controllers = "lib/controllers"
end
end
More info, please check out rails/railties/lib/rails/engine/configuration.rb
An engine has several initializers that are responsible for making the engine work.
>> Rails::Engine.initializers.map(&:name)
=> [:set_load_path, :set_autoload_paths, :add_routing_paths, :add_locales, :add_view_paths, :load_environment_config, :append_assets_path, :prepend_helpers_path, :load_config_initializers, :engines_blank_point]
initializer :add_routing_paths do |app|
paths.config.routes.to_a.each do |route|
app.routes_reloader.paths.unshift(route) if File.exists?(route)
end
end
The Rack specification clearly outlines the API used by Rack applica- tions to communicate with a web server and between themselves: A Rack application is a Ruby object (not necessarily a class) that responds to call. It takes exactly one argument, the environment, and returns an array of exactly three values: the status, the headers, and the body.
By following the Rack API, a web framework could use Rack web servers adapters instead of providing its own, removing the duplication of effort existing in the Ruby community.
While Rails 2.2 already provided a simple Rack interface, Rails more closely embraced Rack and its API in version 2.3. However, the Rack revolution really happened in Rails 3.
New mountable engines come with fully isolated namespace. which let an e-commerce soltuion like Spree, a Forum like Forem or a CMS like Refinery or Locomotive in you own Rails application.
rails plugin new
for Rails 3.1ignore...
签到
刚刚一个朋友跟我说,看到 Engine 就想到了 Engine Yard,我想想也是哦,在 Rails 3 以前,一看到 Engine,就想要一个词“丫的!”
Development 模式下你随意,Production 环境下请严谨一点,用 Git 这样的源码管理系统来管理代码和发布,关于 Unicorn 和 Thin,或者 Passenger,都可以做到不停机发布新代码的。
真的啊?怎么发现的?
一定耗费了楼主 n 个小时吧,赞楼主一个,能转载到本站的 wiki 上么?
#21 楼 @jhjguxin 自己组织呀,你就在市区中心,交通便利的地方比如新街口找个咖啡吧,然后发个帖子,AT 一下坛子里面各位南京的大大们就好了啊。 http://ruby-china.org/users/location/%E5%8D%97%E4%BA%AC
有没有人看过《乐者为王》?这是一本关于 Linux 的作者,大神李纳斯·托沃兹的个人传记。 我记得在大学的时候看这本书,有一个桥段,有个商人骗取了 LInus 的信任和授权,然后把 Linux 的域名注册为己有,后来 Linux 基金会花了大量的时间和金钱,才通过法律手段将 Linux 商标和域名讨回来,并交付给 Linus 本人掌管,因为整个社区的人都认为,只有 Linus 本人拥有 Linux 商标才是对 Linux 商标最大的保护。
#4 楼 @young4u_amy 原来你在中国加速呀,呵呵。
谢谢楼主分享,我也打算玩起来 emacs,根据上次 RubyTuesday @nouse 的说法,要玩 Haskell,得在 Emacs 上玩。 btw,我改天把胡子剃了,呵呵。
同求斯里兰卡正品红茶 我曾经在西安的一家进口食品专营店内买过一些,口味超级赞,喝完后至今在未见到过,魂牵梦绕啊。
广州的活动真 Happy!
这首歌太有范了!