what is rails templates ?

generators can be used inside an application, they can also be used to generate applications too, This kind of generator is referred as a “template”.

example

gem(“rspec-rails”, :group => “test”)
gem(“cucumber-rails”, :group => “test”)

if yes?(“Would you like to install Devise?”)
gem(“devise”)
generate(“devise:install”)
model_name = ask(“What would you like the user model to be called? [user]”)
model_name = “user” if model_name.blank?
generate(“devise”, model_name)
end
here we specify

1) we want to add rspec-rails and cucumber-rails gem
2) asking whether or not like to install Devise. if answer is yes devise gem is added and then runs the devise:install generator
3) asking more input from user and run devise generator

 

if the file called template.rb. we can use it as follows

rails new myapp -m template.rb

 

For Rails Template Tutorials

http://guides.rubyonrails.org/generators.html
http://railsapps.github.com/rails-application-templates.html
http://blog.madebydna.com/all/code/2010/10/11/cooking-up-a-custom-rails3-template.html
http://quickleft.com/blog/rails-application-templates
http://m.onkey.org/rails-templates
For Rails Templates

http://railswizard.org/
http://appscrolls.org/
http://railsapps.github.com/rails-composer/
http://drone.bz/new

 

www.klairvoyant.in

Advertisements
This entry was posted in rails, ROR, ruby on rails, web development and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s