
rails
文章平均质量分 52
Xunzi229
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[Ruby] 网页添加文本编辑器 Kindeditor for Ruby on Rails
Kindeditor for Ruby on Rails 中文文档 Kindeditor是国产的所见即所得javascript富文本编辑器, 访问 http://www.kindsoft.net 获取更多信息. rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和附件上传功能,文件按照类型、日期进行存储。 安装及使用 将下面原创 2016-05-18 08:55:01 · 1918 阅读 · 0 评论 -
[ROR]Single Table Inheritance with Rails 4 (Part 3)
In the last article, we created our controller and define the index view. In this one, we are going to add the missing views and see some tricks to handle paths for STI models. Learn how to impleme转载 2017-05-20 19:48:08 · 1067 阅读 · 0 评论 -
[ROR]Single Table Inheritance with Rails 4 (Part 2)
Time to continue learning about Single Table Inheritance with Ruby on Rails. Learn how to implement STI with Rails with this free ebook In this article, we are going to see how to create a c转载 2017-05-20 19:47:14 · 1040 阅读 · 0 评论 -
[ROR]Single Table Inheritance with Rails 4 (Part 1)
原文: https://devblast.com/b/single-table-inheritance-with-rails-4-part-1 Today, we are going to do some model inheritance with Active Record ! This is not something that you should do everyday b转载 2017-05-20 19:46:09 · 1280 阅读 · 0 评论 -
[ROR] 解决N+1问题的心得
遇到的场景是: @articles.each do |article| user = User.find(article.user_id) user.name end这个时候就遇到了N+1 的问题,而我的问题其实更复杂些,其中还夹杂着多个中间表(就不追叙了)而其中的@articles 其实就那么几个 user,如果重复的使用 article.user.name 就会很恶心我的解决的方法是...原创 2017-05-16 22:01:07 · 2404 阅读 · 0 评论 -
[ROR] ActiveSupport::Callbacks的使用
ActiveSupport::Callbacks 提供了一个独立于rails 的回调功能所谓的回调 :就是在执行一个方法的时候,自动的回调执行另一个对象,为什么说是对象,而不是说方法因为 自动回调的不仅仅 是 方法,也可以是 代码块那么如何使用 ActiveSupport::Callbacks 来创建回调呢? 1 require "active_support/all" ...原创 2017-05-14 14:16:37 · 2878 阅读 · 0 评论 -
[ROR] windows 上安装 rails
实在没办法 ,只能临时用一下windows 来 跑一下 rails了。 首先 Ruby的下载地址是: http://rubyinstaller.org/downloads 一 、下载两个东西(同一个页面)一个是ruby的安装包,一个是 DEVELOPMENT KIT Ruby在安装的过程过,将所有的 勾都打上。 二、安装这两个包后,进入DEVELOPME原创 2017-04-30 20:31:14 · 1081 阅读 · 1 评论 -
[Jquery] 当 radio 的 checked="checked" 无法再次使用 attr("checked","checked")
如果后面的 radio 的 checked="checked" 无法再次使用 attr("checked","checked")想做的功能是 当 后面的input 输入的时候 ,然后自动 选定 checkbox当时遇到 一脸懵逼,尝试过 先 removeAttr,然后再选中 也不行然后是使用$(inputcheckbox).prop("checked",true);完整的是 :$("input[t...原创 2017-04-01 09:53:50 · 1604 阅读 · 0 评论 -
[Ruby On Rails] form_for 中的一些参数使用以及得到 params
from_for 的使用常用的是: <%= form_for :person, opention={} do |f| %> First name: <%= f.text_field :first_name %><br /> Last name : <%= f.text_field :last_name %><br /> <%= f.submit %> <% end %>会得到 param原创 2016-07-30 15:05:23 · 6294 阅读 · 0 评论 -
[Ruby On Rails] Rails 路由学习笔记
文/零小白(简书作者) 原文链接:http://www.jianshu.com/p/Ro4HZT 参考 RailsGuides中的Rails Routing from the Outside In 简介 Rails 路由会通过你配置的路由规则将发送来的 URL 分发到对应的 action 中。它同时会生成 paths 和 urls 来避免你在视图中使用硬编码。 R转载 2016-05-21 15:00:57 · 3250 阅读 · 0 评论 -
[Ruby on Rails实战圣经]Ajax 应用程式
Ajax 应用程式 It's not a bug - it's an undocumented feature. - Unknown Ajax是Asynchronous JavaScript and XML的缩写,是一种不需要重新整理页面,透过JavaScript来与伺服器交换资料、更新网页内容的技术。目的在于改善使用者的操作介面,提升流畅度。它主要是透过浏览器提供的XML翻译 2016-06-02 10:56:49 · 1387 阅读 · 0 评论 -
[Ruby On Rails] Action Controller - 控制HTTP 流程
Controlling complexity is the essence of computer programming. — Brian Kernighan HTTP通讯协定是一种Request-Response (请求-回应)的流程,客户端(通常是浏览器)向伺服器送出一个HTTP request封包,然后伺服器就回应一个response封包。在上一章中,我们介绍了Rails如何翻译 2016-05-31 16:50:38 · 5285 阅读 · 0 评论 -
[ROR] rails migration 中继承 ActiveRecord::Migration[5.1] 带版本号实现原理
在Rilas5 以后 migration文件中的一般继承都会带有版本号,初看是正常的,可是如果自己写的话就会保存,这种写法本身Ruby是不支持的 譬如: class A[5.1] end 这种写法本身就是错误的,我是比较迟钝的,也没有反应过来这rails到底是这么实现的,如是 我就去看了源码 源码的实现方式是: class Current < Migration # :no原创 2017-05-21 17:31:24 · 1987 阅读 · 0 评论