Ruby On Rails Commands

ADVERTISEMENT

Ruby On Rails – A Cheatsheet
Ruby On Rails Commands
update rails
gem update rails
create a new application
rails application
generate documentation
rake appdoc
view available tasks
rake --tasks
view code statistics
rake stats
start ruby server at
ruby script/server
ruby script/generate controller Controllername
ruby script/generate controller Controllername action1
action2
ruby script/generate scaffold Model Controller
ruby script/generate model Modelname
URL Mapping
Naming
Class names are mixed case without breaks:
MyBigClass, ThingGenerator
Tablenames, variable names and symbols are lowercase with an
underscore between words
silly_count, temporary_holder_of_stuff
ERb tags
<%=
%>
<%
%>
ending with -%> will surpress the newline that follows
use method
to escape html & characters (prevent sql attacks, etc)
h()
Creating links
<%= link_to “Click me”, :action => “action_name” %>
Compiled from numerous sources by
Last updated 12/6/05

ADVERTISEMENT

00 votes

Related Articles

Related Categories

Parent category: Education