Skip to content

Instantly share code, notes, and snippets.

@umuro
Created August 20, 2012 15:13
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save umuro/3405055 to your computer and use it in GitHub Desktop.
A template to create a blog with hobo. Quickly!
# Creates a demo blog in a new hobo project
# Usage: rake rails:template LOCATION=template_demo_blog_hobo.rb
# Or: rake rails:template LOCATION=https://raw.github.com/gist/3405055/9aaac7c1c9e9571b32c4359fa9fff77c89de82a9/template_demo_blog_hobo.rb
say ("Installing gems so that we can scaffold...")
run 'bundle install'
generate 'hobo:setup_wizard' if yes? "Wanna run hobo:setup_wizard?"
generate 'hobo:resource', 'Post title:string text:text'
inject_into_class 'app/models/post.rb', 'Post' do
<<-EOS
attr_accessible :title, :text
default_scope :order => 'created_at DESC'
validates :title, :presence => true,
:length => { :minimum => 5 }
EOS
end
route "root :to => 'posts#index'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment