`
文章列表
(1)使用bundle gem hhg10创建一个名为hhg10的文件夹 (2)修改文件为hhg10.gemsepc文件。      在相应的lib/hhg10下完成相关功能的rb文件写 (3)运行打包gem build hhg10.gemspec 会出现success built rubygem字眼成功 接下来就是把打包好的gem上传到相应的服务器,或推到rubygems里面,需要有个注册个账号   1)curl -u hhg08 https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials   2)less ~/.gem/c ...
host 123.123.123.123 hostname 123.123.123.123 port 20066 找到.ssh文件夹下的config文件,vim打开之后把他复制进去就ok了 ps:cd ~/.ssh

rubyjson转换为hash

    博客分类:
  • ruby
json转换为hash  obj.to_hash 反过来json转换成json为  ActiveSupport.decode(obj)

url获取ip

    博客分类:
  • ruby
require 'socket' ip = TCPSocket.gethostbyname('www.baidu.com') return =>["www.baidu.com", [], 2, "61.135.169.125", "61.135.169.121"] @ip = ip.last
~/gitlab-ci$ bundle exec rake db:migrate RAILS_ENV=production rake aborted! Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). rm Gemfile.lock重新bundle install, 以及直接 ...

rails 版本

rails官网的api查询默认是最新版本 http://api.rubyonrails.org/ 旧版本 http://api.rubyonrails.org/v3.2.13/ http://api.rubyonrails.org/v2.3.15/

在Ubuntu上装sublime

$ sudo add-apt-repository ppa:webupd8team/sublime-text-3 $ sudo apt-get update $ sudo apt-get install sublime-text-installer
之前因为系统未激活,激活之后安装系统出现这问题,也有告诉说Ubuntu版本的问题,但最后还是找到原因。 解决方法:恢复系统主题文件即可。 具体看说明。 恢复主题文件附件有下载
(一)常用的 rails s rails c rails s -p3001多个端口// ( rake assets:precompile:all RAILS_ENV=production #产品模式编译 运行之后会在public的assets文件下产生大量静态文件,切换回development时需要删除掉,然后清空缓存,不然会报一些错。 rails s -e production运行产品环境 ) (二)与rake相关的 rails g migration 一般是单独创建一张表或者给某张存在的表进行添加修改删除字段 rails g model model_name会自动创建一个模型以及对应的一张 ...
自己在做404跳转页面的时候把404放在public文件下,然后按照平常的方式 <%= stylesheet_link_tag "name"%> <%= javascript_include_tag "name"%> 用上面之后就会出现在开发模式下能正常运行,但是在编译环境下就不能运行, 应该改成静态方式应用 <link href="/assets/tipsy.css" media="screen" rel="stylesheet" type="text/c ...
转摘的 http://www.imooo.com/zhuantikaifa/ai/1008150.htm ---------------------
基础配置 config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += %W(#{config.root}/lib/bootstrap) config.i18n.locale = 'zh-CN' config.i18n.default_locale = 'zh-CN' 上面配置之后其它不管文件名取为devise.zh-CN.yml还是simple_form.zh_CN.yml只要里面文件第一句为zh-CN:那么就会对应本地化。 产生两个方法i18n.t/l 单独读取本地化时采用上面的方法,然后层层剥去里面的结构 ...
git commit -m "合并到上次提交" - - amend 必须在push之前,否则,只能分次提交了 git commit -am "11111"
在同一个项目文件下,多个分支切换时,database.yml如何自动切换分支 database: <%= `git rev-parse --abbrev-ref HEAD` %> 不需要在每次去屏蔽,而是直接动态的 database: branch1 //database: branch2
手机端的认证功能jquery配合模型方法调用而来。 (1)jquery写调用模型的ajax请求方式 (2)模型的方法的。可以参考http://ruby-doc.com/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html#method-c-http_default_port 这文章里面有调用的方法。   MOBILE_CONFIG = YAML.load_file(Rails.root.join('config/mobile_note.yml'))[Rails.env]   def self.validate_by_mobile attrs={}     ...
Global site tag (gtag.js) - Google Analytics