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

浙公网安备 33010602011771号