Created
August 20, 2012 15:13
-
-
Save umuro/3405055 to your computer and use it in GitHub Desktop.
A template to create a blog with hobo. Quickly!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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