`
JasonChi
  • 浏览: 91983 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论
文章列表
By Sarah | June 21, 2009 <!-- .entry-meta --> Rails enables web services by default, which is pretty awesome, and I’ve been relying on that for a while. It is pretty nifty how Rails will magically parse XML post parameters, create an in-memory object and then save that object to the databa ...
今天在帮同事解决一个rails通过rjs实现ajax功能的时候发现一个问题: 一般出现ajax不work的时候都会分几步去解决问题: 1.查看action是否能接收页面传给的参数(如果未接收就是页面写法错误) 2.查看action处理后得到结果的格式是否正确 3.调试rjs,查看action是否返回rjs处理页面逻辑(确认rjs格式书写正确) 今天前2步都work了,到第3步,我用page.alert(),竟然不输出 于是认为程序没有运行到rjs,应该是action出现的问题,但一直没有知道问题所在。 结果让rjs只留page.alert()一行,输出成功,说明已经跑到rjs了, 查看去掉代 ...
CKEditor/FCKEditor 使用-CKEditor(FCKeditor)精简版大全 ·         CKEditor/FCKEditor 使用-CKEditor(FCKeditor)精简版大全 ·         CKEditor/FCKEditor 使用-FCKeditor 2.6.5 快速教程(含插入图片) ·         CKEditor/FCKEditor
您很可能听说过 Ruby on Rails。甚至有可能使用过它;或者是刚刚开始使用它进行编程。相信大家已经看出本文的主题就是 Rails,不论读者属于哪种情况,都将从本文中受益。Ruby 与 XML 是一对梦幻组合 —— 欲知详情请继续阅读。 ...
require "migration_helpers"class AddToPostUserForeignKey < ActiveRecord::Migration extend MigrationHelpers def self.up add_foreign_key(:posts, :user_id, :users) end def self.down remove_foreign_key(:posts, :user_id) endend
ApplicationController: before_filter :session_expiry, :except => [:login, :logout] before_filter :update_activity_time, :except => [:login, :logout] def session_expiry @time_left = (session[:expires_at] - Time.now).to_i unless @time_left > 0 reset_session flash[:erro ...
1. attr_reader :name attr_writer :name 2. attr_accessor :name 1=2
最近经常使用select下拉标签 个人比较喜欢用select 和 select_tag 两个 [b]select_tag(name, option_tags = nil, options = {}) [/b] Creates a dropdown selection box, or if the :multiple option is set to true, a multiple choice selection box. Helpers::FormOptions can be used to create common select boxes such as count ...
window ->preferences Ruby  -> 选择ruby路径 Rails -> 选择rails路径 mysql 安装! 安装目录 bin下放,libmySQL.dll 具体待解决
def mpart_atts= atts atts.each do |att| if !att[:part].blank? and att[:id].blank? mparts.build(att) elsif !att[:part].blank? and !att[:id].blank? item = mparts.detect{|i| i.id == att[:id].to_i} item.attributes = att end end end mp ...
首先强制修复数据,将数据导出,my.ini中设置innodb_force_recovery=1,重启mysql。 然后重新创建一个数据库 将导出数据导入 引用 今天经历了一次痛苦的mysql表修复操作,感觉还是比较有意义的,写出来供大家参考 某客户的mysql出现 ...
1、下载mysql-3.23.35-win.zip并解压; 2、运行setup.exe;选择d:\mysql,"tyical install" 3、启动mysql,有如下方法: 方法一:使用winmysqladmin 1)、进入d::\mysql\bin目录,运行winmysqladmin.exe,在屏幕右下角的任务栏内会有一个带红色的图符 2)、鼠标左键点击该图符,选择“show me”,出现“WinMySQLAdmin”操作界面;首次运行时会中间会出现一个对话框要求输入并设置你的用户名和口令 3)、选择“My.INI setup” 4)、在“mysql ...
你可能在使用MySQL过程中,各种意外导致数据库表的损坏,而且这些数据往往是最新的数据,通常不可能在备份数据中找到。本章将继上篇文章中检查出表的问题后,告诉你如何修复表。   一张损坏的表的症状通常是查询意外 ...

7月29日 日志

在维护一对多  多一端的关系的时候 如果我更新,rails为什么会把 多一端的数据先全部删除 然后再全部写入? 是不是我代码写的问题吗?
用image magic插件实现图片上传, from_tag :action=>"create" :multipart=>true do from_for :product,:url=>{:action=>'create'},:html=>{:multipart=>true} do |form| 为什么form_tag不行 form_for可以呢
Global site tag (gtag.js) - Google Analytics