`
swachian
  • 浏览: 74660 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Resource-Based Routing

阅读更多

基本增加的内容

Resource-Based Routing依靠restful的风格,定义后增加下面4个helper

 

  client_url       show     update    destroy
  clients_url      index    create
  edit_client_url  edit
  new_client_url   new


  update和destroy通过传入:method来完成
    对于link_to form_tag可直接在client_url后面跟着:method => :delete
    对于form_for来说,会要求跟在一个嵌套hash中 form_for @client, :html => {:method=>:delete}

 

 

单复数route
  两种使用helper的形式
    client_url(@item)        ----参数形式
    clent_url(:id => @item)  ----hash形式

定义自己的action

map.resources :articles, :collection => { :recent => :get }
:collection增加了recent action包括
Method: get
path: /articles/recent
action: recent
helper: recent_articles_url

:member 则给某个实例增加action
map.resources :articles, :member => {:release => :put, :rollback => :put}
Method: put
path: /articles/1/release
action: release
helper: release_article_url

Nested Resources

 有些资源有依赖关系,需要成对出现
  嵌套定音的后果
    map.resources :auctions do |auction|
      auction.resources :bids
    end
      除了autions的4个helper,也为bids定义了auction_bids_url, new_auction_bid_url等等helper。
      nested 使得任何使用bid routes的时候,必须提供auction资源
      对于singular routes需要提供至少两个参数
    
    :name_perfix 使得可以定义helper的前缀
      用nil表示取消前缀
   对于form_for可以采用
     <% form_for([:admin, @post]) do |f| %>

分享到:
评论

相关推荐

    Message matching-based greedy behavior detection in delay tolerant networks

    Delay tolerant networks (DTNs) are resource-constrained networks where messages are relayed in a store-carry-forward fashion. In most routing protocols of DTNs, each node is required to honestly relay...

    软件测试相关论文-英文原文82篇

    Pires2016 - Secure Content-Based Routing Using SGX.pdf Pires2017- A lightweight MapReduce framework for secure processing with SGX.pdf Proof of Luck- an Efficient blockchain consensus protocol.pdf ...

    OpenStack Networking Guide

    Role-Based Access Control (RBAC) Routed provider networks Service function chaining SR-IOV Subnet pools Service subnets Trunking Deployment examples Prerequisites Mechanism drivers Operations IP ...

    qulity of sevices in networks

    4. **基于约束的路由(Constraint-Based Routing)**:这种路由技术允许管理员指定路由选择的标准,例如最小延迟或最大跳数,从而更好地满足特定的服务质量要求。 5. **基于策略的路由(Policy-Based Routing)**:...

    Cisco.Press.CCIE.Self.Study.CCIE.Security.Practice.Labs

    The explosive growth of the Internet economy over the past several years and new IP-based enterprise applications has heightened requirements for continuous availability of mission-critical data....

    CCIE 精通QOS 中文

    7. **策略路由(Policy-Based Routing)**:根据特定条件(如源地址、目的地址、服务类型等)选择最佳的转发路径。 在CCIE LAB考试中,考生可能需要配置和调试这些QoS特性,以解决实际网络问题。例如,确保VoIP流量...

    GMPLS在自动交换光网络控制平面中的应用

    它提供了一套完整的协议集,包括LDP(Label Distribution Protocol,标签分布协议)、RSVP-TE(Resource Reservation Protocol - Traffic Engineering,资源预留协议-流量工程)、CR-LDP(Constraint-based Routing ...

    02-MPLSTE配置[收集].pdf

    CR-LSP(Constraint-Based Routing Label Switched Path)是一种特殊的LSP,用于在网络中承载流量。CR-LSP可以根据网络流量的变化情况,动态地调整网络路径,避免网络拥塞,提高网络可靠性和带宽利用率。 1.1.5 ...

    配置转发捷径将流量引入TE隧道示例.zip

    3. **LSP建立**:使用 RSVP-TE(Resource Reservation Protocol - Traffic Engineering)或CR-LDP(Constraint-Based Routing - Label Distribution Protocol)来建立LSP,指定隧道的入口和出口点,以及中间经过的...

    Cognitive Radio Networks

    7.3.2 Radio Resource Sensing 216 References 228 8 Medium Access Control 231 8.1 MAC for Cognitive Radios 231 8.2 Multichannel MAC 232 8.2.1 General Description of Multichannel MAC 235 8.2.2 ...

    QOS.rar_quality of service

    6. 路径选择:通过策略路由(Policy-Based Routing, PBR)或等价路径负载均衡(Equal-Cost Multi-Path, ECMP),QoS可以指定某些流量通过特定路径传输,以优化网络性能。 QoS的应用场景广泛,包括但不限于: 1. ...

    无线多媒体传感器网络论文:基于无线多媒体传感器网络的图像分布式处理技术的研究.docx

    Despite common traits like self-organization, multi-hop routing, and resource constraints, WMSNs exhibit distinctive characteristics in energy distribution, QoS requirements, network security, and ...

    restful restful所需要的jar包

    This results in a very flexible yet simple routing with automatic extraction of URI variables into request attributes. * Tunneling service lets browsers issue any HTTP method (PUT, DELETE, MOVE, etc...

    论文学习-jsp企业财务管理系统设计与实现任务书.doc

    A semantics-based routing scheme for grid resource discovery[M]. E-Science. 14. Watts D J. Small Worlds. The dynamics of networks between order and randomness[P]. America: 56A2579BB6, l999-05-13. 15....

    AkkaScala.pdf

    3. **Elasticity:** Akka allows applications to dynamically adjust their resource utilization based on load, making it ideal for cloud environments where resources can be scaled up or down as needed. ...

Global site tag (gtag.js) - Google Analytics