Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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