ding
顶 yixia
顶一下
支持
支持
一个赞
支持,虽然要求够了,只是还没毕业 🙃
😃
vim + 1
log:
[["body", "world\r\n\r\nworld\r\n\r\nhello\r\nworld\r\nin\r\nhere\r\n\r\nruby\r\ndef hello\r\n puts \"hello world!\"\r\nend\r\n
"], ["updated_at", 2017-01-10 04:07:22 UTC], ["id", 2]]
#18 楼 @cosmosz @article = current_user.articles.build(article_params[:text].gsub!(/\r\n?/, "\n"))
def article_params params[:article].permit(:title, :text, :node_id, :article_img) end
"article"=>{"node_id"=>"1", "title"=>"hello", "text"=>"ruby\r\ndef hello\r\n puts \"hello world!\"\r\nend\r\n
"}, "commit"=>"Save"}
报错了: When assigning attributes, you must pass a hash as an argument.
#14 楼 @cosmosz params[:article].permit(:title, :text, :node_id, :article_img).gsub!(/\r\n?/, "\n")
报错了
undefined method `gsub!' for #ActionController::Parameters:0x007f9ab51dc0c0
它提交的时候 [["text", "ruby\r\ndef hello\r\nputs \"hello world!\"\r\nend\r\n
"] 就是这样,不知道在哪里修改
fasdfas
fsadf
报道