如果按照 #1,执行了 bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/include/libxml2/
你就会在当前用户目录下的 .bundle
发现一个config
文件,然后在这个文件里头有这么一行代码:
BUNDLE_BUILD__NOKOGIRI: "--use-system-libraries --with-xml2-include=/usr/include/libxml2/"
config 的内容这应该是 bundler 管理 gem 的 配置文件,一般我有这样一个习惯:
在项目根目录下新建一个 .bundle
目录,该目录下面有 config
文件,那么我们执行 bundle install
时就会依据 config 文件中我们写的规则,例如:
---
BUNDLE_PATH: vendor/bundle
BUNDLE_WITHOUT: test:postgres
BUNDLE_DISABLE_SHARED_GEMS: true
BUNDLE_BUILD__NOKOGIRI: "--use-system-libraries --with-xml2-include=/usr/include/libxml2/"
Installing nokogiri 1.6.8 with native extensions
时就会使用 config
中配置的另,BUNDLE_PATH: vendor/bundle 有一个好处就是该项目中使用到的 gem 只会在该项目下,而不是 install 到 ruby 安装的目录下,这对强迫症来说是极好的。
经常遇到 Restoration Visits
导致楼主所说的“多个活跃图表”情况 😂
#4 楼 @cckkll 请问你是在哪到的呢,查了一下文档,我只看到这段话:
ActionController/Base
另外,redirect_to
和 render
并没有结束当前 action,要 and return
👍
业余生活 这点好赞。
#14 楼 @blackanger 用户主页,头像下面有 block 按钮。
用户系统考虑把 clearance 加上吗,thoughtbot 出品,相比 devise 轻多了。
👏
功能好赞。
SZ 地区的,帮顶一下。
@somejump
Rails.application.config.assets.precompile += %w( home.js )
上面这个问题你需要在 config/initializers/assets.rb
文件中把 home.js
添加进去。
论坛之前也有一篇文章推荐 推荐一个 Rails 5 Tips 的博客
不错。
不错
but , 不少是付费的。
说实话,我也喜欢这本书。
英文就英文看吧,有一些东西就没必要翻译过来)
👍 有点意思。
补充 #1 提到的方法在 Rails - passing parameters in link_to详细的解释。
另:做这样的功能 lz 是否考虑这个 gem 呢 acts_as_votable
@sixther 之前我写的有错误。
要得到 Host 集合应这样搞:@hosts = Host.joins(:groups)
然后要在 view 中得到你要的 group name,遍历 @Hosts 对象时类似这样显示:h.group.name
。
具体关于includes
和joins
方法使用请查看文档吧。
active_record_querying
@killernova 👍 ,已修正。
11 更,之前我被你这么一说把 joins 和 includes 弄混淆了。楼主要得到 Hosts 对象呢。
hosts 和 groups 的关系是:host belong_to group
并且group has_many hosts
?
所以首先你应在对应 model 里面定义好两者的关系。
然后在 controller 对应的 action 中使用 @hosts = Group.includes(:hosts)
Group.includes(:hosts)
可写在 model 的 scope 中方便调用。
接着你在视图中 each
#假设你使用了 haml 模板渲染视图
- @hosts.find_each do |h|
= h.group.name
你试试看,最后建议你多翻一下 Ruby on Rails guides
👏
有两种解决方法:
brew tap homebrew/dupes # Thanks Tom
brew install apple-gcc42
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2
brew uninstall v8
gem uninstall libv8
gem install therubyracer -v '0.10.2' # specify version
或者
brew install v8-315; brew link v8-315 --force did the trick for me.
👍
Button
你可以监听.on('click',function(){})
事件发送 Ajax 请求。
使用了 Devise
controller ruby-china/app/controllers/account_controller.rb
👏