流水笔记一则.
我之前已在服务器配置了nginx,php,mysql等,现在先安装ruby企业版
cd /tmp
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
tar -xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
cd ruby-enterprise-1.8.7-2010.02
./installer
然后按照提示做
阅读剩余部分...
利用layout可以很好实现这个需求.
在ApplicationHelper内加入如下代码:
def require_js(path)
content_for :header_js do
include_js_tag path
end
end
def require_css(path)
content_for :header_css do
include_css_tag path
end
end
def include_js_tag(path)
if not path.starts_with?("http:")
path = "/themes/#{@setting[:theme]}/javascripts/" + path
end
javascript_include_tag path
end
def include_css_tag(path)
if not path.starts_with?("http:")
path = "/themes/#{@setting[:theme]}/stylesheets/" + path
end
stylesheet_link_tag path
end
(如果你要直接在view或者layout内引入css则可以<%= include_css_tag "global.css" %>,这样生成的路径是带有皮肤目录的)
接下来,修改你的layout的head,加入如下代码:
阅读剩余部分...
posted on
January 21, 2010
发现一个很棒的插件 rails_reviewer插件
安装:
$ script/plugin install git://github.com/dsboulder/query_reviewer.git
$ rake query_reviewer:setup
完毕后重启server,页面左上角浮动一个SQL CRITICAL浮动窗口,里面记录页面加载时执行的所有SQL以及优化建议等。
强烈推荐 !!!
posted on
January 15, 2010
从ubuntu换回了win7后又慢慢开始折腾以前在本本上跑的一些LAMP网站, php和 mysql还是用以前的xampp里的,仍然可以用。
重装了 ruby 1.8.6, rails 2.3.5 等...发现运行rails网站,弹出messagebox提示找不到libmysql.dll尝试把mysql/bin里的dll来regsvr32,不可,直接拷贝到system32目录下错误没了,但打开网站仍然报错,终端显示“Mysql::Error: query: not connected...."
阅读剩余部分...
posted on
September 24, 2009
Rails使用的ActiveRecord真性感啊,see see吧
class User < ActiveRecord::Base
has_many :articles
end
class Article < ActiveRecord::Base
belongs_to :user
end
然后执行
>> Article.find(1) 会得到延迟加载user对象的sql语句。如下:
阅读剩余部分...
posted on
August 29, 2009
安装好Ruby on Rails 2.3.3后,运行简单的页面提示如下错误“The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql”
gem 了n次也不成,搞了一早上,才google到一个比较山寨的方法解决
1. download older MySQL client library, for example one from InstantRails: http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll
2. copy the downloaded file to C:\Ruby\bin (or wherever you installed Ruby)
3. restart MySQL server
另参考:http://www.ruby-forum.com/topic/160358和http://rdc.taobao.com/blog/qa/?p=523
posted on
January 31, 2008
今天去逛CodePlex发现这个东西
链接到JavaEye的blog,作者:梁利锋
中文描述:http://llf.hanzify.org/llf/show.asp?id=555
Features:
FluentInterface query syntax
- RoR ActiveRecord style syntax
- Ambient transaction
- Dynamic object
- Partial update
- 1:1 1:Many Many:Many relations
- Auto create table
- Anti sql injection
- Multiple data source
- Object validation
- Paged selector and collection
- Nullable support
- DbEntryDataSource
- ASP.NET 2.0 Membership support
- Built-in Cache Support
- Ruby On Rails style MVC framework
- High performance, almost same as using ADO.NET directly
- Lightwight, the binary file only about 268KB
- Getting Started
- Scaffolding
- Controller
- Viewer
- Configuration
- Deployment
另外还有一些不错的东西比如他的 Rails Style MVC 和TemplateBuilder 还有 HtmlBuilder
看了看并没有Nbear那样类似Linq的查询支持.
令人欣慰的是这个东西一直从.net1.1做到现在,而且就一个人开发,从codeplex上来看,最近还有代码签入.
http://www.codeplex.com/DbEntry/SourceControl/ListDownloadableCommits.aspx
最后贴一下地址:http://www.codeplex.com/DbEntry