Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
花错
@flowerwrong
Member
NO. 9442 / 2013-10-06

广州
47 Topics / 1109 Replies
36 Followers
35 Following
233 Favorites
人生有如花错
No GitHub.
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • module 里面 class << self 的作用? 然后怎么扩展 class at January 20, 2015

    #7 楼 @zgm 👍

  • module 里面 class << self 的作用? 然后怎么扩展 class at January 20, 2015

    #1 楼 @alixiaomiao #3 楼 @liangbin661831 #5 楼 @xzgyb #4 楼 @zgm 我希望我的 module fuction 既可以被其他类 include 和 extend , 自己也可以通过 ModuleName.funcName 调用。我如下做是因为,我要通过 ModuleName.funcName 调用

    module D  
      class << self
        def say_hello_of_d
          puts 'D say hello'
        end
      end
    end
    
    D.say_hello_of_d
    

    但是这样如果不做处理是不能被其他类 include 或者 extend 的。

  • module 里面 class << self 的作用? 然后怎么扩展 class at January 20, 2015

    #1 楼 @alixiaomiao 那我在模块中的class << self方法怎么扩展到类中呢?

    class A
      def self.go
        puts 'hello a'
      end
    end
    
    class B < A
    end
    
    A.go # hello a
    B.go # hello a
    
  • 如果有很多图文混排的文章作种子数据 at January 16, 2015

    网页端如果有,可以爬虫

  • Rails 中使用 template 文件导出 excel 时,如何指定格式 Excel 97-2004 工作簿 (.xls) at January 16, 2015

    #11 楼 @macknight 一样的 先注册

    Mime::Type.register "application/xls", :xls
    Mime::Type.register "application/xlsx", :xlsx
    

    然后 controller 中 format

    format.xls
    format.xlsx
    

    最后 name.xls.erb and name.xlsx.erb

  • gem 包使用中,对相关 js, css 引用问题 at January 15, 2015

    #2 楼 @luffycn 你应该举 jquery 的例子,rails 默认引入了 jquery,那么使用例如 ckeditor gem 的时候里面也包含 jquery,我没有具体看过,但我可以确定他一定有如下机制

    if(window.jQuery === undefined) {
      // 引入jquery
    }
    

    或者是

     <!-- 加载jQuery1.5.2版本 -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script type="text/javascript">
    var jQuery_1_5_2 = $.noConflict(true);
    </script>
    

    虽说 jquery 有自己的一套机制,但是我觉得他们一定会做的,不然这个 gem 就有待改进。

  • CKEditor 在服务器上上传图片只能传 3 张? at January 14, 2015

    https://github.com/galetahub/ckeditor 还不错

  • Rails 中使用 template 文件导出 excel 时,如何指定格式 Excel 97-2004 工作簿 (.xls) at January 14, 2015

    #7 楼 @liangbin661831 不是都要钱,pro 的要购买,再者 $9/month , 现在 60 块钱就可以全部看完

  • Rails 中使用 template 文件导出 excel 时,如何指定格式 Excel 97-2004 工作簿 (.xls) at January 13, 2015

    http://railscasts.com/episodes/362-exporting-csv-and-excel http://railscasts.com/episodes/396-importing-csv-and-excel

    Mime::Type.register "application/xls", :xls in config/initializers/mime_types.rb

  • [北京 / 远程] 墨刀 (MockingBot) 招聘 Rails 全栈工程师 at January 12, 2015

    不错喔

  • [广州] 单车电影 招聘 Ruby、Python、PHP 和 nodejs 服务端 、Web 前端开发工程师若干名(全职或实习职位) at January 12, 2015

    怎么开发语言这么多的?

  • Apple 的工具居然有用 Ruby 写的 at January 11, 2015

    #2 楼 @blacktulip #3 楼 @realwol 这个只是一个社区的建议规范,我写 js 还用 output_io 命名。缩进和命名都是看个人或者团队。

  • 2015年 你打算学习哪门编程语言? at January 06, 2015

    English+java+ruby+c+js, 看看 rust, go/swift/elixir都飘过

  • 第二个项目部署上之后怎么重启 passenger? at January 05, 2015

    #9 楼 @chairy11 我不知道了耶, 有说先bundle install , 如果不行,可能是你的 passengerDefaultRuby 路径有点问题 我的 rvm 是装在用户目录的,用的是rvm default use版本 PassengerDefaultRuby /home/my_name/.rvm/wrappers/default/ruby 这个配置可以写在单个 vhost 文件里面的,用于指定单个项目的 ruby 版本。

  • 我的 2014 at January 04, 2015

    🎶 js 真火

  • 第二个项目部署上之后怎么重启 passenger? at January 04, 2015

    #3 楼 @chairy11 timestamp of this file has changed 不用写任何东西,passenger 会监听该文件的时间戳,如果改变就会自动重启项目。

    #4 楼 @chairy11 something went wrong 是 500,你项目的问题,查看你的项目下面的log/production.log

  • 第二个项目部署上之后怎么重启 passenger? at January 04, 2015

    touch tmp/restart.txt 是重启当前项目。

    Phusion Passenger checks whether the timestamp of this file has changed in order to determine whether the application should be restarted.
    

    https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html 重启 nginx 用nginx -s reload

  • 12 周 12 个应用,很不错的 Rails 入门视频 at January 01, 2015

    500 error.

  • 开发 app 的后台,用 ror 或者 Sinatra 能否合适? at December 30, 2014

    active_record+grape+sinatra(如果有少量页面)

  • 开发 RoR & PHP Project,测试环境、生产环境部署相关问题 at December 28, 2014

    apache+passenger+mysql+php 我们公司用的. Docker 个人认为不合适,使用 docker 需要跑一个 mysql container, 一个 Nginx + Unicorn container, 还有一个 nginx + php(官方有许多直接 wordpress 环境的镜像) 的 container vagrant 其实就是跑虚拟机。

  • shortdoc 短文网,看看 at December 26, 2014
    404 Not Found: Requested route ('shortdoc.coding.io') does not exist.
    

    这......

  • 工作学习时,老是玩手机咋办? at December 23, 2014

    #2 楼 @huihen 军工品质,你值得拥有。

  • rails 数据关联的问题 at December 22, 2014

    首先数据库表是多对多关系,然后 gem 确实简单点。 3 楼的,在用。

  • devise 做用户名 和邮箱同时验证 at December 22, 2014

    没读懂,你是问句?还是分享? https://github.com/plataformatec/devise/wiki/How-Tos

    https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address

  • Node.js 2014 这一年 at December 21, 2014

    看完了

  • 如何往一个文件里 指定的某一行之前插入 text at December 20, 2014

    sed or awk

  • Rails 4.2 正式版已发布 at December 20, 2014

    🎶

  • MiniTest 的正确使用姿势 at December 14, 2014

    我倒认为minitest帮了倒忙。见仁见智吧。

  • 为什么感觉 Ruby China 里的程序员,基本上是做 Web 的? at December 12, 2014

    rust

  • Prev
  • 1
  • 2
  • …
  • 19
  • 20
  • 21
  • 22
  • 23
  • …
  • 35
  • 36
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English