Adding new page into Rails 4 Application -


i have new rails project, in project have controller, view , model named customer. now, need beside crud actions need add 2 new pages like:

1. http://0.0.0.0:3000/customer/sale  2. http://0.0.0.0:3000/customer/lease 

and want insert code in these files. how achieve mean creating new sale , lease links?

in routes.rb file can add these 2 routes:

  resources :customers     collection       'create_sale' => 'customers#create_sale', as: :create_sale       'create_lease' => 'customers#create_lease', as: :create_lease     end   end 

then, can add 2 new methods (actions) in customers_controller.rb file:

  def create_sale     # logic goes here   end    def create_lease     # logic goes here   end 

and create 2 views them in app/views/customers/ directory create_sale.html.erb , create_lease.html.erb put view related code.


Comments