Application version number and cool codename based on subversion number
#codename generated from the dictionary REVISION_NUMBER = `svn info`.split("\n")[4][/\d+/].to_i APP_CODENAME = IO.readlines("/usr/share/dict/words")[REVISION_NUMBER]
DZone Snippets > heavysixer > Ruby on Rails
12389 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
#codename generated from the dictionary REVISION_NUMBER = `svn info`.split("\n")[4][/\d+/].to_i APP_CODENAME = IO.readlines("/usr/share/dict/words")[REVISION_NUMBER]
APP_VERSION = IO.popen("svn info").readlines[4]
if @logged_in_client page.replace_html "message", :partial => 'shared/bad_login' else page.redirect_to "whatever you want here" end
render :update do |page| if @logged_in_client page.replace_html "message", :partial => 'shared/bad_login' else page.redirect_to "whatever you want here" end end
# view <%= form_tag :controller => :posts, :action => create %> <%= text_field("post", "title", "size" => 20) %> <%= text_field("user", "email", "size" => 20) %> <%= end_form_tag %>
# posts_controller class PostsController < ApplicationController def create @post = Post.create(params[:post]) @user = User.create(params[:user]) @post.users << @user end end
def file=(new_file) new_file.rewind image = Magick::Image::from_blob(new_file.read).first end