ITeye博客

52jobs的博客

52jobs · 共 17 篇文章

rails 开发工具 textmate

增强 textmate 功能--- Validate and Save your Ruby in TextMate http://drnicwilliams.com/2010/06/01/validate-and-save-your-ruby-in-textmate-with-secret-rubinus-superpowers/ 使用 app scrolls生成 rails 项目 Instant new Rails applications with the App Scrolls http://drnicwilliams.com/?s=ruby gem install appscroll…

2014-02-23 22:59 · 评论(0)

rails 调试

#24 The Stack Trace A plugin called Rails Footnotes will turn the lines from the stack trace into clickable links that will open the appropriate file in TextMate. To install it, run the following line from your app’s directory (you’ll need to have git installed on your machine). terminal git clone …

2014-02-23 22:57 · rails · 评论(0)

rails 小技巧

#Rails Tip 1 Actions Are Methods http://errtheblog.com/posts/1-actions-are-methods class PostsController < ApplicationController def list_by_author list :conditions => ['author_id = ?', params[:id]] end def list(find_options = {}) @posts = Post.find(:all, { :order => 'created_on desc' }.merge(find_…

2014-02-23 22:55 · rails · 评论(0)

ruby 小技巧

#Track 1: The C in MVC #irb Mix Tape http://errtheblog.com/posts/24-irb-mix-tape #深入讲解 app http://pragmaticstudio.com/blog/2006/4/4/running-your-rails-app-headless $ ruby script/console #Loading development environment. >> app.url_for(:controller => 'stories', :action => 'show', :id => '10002') => …

2014-02-23 21:18 · rails · 评论(0)

rails 小代码合集 view controller model

Rails Create an image with link using the image helper <%= link_to image_tag("rails.png", alt: "Rails"), 'http://rubyonrails.org' %>01.gemfile #long_block_rhs.rb def self.logger @logger ||= begin (defined?(Rails) && Rails.logger) || (defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER) || defaul…

2014-02-23 13:18 · rails · 评论(0)

rails bash

1、一个完整的rails app自动生成bash #!/bin/bash clear echo -e "Preparing to start ...\n" cd /Users/gelias/workspace/ruby echo -e "removing oldest version ... \n" rm -rf /Users/gelias/workspace/ruby/cardapiaria echo -e "using ruby version 1.9.3 and Rails 3.2" rvm 1.9.3@rails32 echo -e "generating cardapiaria a…

2014-02-22 21:48 · rails · 评论(0)

实用工具--rails 命令、generator

1、rails 基本 rails new rails-bootstrap -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb rails new User_Auth -d mysql rails new $1 -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb rails g model comment content:text commentable_id:integer commentable_type rake …

2014-02-22 20:52 · rails · 评论(0)

rails 版本 更新/升级 release note

升级到 Rails 4,你的应用需要准备什么? 升级到 Rails 4 http://www.oschina.net/translate/get-your-app-ready-for-rails-4?print

2014-02-22 14:02 · rails · 评论(0)

理解rails gems plugins

#33 Making a Plugin 注意 这种手法,可能对 rails 4 不再起作用 rails4 http://guides.rubyonrails.org/plugins.html 关于废弃插件的说明 https://github.com/rails/rails/commit/dad7fdc5734a3813246f238ac5760b2076932216 rails 3及以下 [color=red]After loading the framework and any gems and plugins in your application,[/color] Rails turn…

2014-02-22 13:06 · rails · 评论(0)

日期 、路由辅助方法

#31 Formatting Time 方法一: Task.first.due_at.to_s =>2009-02-19 00:00:00 UTC Task.first.due_at.to_s =>(:long) February 19, 2009 00:00 Task.first.due_at.to_s(:short) =>19 Feb 00:00 Task.first.due_at.to_s(:long) Task.first.due_at.to_s(:db) =>2009-02-19 00:00:00 方法二、 <%= task.due_at.strftime("due on %B %…

2014-02-22 11:48 · rails · 评论(0)

Authentication 用户登录 用户权限相关

19Where Administration Goes#20 Restricting Access#21 Super Simple Authentication 以上三篇构一组 Authentication script/generate scaffold episode "admin/episodes" #Implementing The Admin Links <li> <p class="episodeId"><%= episode.episode_id %></p> <h3><%= link_to episode.title, episode_path(episode.identif…

2014-02-21 21:20 · rails · 评论(0)

ActiveRecord

ActiveRecord 4新特性 http://www.oschina.net/translate/get-your-app-ready-for-rails-4?print ActiveRecord 范围需要一个 Callable 对象。 在 Rails 4 中,所有 ActiveRecord 范围必须使用一个 callable 对象来定义: #Rails 3.2 scope :recent, where(created_at: Time.now - 2.weeks) #Rails 4 scope :recent, -> { where("created_at > ?", Time.now…

2014-02-21 20:39 · rails · 评论(0)

工作相关

工作经历: 2年制造业ERP开发及管理经验 2年旅游信息化整体方案 5年欧美软件外包开发及管理经验 兴趣爱好:本人专注于软件项目,目前为Agile所倾倒,喜欢SCRUM、XP、团队建设,同时对.Net、Ruby on Rails、开源软件、软件质量保证有极大的兴趣. 如果你不想加班, 如果你爱学习技术,钻研技术,如果你想和很多优秀的同事一起工作,那就请赶紧 联系我wangdeshui@gmail.com mac终端命令大全介绍 http://www.douban.com/note/75797151/

2014-02-21 20:27 · rails · 评论(0)

rails 开发工具相关

#使用TextMate进行Ruby On Rails开发推荐插件 ruby-on-rails-tmbundle https://github.com/drnic/ruby-on-rails-tmbundle/tree/master mkdir -p ~/Library/Application\ Support/TextMate/Bundles cd ~/Library/Application\ Support/TextMate/Bundles git clone git://github.com/drnic/ruby-on-rails-tmbundle.git "Ruby on Rails.…

2014-02-21 20:14 · rails · 评论(0)

rails view session layout

#208 erb-blocks 简介:在erb中使用blocks,可以为 html,封装逻辑 module ApplicationHelper def admin_area(&block) content_tag(:div, :class => "admin", &block) if admin? end def admin? true end end #234 simple_form <%= simple_form_for @product do |f| %> <%= f.error_messages %> <%= f.input :name %> <%= f.input :price, …

2014-02-21 19:00 · rails · 评论(0)