-
-
Save nesquena/357273 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
project :test => :shoulda, :renderer => :haml, :stylesheet => :sass, :script => :jquery, :orm => :activerecord, :dev => true | |
#default routes | |
APP_INIT = <<-APP | |
get "/" do | |
"Hello World!" | |
end | |
get :about, :map => '/about_us' do | |
render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!" | |
end | |
APP | |
inject_into_file 'app/app.rb',APP_INIT, :after => "#\n end\n" | |
# generating posts controller | |
generate :controller, "posts get:index get:show" | |
POST_INDEX_ROUTE = <<-POST | |
@posts = Post.all(:order => 'created_at desc') | |
render 'posts/index' | |
POST | |
POST_SHOW_ROUTE = <<-POST | |
@post = Post.find_by_id(params[:id]) | |
render 'posts/show' | |
POST | |
inject_into_file 'app/controllers/posts.rb', ', :with => "hello"', :after => "get :show" # doesn't run? | |
# inject_into_file 'app/controllers/posts.rb', POST_INDEX_ROUTE, :after => "get :index do\n" | |
# inject_into_file 'app/controllers/posts.rb', POST_SHOW_ROUTE, :after => "get :show do\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment