rails plugin是什么,自己google吧
生成plugin骨架代码:
ruby script\generate plugin MyPlugin
功能需求:
在BlogController中把所有符合条件的Post(Model)生成为xml
如果不使用插件,很easy :
in BlogController
def export_to_xml
posts = Post.find(:all, :order => 'published_date',
:conditions => ['title = ?', 'love'])
send_data posts.t ...
- 18:14
- 浏览 (178)
- 评论 (0)
- 分类: ruby on rails
最近学习一下typo,看typo的theme是怎样实现的,顺便把theme模块抽出来,以后编写rails应用(比如Blog),直接把代码COPY进去就可以.
1)修改routes.rb, add以下code:
map.with_options(:conditions => {:method => :get}) do |get|
get.with_options(:controller => 'themes', :filename => /.*/, :conditions => {:method => :get}) do |theme|
theme.connect 'st ...
- 15:46
- 浏览 (398)
- 评论 (5)
- 分类: ruby on rails
最近下载一个rails blog应用(Simplelog)并把它里面的acts_as_taggable plugin改为Acts As Taggable On Steroids,因为在rails2.0下总是运行出错.
1.安装
ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids
2.建立数据
生成migration:
ruby script/generate acts_as_taggable_migration
生成数据:
r ...
- 15:07
- 浏览 (428)
- 评论 (0)
- 分类: ruby on rails
ActionMailer是一个简单的Rails组件,应用程序可以借助它来收发电子邮件。
Gmail--你必须有一个账号和密码,没有的话快去申请http://mail.google.com/mail/signup
邮件配置:
在enviroment.rb文件中:
ActionMailer::Base.server_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:user_name=> "gmail_account",
:password ...
- 23:59
- 浏览 (531)
- 评论 (1)
- 分类: ruby on rails
- 浏览: 1891 次
- 性别:

- 来自: 广东汕头

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
rails theme(参考typo)
就没有性能好一点的多theme插件吗?我看了theme_support,也不好, ...
-- by qichunren -
rails theme(参考typo)
今天折腾了两个多小时,把一个应用改成这种形式了,可现在发现一个问题,所有的ima ...
-- by 系统程序 -
rails theme(参考typo)
实际上 typo 实现 themes 方法老旧竟然要在rails 矿家之外放 个 ...
-- by fatticat -
使用Gmail Smtp 发送emai ...
FYI: Rails 2中应该用ActionMailer::Base.smtp_ ...
-- by ashchan -
rails theme(参考typo)
谢谢,这几天要做一个多模版的东东,本来都已经想改回php写的,想想rails里也 ...
-- by 系统程序






评论排行榜