Home
Wade Ruby
Cancel

Rails4中使用wysihtml5editor(usingwysihtml5editorinrails4)

NOTICE: please use tinymce instead. ( 请使用 tinymce), refer to: http://siwei.me/blog/posts/using-tinymce-in-rails steps: 1. download the source code from official website 2. in your page: <scri...

Rails34中使用bootstrap3的图标(displaybootstrap3plyphiconsinrails34)

refer to: http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application/ bootstrap3 中的图标独立出去了,而且不再是png,而是 fonts. 所以,我们要特殊处理一下。 (the plyphicon is extacted from bootstrap3 as...

Railsgem的实现模式(implementationforrailsgem)

最典型的要数: devise. 1. 初始化配置文件 $ bundle exec rails generate devise:install create config/initializers/devise.rb create config/locales/devise.en.yml Some setup you must do manually if you...

Fromrails3torails4,set_table_name,set_primary_keyisdeprecated

RAILS3的两个方法在RAILS4 中用不了:  set_table_name, set_primary_key.  we should use #table_name = instead of #set_table_name.    otherwise you will get undefined method `set_primary_key...

Nginx Nginx+thin配置nginx提供assetsrails(nginx+thin,confignginxserverstaticassets)

an example from railsgirlschina.com: (notice :  root for location ~ ^/assets/ is : /opt/app/siwei/rails_girls_cn/shared; , but not : /opt/app/siwei/rails_girls_cn/shared/assets server {...

调试rails程序的经验(experienceofdebuggingrails)

1. 看日志。  1.1 日志的格式很重要,务必要有时间戳。有exception traceback, 有 Completed 时间1.2 rails log跟 stdout put 有时候会分别写到两个不同的文件当中。 如果rails log 没有信息,那么就要看 stdoutput 的信息(如果你用的是thin服务器的话,就要看 thin.yml 中的配置了)  我们...

如何管理godaddyhost(howtomanagegodaddyhost)

前些日子在godaddy上买了个空间,放了一个论坛(ziwokangfu.com) 。并且加上了注册验证的功能。 现在要把代码放上去。 步骤: 1. 登录godaddy. (login to godaddy)  2. 进入 web hosting  (enter the web hosting area)  3. control + F, 找到 'ssh s...

Jeweler上手初体验(createyourrubygemusingjeweler)

传统的gem的建立方式很繁琐, 需要手动控制版本啊,依赖啊。(the problems that creating a rubygem using the official way are:  not very easy to control the version(minor, major, path), and dependencies.  so we use jew...

设置rails使用中国大陆时间(setrailsusingbeijingtime)

insert “ config.time_zone = ‘Asia/Harbin’” into your config/application.rb # config/application.rb module MCacheCleaner class Application < Rails::Application config.time_zone = 'Asia/...

找出某些command的pid(usingawkfindallthepids)

今天,沛沛交给我一招: awk. 找出所有的pid 列表。 ps -ef|grep fetcher |awk '{print $2}'   例如: $ ps -ef | grep fetcher root 22980 22967 5 17:41 ? 00:01:45 /root/.rbenv/versions/1.9.3-p327/bin/ruby /...

Rails中如何测试privatemethod.(howtotestprivatemethodsinrails.)

modify your spec_helper.rb and add the code below: # for testing the private method. # EXAMPLE: # describe_private User do # describe "about the role-permission" do # it "should ..." ...

使用nginx+thin的配置启动railsserver.(usingnginx+thintoserverailsapp)

1. nginx 中做如下配置: server { listen 80; charset utf-8; location / { proxy_pass http://rails_servers; proxy_redirect default; ...

God进阶:配置文件(godadvanced:configfile)

参考(refer to )http://godrb.com/ 每一个watch都代表一个process. 如果你有多个watch(process), 需要为每个process 分别指定pid_file. (If the process you're watching runs as a daemon (as mine does), you'll need to set the pid...

在rails中使用cas客户端(casclientforrails)

Ruby 客户端 使用方法0. 在 Gemfile中,加入: gem 'rubycas-client', :git => 'git://github.com/rubycas/rubycas-client.git'     (要用这个版本,否则 会出现undefine method before ...)  然后 $sudo bundle 注意: 不要使用 ...

God初体验(myfirstexperienceofgod)

最近的一个项目需要用WEB 来控制 后台运行的进程。 搜索未果,于是在stackoverflow上发了个帖子(http://stackoverflow.com/questions/21069839/whats-the-best-practice-to-control-linux-process-from-web-page-rails)。   同时看到有人推荐godrb.com ,所...

我的一点提高英语水平的经验(howtoimproveyourenglish?)

今天有个帖子,很有趣。我看到有位朋友在一个JD的留言中,说自己英语不好, (http://ruby-china.org/topics/16318) 我替他觉得很可惜。 他似乎比较羡慕我在MOTO的工作经历, 认为这对我的英文有好处。实际上,我的英文一直都不好(高考分不低,不过大学四年没背过单词。唉)。只是可以勉强跟人交流软件开发。 要我总结的话,我想说三句: 1. MOTO的三年对我的英文基...

Tinymce Anothergoodwysiwygeditor(rails中使用tinymce)

在rails 中的使用方式: 建议使用 gem 来做。否则一点儿一点儿的copy assets ,很麻烦。(it's strongly recommended we use the gem instead of adding files to app/assets image/stylesheets manually. see: https://github.com/spohlenz/ti...

Railsactiverecord中的insert(whyarray.insertworksinrubybutnotinrails?)

因为 Rails 中返回的是 ActiveRecord.relationship,  而不是raw Array. e.g. # in irb [2,3,4].insert(1, 'a') # => [2,'a', 3, 4] # in Rails models = SomeModel.where(...) models.insert(1,'b') # wrong argu...

如何输入一段ruby代码然后执行它?(howtoinputastringofrubycodeandexecutethecode)

there's a case that I have to input a string of ruby from console(or from even the web page) then execute it. here is the example: (如题。) class UrlGenerator attr_accessor :urls def generate...

Rails4中使用wysihtml5editor(usingwysihtml5editorinrails4)

NOTICE: please use tinymce instead. ( 请使用 tinymce), refer to: http://siwei.me/blog/posts/using-tinymce-in-rails steps: 1. download the source code from official website 2. in your page: <scri...