Web开发
文章平均质量分 56
天亮了_
这个作者很懒,什么都没留下…
展开
-
Http协议中GET与POST的区别
1.根据HTTP规范,GET用于信息获取,而且应该是安全的和幂等的。(1).所谓安全的意味着该操作用于获取信息而非修改信息。(2).幂等的意味着对同一URL的多个请求应该返回同样的结果.2.根据HTTP规范,POST表示可能修改变服务器上的资源的请求。从表面现像上面看看GET和POST的区别:GET请求的数据会附在URL之原创 2013-09-09 23:20:40 · 1236 阅读 · 0 评论 -
Rails中scaffold与models的区别
使用 rails g scaffold Users 时,rails为我们建立migrate, model,controller, helper, view, test and assets当使用models时,产生的是 migrate, model and test/unit file其他的:the difference is:if you want to原创 2013-09-24 10:20:47 · 1842 阅读 · 0 评论 -
Rails中的MVC流程与RESTful路由的流程总结
MVC的流程参见下列图片:其处理流程如下:瀏覽器發出HTTP request請求給Rails路由(Routing)根據規則決定派往哪一個Controller的Action負責處理的Controller Action操作Model資料Model存取資料庫或資料處理Controller Action將得到的資料餵給View樣板回傳最後的HTML成品給瀏覽器原创 2013-09-26 16:59:42 · 1944 阅读 · 0 评论 -
rails中post与comment嵌套后的REST路由规则
Prefix Verb URI Pattern Controller#Action post_comments GET /posts/:post_id/comments(.:format) comments#index POST /posts/:post_id原创 2013-09-26 11:46:12 · 1949 阅读 · 1 评论 -
Rails实现一个blog项目02-登录功能和session的实现
1.首先生成model userrails g model user login:string hashed_password:string salt:string去schema.rb检查无误后就近行数据的迁移这个博客暂时不开放注册,利用console增加用户 2.为user的login增加数据验证 def password @password en原创 2013-09-28 18:03:22 · 2100 阅读 · 0 评论 -
rails中ActiveModel::ForbiddenAttributesError的解决方案(新)
最近总是遇到这个问题,因为我看的资料都是Rails3.2的,但是用的开发环境是4.0的,而4.0增加了一些安全措施这类错误大多出现在new或者create两个action中def create #params.permit! @post = Post.find(params[:post_id]) @comment = @post.comme原创 2013-09-28 16:13:45 · 5814 阅读 · 1 评论 -
【bootstrap】使用bower安装bootstrap
本来这么简单的东西耽误了我好长时间。使用bower安装bootstrap的命令是:bash$ bower install bootstrap不过问题出在如何安装bower上。 官方网站上这样说的:Bower depends on Node and npm. It's installed globally using npm:npm ins原创 2013-10-16 17:36:37 · 6572 阅读 · 1 评论