首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

回顾总结(1)

2013-03-12 
回顾总结(一)? ? ? ? ? ? ? ? ? ? ? ?搜索:安装thinking-sphinx,在Gemfile中添加下面代码: ?gem thinking

回顾总结(一)

? ? ? ? ? ? ? ? ? ? ? ?搜索:安装thinking-sphinx,在Gemfile中添加下面代码: ?gem 'thinking-sphinx'?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 配置在config下新建一个文件sphinx.yml,里面添加如下代码:?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? development:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? port: 9312

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bin_path: /usr/local/coreseek/bin

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? searchd_binary_name: searchd

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? indexer_binary_name: indexer

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? # ?charset_type: utf-8

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? charset_dictpath: <%=::Rails.root.to_s+"/data/fulltext_dict"%>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? charset_type: zh_cn.utf-8

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? max_matches: 10000

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? test:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? port: 9313

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bin_path: /usr/local/coreseek/bin

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? searchd_binary_name: searchd

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? indexer_binary_name: indexer

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? charset_type: utf-8

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? production:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? port: 9312

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bin_path: /usr/local/coreseek/bin

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? searchd_binary_name: searchd

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? indexer_binary_name: indexer

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? charset_type: utf-8

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? max_matches: 10000

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 运行:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rake ts:start ?##起服务?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? rake ts:stop ? ##停服务?

? ? ? ? ? ? ? ? ? ? ? rails接口:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Active Record 查询

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 使用多种方法和条件表达式来查找数据

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 对查找到的数据进行排序,分组,取用字段值或者其它属性值

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 利用预加载来减少数据检索时执行的数据库查询次数

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 使用动态查找方法

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 检查记录的存在性

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 针对 Active Record 的 model 对象的统计方法 ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?关于 rails-sql 方法(根据参数生成相应的 SQL 查询语句):?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?where、select、group、order、reorder、reverse_order、limit、

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? offset、joins、includes、 lock、readonly、from、having ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?routes 路由:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 提交方式:GET、POST、PUT、DELETE?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 关键字:resource(它会为你的应用建立六个不同的 routes,都将匹配到相应的控制器)。例子:resources :users

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? nameplace(命名空间:你可以想要把一些同类的控制器组织到一个命名空间下面管理)。 例子:namespace :admin do resources :users end?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Member(成员路由:当你想用除了默认的这些路由,你还可以用member)。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 例子:resources :users do

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? member do

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? get 'setting'

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?得到url : users/1/setting ? ?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Collection (集合路由:你还可以用collection)?

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?例子:resources :posts do

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? collection do

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? get 'search'

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? end

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?得到url : users/search ??

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Member和Collection的区别,Member是属于单一结果的操作,Collection是对所有的进行操作。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? match (我要写个单一的url,与其他没有太大关联,可以用match,当然也可以写上面的url)。例子:match ‘users/search’ ? ? ??

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?rails接口:route + controller + model(查询) + json/xml ? ? ? ? ? ? ? ? ??

? ? ? ? 学习:

? ? ? ? ? ? ? ? 框架:

? ? ? ? ? ? ? ? ? ? ? ? ?rails 的Activeecord 的生命周期

? ? ? ? ? ? ? ? ? ? ? ? ?如何把方法尽可能的写如model中,使得代码重复使用。

? ? ? ? ? ? ? ? ? ? ? ? ?查询效率(消除N+1查询问题)。 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? 插件:

? ? ? ? ? ? ? ? 登录验证:Devise 的邮件验证

? ? ? ? ? ? ? ? 文件上传插件: carrierwave?

? ? ? ? ? ? ? ? ? ? ? ? 使用、上传到的图片效果

?4、网页展现:javascript、css

? ? ? ? ? ?掌握: javascript 编辑独立方法

? ? ? ? ? ? ? ? ? ? ? css 基本属性

? ? ? ? ? ? 学习:javascript 组件编程思想。

? ? ? ? ? ? ? ? ? ? ? css 组件的编程与复写

? ? ? ? ? ? ? ? ? ? ??

?5、学习:rails项目的部署与维护 ?

? ? ? ? ? ? 安装Apache+Passenger指令如下:

? ? ? ? ? ? ? ? ? ?代码: ?

? ? ? ? ? ? ? ? ? ? ? $ sudo apt-get install -y apache2-mpm-prefork apache2-prefork-dev libapr1-dev libaprutil1-dev libcurl4-openssl-dev

? ? ? ? ? ? ? ? ? ? ? $ sudo gem install passenger

? ? ? ? ? ? ? ? ? ? ? $ sudo passenger-install-apache2-module ? ??

? ? ? ? ? ? ? ? ? ?设置:

? ? ? ? ? ? ? ? ? ?例如:

? ? ? ? ? ? ? ? ? ? ? ? ? <VirtualHost *:80>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ServerName www.yourhost.com

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?DocumentRoot /somewhere/public

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?<Directory /somewhere/public>

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? AllowOverride all

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Options -MultiViews

? ? ? ? ? ? ? ? ? ? ? ? ? ? ?</Directory>

? ? ? ? ? ? ? ? ? ? ? ? ? </VirtualHost> ? ??

? ? ? ? ? ? ? ? ? ?重新启动Apache: ? ? ? ? ? ? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ? ? ? ? ?$ sudo apache2ctl restart?

热点排行