10 2015 档案

摘要:(1)首先给每一行进行id的标注,并且修改edit链接,使它的remote: true,请求类型是json格式,在这个链接上,增加class:editProductLink,这样在我们点击链接的时候,会执行一个动作,app/views/products/_product.html.erb"> ... 阅读全文
posted @ 2015-10-27 18:25 冰凌花花~ 阅读(394) 评论(0) 推荐(0)
摘要:(1)首先给删除按钮增加一个属性 remote: true,这样ujs将这个click动作转化为ajax调用,app/views/products/_product.html.erb"> _name"> _price"> _description"> t("helpers.... 阅读全文
posted @ 2015-10-27 18:02 冰凌花花~ 阅读(499) 评论(0) 推荐(0)
摘要:(1) 在布局文件中将弹出层的代码和主体代码分开 (2)改写添加商品的时候按钮的方法,增加data属性,里面设定当按钮点击的时候,打开哪一个model,在model的代码里,调用form这个局部模板,在下面的js代码里声明这个model,并且声明这个m... 阅读全文
posted @ 2015-10-27 17:49 冰凌花花~ 阅读(273) 评论(0) 推荐(0)
摘要:为了避免新建的时候重复的点击提交按钮,可以加一个限制 'btn btn-primary', :data => { :"disable-with" => "请稍等..." } %> 阅读全文
posted @ 2015-10-27 16:56 冰凌花花~ 阅读(270) 评论(0) 推荐(0)
摘要:ruby on rails应用,如何增加登录注册功能,本文讲演示全过程 阅读全文
posted @ 2015-10-26 19:07 冰凌花花~ 阅读(500) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2015-10-26 16:30 冰凌花花~ 阅读(183) 评论(0) 推荐(0)
摘要:https://github.com/activerecord-hackery/ransack添加Gemfilegem 'ransack'view中代码 controller里 def... 阅读全文
posted @ 2015-10-26 15:46 冰凌花花~ 阅读(479) 评论(0) 推荐(0)
摘要:http://getbootstrap.com/css/#helper-classes-clearfix清除浮动div class="clearfix"http://blog.csdn.net/shenlei19911210/article/details/48196441 阅读全文
posted @ 2015-10-23 17:23 冰凌花花~ 阅读(527) 评论(0) 推荐(0)
摘要:在model里新建 CHANNEL_TYPES = { '信号源': :signal_source, '直播轮播': :live_and_rotate, '我的': :my_channel, 'C 频道': :c_channel }并增加方法 def channel_... 阅读全文
posted @ 2015-10-23 14:16 冰凌花花~ 阅读(173) 评论(0) 推荐(0)
摘要:channel_type对应多种类型,每个类型在数据库中存储的字段和在页面上显示的字段是不同的,如果在index里直接使用 select_tag 方法,是这样的:不过这个下拉菜单显得有些多余,可以在model里加一个方法, def channel_type_human { s... 阅读全文
posted @ 2015-10-22 15:49 冰凌花花~ 阅读(233) 评论(0) 推荐(0)
摘要:https://github.com/thoughtbot/shoulda-matchers加了gem 'shoulda-matchers', '~> 3.0',报错是因为没有配置spec/rails_helper.rb,详细内容在上面连接里的configuration里Shoulda::Match... 阅读全文
posted @ 2015-10-21 18:51 冰凌花花~ 阅读(231) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/5286117/incompatible-character-encodings-ascii-8bit-and-utf-8http://stackoverflow.com/questions/22932282/gemloaderr... 阅读全文
posted @ 2015-10-21 18:26 冰凌花花~ 阅读(665) 评论(0) 推荐(0)
摘要:推荐两个网址:https://github.com/rspec/rspec-railshttp://rspec.info/documentation/上传了一个api的单元测试,https://github.com/shiralwz/grape_api_rspec主要步骤:(1)在Gemfile里加... 阅读全文
posted @ 2015-10-12 16:13 冰凌花花~ 阅读(247) 评论(0) 推荐(0)
摘要:Grape,为API设计而生DSL(Domain Specified Language),官网地址: http://intridea.github.io/grapehttp://intridea.github.io/grape/docs/index.html(1)描述性的API构建方式,代码可读性非... 阅读全文
posted @ 2015-10-08 16:20 冰凌花花~ 阅读(178) 评论(0) 推荐(0)