Sha256: b9a56f0d7745066a0ea7c03091e3f5496ad99ac3c249b21e4befacebe428931d
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
<%= @class_name %>::urls do # map(:index).to("/") # map(:test).to("/test") end =begin This file contains named routes to be used in the Padrino application. To create named routes simply add them to the urls block below. You can specify simple routes as: map(:index).to("/") map(:test).to("/test") Routes can also contain query parameters: map(:account).to("/the/accounts/:name/and/:id") Routes can also be grouped by a namespaced: map :admin do |namespace| namespace.map(:show).to("/admin/:id/show") namespace.map(:destroy).to("/admin/:id/destroy") end Routes can then be accessed in controllers and views: url_for(:account, :id => 1, :name => 'first') url_for(:admin, :show, :id => 25) To define the controller actions for a named route simply refer to the alias symbol: # Configure the routes using the named alias get(:account) { "name: params[:name] - id: params[:id]" } get(:accounts) { "I am the body for the url /the/accounts/index" } # and for namespaced routes namespace :admin do get :show do "admin show for #{params[:id]}" end end =end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
padrino-gen-0.1.2 | lib/generators/skeleton/config/urls.rb.tt |