什么?!原来 Tab 可以改成空格?
先分析到底哪里慢。
iA Writer
我希望能有 epub 格式电子书。
因为它这里用了嵌套路由
resources :posts do
resources :comments
end
Url 模式是:
/posts/:post_id/comments/:id
你可以用
rake routes
来查看现在的路由规则。
#6 楼 @shangrenzhidao 是啊,就是这么来的。
#4 楼 @shangrenzhidao 试试 @event.to_param
的结果。
#2 楼 @shangrenzhidao HTML 的 id,根据表单参数自动生成的,现在用不上。
action="/events/update/1"
这个 1 就是 id。楼主连着发了很多入门提问贴了,请多看书多思考。
加
gem 'therubyracer'
https://github.com/cowboyd/commonjs.rb 目前只支持这两个
#16 楼 @jxs471494539 怎么没有 fontawesome
用 less 要麻烦一些了,它要 load js runtime,require js 的库 less。把 Gemfile.lock 列出来,看现在用了什么 js runtime。
顶楼说的 gem 是 sass,这里怎么装了 less。
class Band
include Mongoid::Document
embeds_many :albums
accepts_nested_attributes_for :albums,
reject_if: ->(attrs){ attrs[:name] == "Violator" }
end
文档碉堡了 http://mongoid.org/en/mongoid/docs/nested_attributes.html
语法错了,把那行放在 *= require_tree
的前面,成为注释的一部分。
奥,不用索引,加唯一校验就行了。
开浏览器调试,看看有读取 font-awesome 相关的 css 没,再看看内容,正不正常。
If you use Rails/Sprockets, add this to e.g. application.css.scss:
*= require font-awesome
这个做了没。
但配置了好久都不成功
怎么不成功法
每个语言都有它的惯用法,多参考开源软件的源码。
有必要一定要用 nested_attributes 实现吗?
foo = Foo.create params[:foo]
params[:foo][:aliases].each { |alias_params| foo.aliases.find_or_create_by(alias_params) }