• 问题好大,拆一下吧,比如

    • 如何设定团队目标和愿景
    • 如何招聘到好得员工
    • 如何跟同事相处
    • 如何制作项目计划
    • 如何保证按时交付
    • 如何激励团队成员
    • 如何让员工有归属感
    • 如何在工作中提升个人能力以及修养
    • ......
  • #2 楼 @perfect 这个也被你发现了,哈哈,还不赶紧截个图?

  • 我想去杭州~

  • 认识肤浅的人,总会觉得自己已经掌握了。 认识达到一定深度的人,总会感觉自己所知还太少,还有很多东西要学习和研究。 我觉得可以用这个作为尺度来衡量自己是否已经深入掌握了吧。

  • 我是重度刷 unread count 的用户,以后要习惯去点“社区”连接了,新的首页很有意思,大家多给些 Feedback 吧。

  • 来自薄荷网的@vincent 拟定下次跟大家分享关于 Rails 里面的搜索,全文检索方面的话题。

  • 今天给大家分享的内容:

    Rails Engine

    Before Rails 3

    What is Rails engine

    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

    DHH 关于 Rails Engine 的吐槽 The case against high-level components

    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 的作者对 DHH 的吐槽的吐槽

    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.

    无力的官方吐槽 (作者其实是 DHH):Why engines and components are not evil but distracting

    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.

    我关于 Rails Engine 的吐槽

    简单的说,如果不用 Subsctuct,节约出来的时间和精力足够我把 Substruct 作的事情推翻重做三遍以上了。

    limitations of Engine in Rails 2.3

    • No migration support.
    • No public asset support.
    • Like plugins, naming becomes a concern.

    After Rails 3

    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.

    RailsCasts:

    Paths

    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

    Engine Initializer

    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
    
    

    Engine and Rack

    What is rack?

    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.

    Why rack?

    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.

    How rack?

    Dependency nightmare?

    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.

    Create engine

    • Enginex for Rails 3.0
    • rails plugin new for Rails 3.1

    DEMO

    ignore...

  • 签到

  • 刚刚一个朋友跟我说,看到 Engine 就想到了 Engine Yard,我想想也是哦,在 Rails 3 以前,一看到 Engine,就想要一个词“丫的!”

  • Development 模式下你随意,Production 环境下请严谨一点,用 Git 这样的源码管理系统来管理代码和发布,关于 Unicorn 和 Thin,或者 Passenger,都可以做到不停机发布新代码的。

  • #24 楼 @fentick 真不用带,现场环境和气氛不是 training,而是讨论交流,这个给我太大压力了,呵呵。

  • 真的啊?怎么发现的?

  • #15 楼 @Juanito 我没有特意关注过本站 wiki 的 markdown 风格,不过我个人也倾向于 github 的 markdown 风格,本周晚些时候应该能抽出一些时间,如果语法不一致的话,我会试着看看能不能做些什么。

  • 一定耗费了楼主 n 个小时吧,赞楼主一个,能转载到本站的 wiki 上么?

  • #21 楼 @jhjguxin 自己组织呀,你就在市区中心,交通便利的地方比如新街口找个咖啡吧,然后发个帖子,AT 一下坛子里面各位南京的大大们就好了啊。 http://ruby-china.org/users/location/%E5%8D%97%E4%BA%AC

  • #18 楼 @nouse #17 楼 @jhjguxin 对的,在南京自己组织呀。

  • #14 楼 @jhjguxin 天哪,你来回 600 多公里,为了是来上海参加一个 2 小时的活动,这个太夸张了啊!这样过来成本太高了!

  • #8 楼 @zw963 请看我的个人签名,哥的胡子还得留一段时间。

  • 有没有人看过《乐者为王》?这是一本关于 Linux 的作者,大神李纳斯·托沃兹的个人传记。 我记得在大学的时候看这本书,有一个桥段,有个商人骗取了 LInus 的信任和授权,然后把 Linux 的域名注册为己有,后来 Linux 基金会花了大量的时间和金钱,才通过法律手段将 Linux 商标和域名讨回来,并交付给 Linus 本人掌管,因为整个社区的人都认为,只有 Linus 本人拥有 Linux 商标才是对 Linux 商标最大的保护。

  • #4 楼 @young4u_amy 原来你在中国加速呀,呵呵。

  • 谢谢楼主分享,我也打算玩起来 emacs,根据上次 RubyTuesday @nouse 的说法,要玩 Haskell,得在 Emacs 上玩。 btw,我改天把胡子剃了,呵呵。

  • #12 楼 @87796 有什么错误提示么?我是在自己的 Rails 3.1.1 里面贴了这端代码,测试过才发布到 4 楼的。

  • #12 楼 @azhao 是啊,我的经验是,如果想要找靠谱的人,得公司里面有人在社区里广结善缘,然后瞄准目标,定点拿下... 撒网得效果真不怎么样的。

  • #4 楼 @huacnlee 顶楼主 @ruchee 这个排版,看了让人赏心悦目呀。

  • 同求斯里兰卡正品红茶 我曾经在西安的一家进口食品专营店内买过一些,口味超级赞,喝完后至今在未见到过,魂牵梦绕啊。

  • 广州的活动真 Happy!

  • 这首歌太有范了!

  • #5 楼 @Rei 你确定这个能在 Rails 3 下面工作嘛? 我测试了下不行,我查了下最新源码,form_tag_html中用 view helper 的tag方法 (tag_options) 也已经不对 options 中的html作特别处理了吧。

  • 楼主试试看这样:

    <%= form_tag url_for(:controller => "admin/projects", :action => "search"), :method => "get", :class => "form-inline" do %>
    <% end -%>