rails URL路由

Rails URL Helpers 深度解析:path 与 url 的本质区别及工程实践 URL 生成是 Web 应用路由交互的基础能力,其核心在于路径(path)与绝对 URL(url)的抽象分层。path 表示相对资源位置,依赖当前上下文;url 则需完整协议、主机、端口等信息,适用于邮件、API 调用等无请求上下文场景。Rails 通过约定优于配置机制,将路由定义、辅助方法生成与视图渲染解耦,使 `articles_path` 等 helper 具备自动编码、参数注入与 Turbo 集成能力。正确使用不仅能规避 404、重定向循环与开放重定向等典型线上问题,更是保障多环境部署、子路径支持( 阅读详情

   rails URL路由的最权威文档当然是其官方站点Rails routing from the outside in,我这里只提几个文档中常用的要点。

1.CRUB

   由resources建立的资源,是rails中最常见的路由方式,不用多说。
resources :photos

2.单例资源

   单例资源也比较常用,官方文档上举的例子很形象也很常见,用户user需要拥有一个profile资源,而每个用户必然只有一个profile,所以如果生成类似/profiles/:id的URL显然是不美观的,此时就需要单例资源,单例资源的生成使用的是单数形式方法resource:
resource :profile

   该语句生成的路由如下:


3.嵌入的路由

    适用于某种资源必须依赖于另一种资源才有意义,比如某些comment必然在针对的event下存在,所以comment就必须依赖于event。
resources :events do
    resources :comments
end


    对应的也自动生成了诸如event_comment_path之类的url 帮助方法。对于嵌入式资源,官方建议不要超过两层。最简单的理由,路由层次过深,除了增加逻辑的复杂度外,也得不到任何好处。

4.namespace和scope路由

    以下规则同时适用于resources和controller。
    比如,如果想要在特定的命名空间(admin)下访问某个资源(post),这时就可以利用namespace。
namespace :admin do
  resources :posts
end

    此时,处理该路由的controller是Admin::PostsController,体现在rails工程中是在controller文件夹下的admin文件夹下的posts_controller.rb文件。而产生的路由全部以/admin开头:

    一言以蔽之,由namespace产生的资源路由,controller和url都由该namespace作“前缀”。
    如果需要让资源路由没有前缀,而又希望该路由url被某个模块下的controller受理,那么就需要使用scope。
scope module: 'admin' do
  resources :posts
end
 
    由rake routes输出可以看出,路由url没有了admin前缀,而posts资源都由admin模块下的Admin::PostsController受理。
    一言以蔽之,带module的scope产生的资源路由,路由url无“前缀”,controller以module指定模块为“前缀”。
   反过来,如果希望给资源附加一个前缀,而由普通controller受理该url,则需要另一种形式的scope:
scope '/admin' do
  resources :posts
end


    此时,资源posts每个url都附加了/admin为前缀,而受理这些url的是PostsController。
    一言以蔽之,这种形式的scope产生的资源路由,路由url有“前缀”,controller无“前缀”。
    另外,这种形式的路由还有一种简写:
resources :posts, path: '/admin/posts'

    该简写和使用scope产生的结果完全一样。不过,path还有另外的用途,如果保持controller及url helper不变,仅仅希望为url路由中的资源改个名称,这时path就派上用场了:
resources :posts, path: '/articles'



5.新增RESTful动词

    以下规则同样适用于resources和controller。
resources :photos do
  get 'preview', on: :member
end

    该语句为某个特定photo新增了一个preview动作,该动作是一个get请求,默认photos_controller中存在一个preview方法处理该动作。
    类似的,如果需要为photos集合新增一个动词,只需要将语句中member改成collection即可。
    如果,需要为特定photo增加多个动词preview1和preview2,改成下面的形式即可,甚至可以指定controller中处理该请求的方法,以及自定义url helper:
resources :photos do
  member do
    get 'preview1'=>:pre1, as:"p1"
    get 'preview2'=>:pre2, as:"p2"
  end
end



6.非resourceful路由

使用参数:

controller :photos do
  get 'check/:id',:to=>:check
end

   产生的路由输出如下:
GET /check/:id(.:format) photos#check

    在执行该get请求如/check/23,后photos_controller的check方法受理该请求,并在params中将参数设置为23。

限制参数格式:

get 'photos/:id', to: 'photos#show', constraints: { id: /[A-Z]\d{5}/ }

    该路由规则能接受/photos/A12345却不能接受/photos/893。

指定请求的默认类型:

    
get 'articles/:id', to: 'articles#show', defaults: { format: 'xml' }
    若get请求/articles/2,该路由规则会自动将params的params[:format]置为"xml"。
    该方法仅仅是在请求未指定format时指定默认类型,如果需要某个controller仅接受某些格式的请求如xml和json,则可以在该controller类定义中添加如下代码,这在书写api时常常用到:
respond_to :json, :xml

更换资源的controller:

   如果不希望为某个资源使用默认的controller,则:
resources :photos, controller: 'images'

    此时photos资源的所有请求都由images_controller受理,而photos的路由url和url helper都不变。

限制资源的默认动作:

   如果仅希望使用资源的部分动作,如仅使用资源photos的index和show动作:
resources :photos, only: [:index, :show]

    或者使用除了destroy动作外的所有默认动作:
resources :photos, except: :destroy
     还可以使用:all(所有默认动作),:none(没有默认动作):
resources :photos, :only=>:none


为new和edit的url路由改名:

resources :photos, path_names: { new: 'make', edit: 'change' }

    产生的新路由为:
/photos/make
/photos/1/change

    而此时受理该路由的方法仍为new和edit,即controller中的方法并未改名。


31、Rails开发:事务、路由与URL生成详解 本文深入讲解了Rails开发中的核心内容,包括数据库事务的使用、Active Record的内置事务支持、多数据库事务的局限性以及乐观锁的实现机制。同时,详细介绍了Action Controller中的路由和URL生成机制,涵盖了基本路由定义、命名路由、控制器命名规则等,并通过实验和示例代码展示了其具体用法。文章最后总结了事务处理和路由机制的实践建议,帮助开发者更好地构建高效、稳定的Web应用。 阅读详情

相关推荐

20、Rails开发中的杂项与路由详解

本文详细介绍了Rails开发中的Active Record杂项知识,包括单位转换、对象标识、原始数据库连接以及特殊列名的使用。同时,深入解析了Action Controller与Rails路由机制,涵盖路由规则配置、URL生成、命名路由、异常处理、安全策略及性能优化等内容。通过这些知识,开发者可以更好地构建高效、灵活、安全的Rails应用程序。

cake8的博客 67

rails中获取url信息的一些方法

转自:http://zool.me/rails/rails-in-some-of-the-ways-to-obtain-information-url/ 如本机我测试域名为test.blog.zool.it:3000 打开的uri为 /post/Hello-World fullurl为 http://test.blog.zool.it:3000/post/Hello-world 则ra...

weixin_30617737的博客 258

07群晖Docker部署nousresearch/hermes-agent

群晖Docker部署nousresearch/hermes-agent。

分享技术,传播知识! 1375

Rails中path和url的区别以及用法对待

为什么80%的码农都做不了架构师?>>> ...

weixin_34311757的博客 186

Tecplot进阶:巧用公式与多Frame对比,实现CFD多工况数据差异的可视化分析

本文详细介绍了如何利用Tecplot进行CFD多工况数据差异的可视化分析,通过公式计算和多Frame对比,实现变量差值自动计算、多视图同步展示和差异量化统计。文章还提供了数据准备、基础操作、实战技巧和常见问题解决方案,帮助工程师高效完成CFD后处理工作。

weixin_29227425的博客 528

ANSYS APDL实战:手把手教你搞定电磁-热耦合分析(附完整命令流)

本文通过一个工业感应加热线圈的实战案例,手把手教你使用ANSYS APDL完成电磁-热耦合分析。内容涵盖从几何建模、材料定义、网格划分到加载求解及后处理的完整流程,重点讲解了使用PLANE13单元进行双向耦合场分析的方法与命令流调试技巧,助力工程师快速掌握这一核心仿真能力。

weixin_29284201的博客 427

rails中 url和path的区别

path是相对路径 url是绝对路径 model为复数的会对应到action=>index, 为单数时需要传递id参数并对应到action=>show 如对于user而言: users_url # => http://localhost:3000/users users_path # => /users user_path(1) # => /users/1...

weixin_30372371的博客 308

Landsat9 地表温度反演方法

landsat9地表温度反演及缺失值处理方法

xiangliu12345的博客 3918

rails 对 URL的一些处理

u = "http://www.youtube.com/watch?v=xxxxxxxxxxxxxxxxxxx" u1 = URI.parse('www.google.com') u1.query = URI.parse(u).query u1.to_s 有个转换查询串的方法,好像是叫 Rack::Utils.parse_query ,转成哈希。哈希的to_query 又能转换成查询串...

iteye_19937的博客 508

Android11车机系统海外项目资源包RRO方案优化

本文介绍了汽车设置应用如何通过Android RRO(运行时资源叠加)方案实现多车型差异化资源管理。针对不同车型(国内/海外、轿车/SUV)和配置(方向盘、轮毂等),采用产品变体(productFlavors)构建不同APK版本,并通过JSON配置文件动态启用对应资源包。系统根据车辆下线配置自动匹配适用的资源叠加包,解决了硬编码判断带来的维护问题。该方案实现了资源的高效复用,同时支持灵活配置多种车型组合,为汽车行业多车型共平台开发提供了可扩展的技术实现。

shusuanly的博客 469

Pinocchio 快速详细入门教程 —— 开源机器人运动学动力学库

本文介绍了机器人学中的数字机器人学、正逆运动学、动力学仿真与控制、最优控制等核心主题,以及Pinocchio库的应用。内容包括: 数字机器人学:通过UR5机器人模型演示了构型空间采样、碰撞检测、路径规划等基础操作,使用优化方法在约束条件下寻找有效构型。 运动学:详细讲解了二维和三维机器人的正运动学(构型到末端位置)和逆运动学(目标位置到构型),包括串联机械臂和并联机器人的处理。 动力学与控制:介绍了动力学仿真(如自由落体、摩擦效应)、PD控制、计算扭矩控制,以及接触仿真(碰撞检测与处理)。 最优控制:以独轮

机器人控制与仿真应用 2883

Rails URL Helpers 原理与实战:从路由契约到故障排查

URL 是 Web 应用最脆弱的接口边界,而 URL helpers 是 Rails 提供的类型安全、可重构、可测试的 URL 生成机制。其本质是基于 `config/routes.rb` 中明确定义的路由契约,通过 Ruby 动态方法生成(`define_method`)实现的路径与链接构造能力。理解 `*_path`(相对路径)与 `*_url`(绝对 URI)的技术差异,有助于规避邮件模板 404、API 响应协议错配、后台任务上下文缺失等高频问题。在多环境部署、嵌套资源、微服务调用等场景中,合理使用

weixin_30443747的博客 439

Bean named‘ddlApplicationRunner‘is expected to be of type ‘org.springframework.boot.Runner‘

springboot3.1.7整合mybatisplus3.5.3.2版本报错,sringboot3.x整合myabtis报错

雾林小妖的博客 1万+

graphql-ruby 实战:在 GraphQL 字段中返回 Rails 路由 URL 与 ActiveStorage 附件 URL

本文面向在 Rails 应用中集成 graphql-ruby 的开发者,讲解两个高频实战问题:如何在 GraphQL 字段中生成基于当前请求的 Rails 路由 URL(如 `user_url`),以及如何安全返回 ActiveStorage 附件的下载/展示 URL(如 `rails_blob_url`)。读完本文,你将掌握借助 `context` 传递 `request`、借助 `Active

gitblog_00061的博客 158

[Dify]-进阶5- 使用 Dify 构建多轮对话的客服机器人

本文介绍了如何利用Dify平台构建智能客服系统,重点阐述了ChatFlow框架的应用。系统支持多轮对话、业务接口集成和话术策略管理,具备订单查询、退货申请等核心功能。通过Classifier节点实现意图识别,借助Router节点分流处理流程,并结合API插件实现业务数据对接。文章还提供了部署调试、会话优化和监控分析的具体方法,强调模块化设计和插件化集成的重要性,为构建功能完善的智能客服系统提供了完整解决方案。

技术小甜甜:传播可落地技术,帮助个人和企业降低解决真实场景问题的成本 1660

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

Rails URL Helpers 原理与工程实践:从路由生成到高阶定制

URL 生成是 Web 应用的基础能力,其本质是将控制器动作映射为可访问的路径。Rails URL Helpers 通过路由定义(routes.rb)驱动、Journey 路由树编译、url_for 动态生成三层机制,实现类型安全、格式感知、可测试的 URL 构建。它取代字符串拼接,保障 URL 一致性与重构安全性,支撑视图链接、重定向、邮件模板及 HATEOAS 等核心场景。结合嵌套路由、param 定制、namespace 隔离、i18n 前缀与多租户 host 动态化等实战模式,开发者可系统性规避 N

weixin_34124651的博客 416

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

rails的URL路由

config/routes.rb下的  map.connect ':controller/:action/:id'   map.connect ':controller/:action/:id.:format'

琉璃BES 556

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Rails中命名路由的区别***_url与***_path

Rails中命名路由的区别***_url与***_path   意外 为了安全,端口号跳来跳去,从3000跳到4000再跳到5000。。。8000,最后rails和nginx都没有得到最正确的端口号。 这不要紧,最要紧的是命名路由出问题了,很多***_url的写法都得不到正确的端口号,跳到80了。   命名路由 path是相对路径url是绝对路径model为复数的会对应到actio...

fantaxy025025的专栏 221

rails路由url、具名路由规则

get /users index users_path 显示users列表页 get /users/1  show  user_path 显示某个user get /users/new  new    new_user_path 创建user的页面 post /users                create  users_path 创建user get /users/1/edit

龙浩然的博客 1072

rails 路由配置时 URL 地址如何匹配下划线?

最近在完善天天笔记的分享功能,遇到了一个url问题:不知道该怎么匹配下划线?我改成中划线,发现是支持的。 我是这么配置的:get 'doc/share/:randcode_:docid.html' => 'doc#share2' 但是,运行时发生异常:ActionController::RoutingError (No route matches [GET] "/doc/s...

weixin_30247307的博客 107

rails路由全解

Rails 路由学习笔记 字数4762 阅读1569 评论0 喜欢5 参考 RailsGuides中的Rails Routing from the Outside In 原文地址:http://www.jianshu.com/p/Ro4HZT# 简介 Rails 路由会通过你配置的路由规则将发送来的 URL 分发到对应的 action 中。它同时会生成 pat

qwbtc的博客 2664

Rails路由

由于总结的比较全,读起来很好用,在下转过来了,全当是方便自己看。 原文网址:http://hi.baidu.com/haifreeidea/blog/item/57b0f50e5ae133226159f37b.html   Rails路由(一) 此文原文在http://guides.rubyonrails.org/routing.html。这是我根据自己的理解作的一些笔记。 1 使

495

Rails学习之路由设置(URI映射)

URL的映射规则,在config/routes.rb文件中。这是一个ruby类,不是配置文件。 设置默认主页的映射,例子: map.root :controller =&gt; "home" 这表示网站的主页的控制器为home,action为index。当然还要把public下的index.html移出或改下名字。   map.connect 'book/:bookid',:contro...

努力,让生活变得更美好 464

Ruby on Rails 路由解析

为了更好的阅读体验。欢迎訪问 作者博客原文 Route是什么 Rails中URL的约定严格基于RESTful风格的。client的请求事实上是在操作一些资源。同一资源的不同的请求动作(GET, POST, PUT, PATCH, DELETE)分别对资源进行不同的操作(CRUD)。默认的情况下。我们仅仅须要在routes.rb文件里配置好资源,Rails会为该资源生...

weixin_34413065的博客 206
上一篇: rails 使用bootstrap及bootswatch
下一篇: Rails 在javascript中使用ruby对象
qjpcpu
博客等级 码龄15年 59粉丝 106原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值