1.
ganesh > rails new sample
2.
ganesh > cd sample
3. Open application_controller.rb
sample/app/controllers/application_controller.rb
4. Create method inside the application_controller
class ApplicationController < ActionController::Base def index end end
6. Now create application folder (name) inside the views and create index.html.erb
sample/app/views/application/index.html.erb
Add this text to html page : Welcome to Rails
7. Need to edit routes.rb - sample/config/routes.rb
Add :
root 'application#index'
application => Controller name
index => method name
8. Run the application in terminal.
ganesh > rails server
Note : Default port 3000
9. Open browser and enter address like this
localhost:3000
or
ipaddress:3000
Output :
Comments
Post a Comment