本节主要是安装 restful_authentication
ruby script\plugin install -r 3702 http://svn.techno-weenie.net/projects/plugins/restful_authentication/
将产生类似的输出
+ ./README
+ ./Rakefile
+ ./generators/authenticated/USAGE
+ ./generators/authenticated/authenticated_generator.rb
+ ./generators/authenticated/templates/activation.html.erb
+ ./generators/authenticated/templates/authenticated_system.rb
+ ./generators/authenticated/templates/authenticated_test_helper.rb
+ ./generators/authenticated/templates/controller.rb
+ ./generators/authenticated/templates/fixtures.yml
+ ./generators/authenticated/templates/functional_spec.rb
+ ./generators/authenticated/templates/functional_test.rb
+ ./generators/authenticated/templates/helper.rb
+ ./generators/authenticated/templates/login.html.erb
+ ./generators/authenticated/templates/mailer.rb
+ ./generators/authenticated/templates/mailer_test.rb
+ ./generators/authenticated/templates/migration.rb
+ ./generators/authenticated/templates/model.rb
+ ./generators/authenticated/templates/model_controller.rb
+ ./generators/authenticated/templates/model_functional_spec.rb
+ ./generators/authenticated/templates/model_functional_test.rb
+ ./generators/authenticated/templates/model_helper.rb
+ ./generators/authenticated/templates/observer.rb
+ ./generators/authenticated/templates/signup.html.erb
+ ./generators/authenticated/templates/signup_notification.html.erb
+ ./generators/authenticated/templates/unit_spec.rb
+ ./generators/authenticated/templates/unit_test.rb
+ ./install.rb
+ ./lib/restful_authentication/rails_commands.rb
Restful Authentication Generator
====
This is a basic restful authentication generator for rails, taken
from acts as authenticated. Currently it requires Rails 1.2.6 or above.
To use:
./script/generate authenticated user sessions \
--include-activation \
--stateful
The first parameter specifies the model that gets created in signup
(typically a user or account model). A model with migration is
created, as well as a basic controller with the create method.
The second parameter specifies the sessions controller name. This is
the controller that handles the actual login/logout function on the
site.
The third parameter (--include-activation) generates the code for a
ActionMailer and its respective Activation Code through email.
The fourth (--stateful) builds in support for acts_as_state_machine
and generates activation code. This was taken from:
http://www.vaporbase.com/postings/stateful_authentication
You can pass --skip-migration to skip the user migration.
If you're using acts_as_state_machine, define your users resource like this:
map.resources :users, :member => { :suspend => :put,
:unsuspend => :put,
:purge => :delete }
Also, add an observer to config/environment.rb if you chose the
--include-activation option
config.active_record.observers = :user_observer # or whatever you
# named your model
Security Alert
====
I introduced a change to the model controller that's been tripping
folks up on Rails 2.0. The change was added as a suggestion to help
combat session fixation attacks. However, this resets the Form
Authentication token used by Request Forgery Protection. I've left
it out now, since Rails 1.2.6 and Rails 2.0 will both stop session
fixation attacks anyway.
======================
ruby script\generate authenticated user sessions
将创建模型类、数据库迁徙任务、html视图等文件。
rake db:migate 执行数据库迁徙任务
书中进行简单的routing,并将若干种controller共同的代码移到application.rb文件中
restful_authenticated插件的功能与Agile Web Development with Rails书中讲述的方法基本一致。只是使用更方便了?
==========
Pomodo.mxml详解
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
backgroundGradientColors="[#ffffff, #c0c0c0]"
width="100%"
height="100%">
<mx:HTTPService
id="helloSvc"
url="/hello/sayhello"
method="POST"/>
<mx:Button label="call hello service"
click="helloSvc.send()"/>
<mx:TextInput text="{helloSvc.lastResult}"/>
</mx:Application>
Flex应用的根元素一定应该是 mx:Application
The mx: part dentifies the XML namespace that the Application component is from.
We use vertical layout to make the components flow vertically.
Other choices are horizontal for horizontal flow) and absolute (where you specify the x,y of each toplevel ontainer).
The backgroundGradientColors specify the start and end of he gradient fill for the background
HTTPService 元素用来调用HelloController的sayhello方法,在默认情况下,Rails中URLs are mapped /controller_name/action_name. 控制器的名字首字母是大写的,并且假定有Controller,因此 /hello maps to HelloController,and sayhello maps to the sayhello action (which is a method); url="/hello/sayhello" maps to the sayhello method of the HelloController class.
We aren’t passing any parameters right now; you’ll do this soon when you try to log in.
The id of the HTTPService is helloSvc
在MXML中,控件的id属性是该控件的名字。如果我们不指定一个id,flex将随机生成一个id,这样的话,代码中就不能引用它了。
总体来讲,上面的代码还是很好懂的。
分享到:
相关推荐
### Flexible Rails: Flex3 on Rails2 #### 关于Flexible Rails 本书《Flexible Rails: Flex 3 on Rails 2》由Peter Armstrong撰写,旨在探讨如何结合使用Flex 3和Rails 2来开发高效的富互联网应用程序(Rich ...
#### 知识点二:Ruby on Rails (Rails) - **简介**:Ruby on Rails(简称 Rails)是一种基于Ruby语言的开源Web应用框架。它遵循Model-View-Controller(MVC)架构模式,旨在简化Web开发过程。 - **特点**: - **...
标题 "rails查询学习笔记" 涉及的是Ruby on Rails框架中的数据库查询技术。Ruby on Rails,简称Rails,是一款基于Ruby语言的开源Web应用程序框架,它遵循MVC(模型-视图-控制器)架构模式,使得开发Web应用更加高效...
综上所述,Ruby on Rails的笔记内容涵盖了从安装Rails环境到创建和运行一个简单的Rails项目的基础知识,这些内容对于初学者来说是学习Rails框架的极好入门材料。通过对这些知识点的学习,初学者可以快速了解Rails的...
### Ruby on Rails 笔记知识点总结 #### 一、引言 在《Ruby on Rails笔记》中,作者陈刚分享了他在学习Ruby on Rails过程中的经验与心得。这份笔记不仅包含了作者的学习历程和个人体会,还汇集了他在学习过程中遇到...
从给定的文件信息来看,这份文档是陈刚关于Ruby on Rails的学习笔记,旨在帮助初学者更好地理解并掌握Ruby on Rails这一流行的Web开发框架。以下是对文档中提及的关键知识点的详细解析: ### 安装与配置 #### Ruby...
rails官网入门笔记的翻译,非常不错的rubyonrails入门教程!
#### 二、Rails 的指导原则和理念 Rails 采用了几个核心的设计理念,这些理念使得 Rails 成为了一个高效的 Web 开发框架: 1. **DRY (Don't Repeat Yourself)**: - 通过减少重复代码的编写,提高代码的可维护性...
### Rails 入门详细笔记知识点解析 #### 一、环境搭建 在开始使用 Rails 进行开发之前,首先需要确保你的开发环境满足以下条件: - **Ruby 版本**:推荐使用 Ruby 1.9.2 或更高版本。这是因为早期版本如 1.8.7 ...
#### 二、作者介绍与背景 - **作者**: xdite,一位经验丰富的开发者,专注于Ruby on Rails框架。 - **作品**: 除了《Rails 101 入门电子书》外,xdite还编写了其他几本书籍,如《Maintainable Rails View》、《Lean...
此外,第二版还深入讨论了Rails 3.x和4.x中的路由系统,以及如何使用Unobtrusive JavaScript(UJS)实现更干净、分离的前端代码。 这两本书都强调了敏捷开发的原则,如迭代开发、持续集成、用户故事和重构。它们...
Ruby on Rails,通常简称为Rails,是一个基于Ruby编程语言的开源Web应用框架,遵循MVC(Model-View-Controller)架构模式。这个“Rails项目源代码”是一个使用Rails构建的图片分享网站的完整源代码,它揭示了如何...
《Rails101_by_rails4.0》是一本专注于Rails 4.0.0版本和Ruby 2.0.0版本的自学教程书籍,它定位于中文读者,旨在成为学习Rails框架的参考教材。Rails(Ruby on Rails)是一个采用Ruby语言编写的开源Web应用框架,它...
Rails 3.1 和 Cucumber-Rails 1.2.0 是两个在Web开发领域非常重要的工具,尤其对于Ruby on Rails框架的测试和自动化流程。本文将深入探讨这两个组件,以及它们如何协同工作来增强软件开发的效率和质量。 首先,...
有机会再试一试Rails了,只是原来接触的是2,现在已然变成了4,似乎现在的安装比原来会快些。。 Rails 4 安装 针对于安装了RVM 代码如下:gem install rails没有的话应该这样: 代码如下:sudo gem install rails安装...
#### 二、什么是Rails? - **定义**:Rails是一种用于快速开发Web应用程序的开源框架,基于Ruby语言。 - **特点**:Rails遵循“约定优于配置”的原则,简化了Web应用的开发过程,使得开发者能够专注于业务逻辑而非...
标题 "Rails" 指的是 Ruby on Rails,一个开源的Web应用程序框架,它基于Ruby编程语言,遵循MVC(模型-视图-控制器)架构模式。Rails由David Heinemeier Hansson在2004年创建,其设计理念是强调代码的简洁性、DRY...