刻意练习--Rails RESTful(一)

Web缓存欺骗攻击:原理、实战与防御指南 缓存技术是提升Web应用性能的核心机制,通过将频繁访问的数据临时存储,有效降低服务器负载和响应延迟。其工作原理基于缓存键匹配与HTTP响应头控制,旨在平衡数据新鲜度与访问效率。在安全领域,缓存配置不当可能引发严重风险,例如攻击者利用路径后缀与缓存规则的不一致性,诱导系统错误缓存私有动态内容,实现跨用户数据窃取。这种被称为Web缓存欺骗的攻击,常针对用户个人资料、订单历史等敏感页面,危害性高且易于规模化利用。本文深入剖析其技术原理,并结合渗透测试实战,提供从漏洞挖掘到纵深防御的完整解决方案。 阅读详情

一本被人反复提及的书《哪儿来的天才》中说过,大部分所谓的天才都是通过反复的刻意练习得到的。当你的练习时间达到10000小时以后,你就会成为该领域的专家。


最近在学习rails如何实现RESTful Web Service。自己想给自己设计一个练习的模板,进行反复练习。开发过程采用的是TDD的方式进行开发。


练习背景:

我们涉及三个Domain对象,Products、Orders、Payment


1.新建工程rails-rest-practice

rails new rails-rest-practice

cd !$

bundle install


2.安装rspec-rails

在Gemfile中添加

gem "rspec-rails", :group => [:development, :test]

然后

bundle install

rails g rspec:install

在.rspec 中去掉 --warnings


3.GET /products => user get list of products

step 1:创建controller,返回HTTP Status 200

user products api如下:

GET   /products       user get list of products


创建文件:spec/products/products_controller_spec.rb

require 'rails_helper'

describe ProductsController, :type => :controller do
   describe 'products controller' do
      it 'get index of products' do
         get :index
         expect(response).to have_http_status(200)
      end
   end
end


have_http_status:http://rubydoc.info/gems/rspec-rails/RSpec/Rails/Matchers#have_http_status-instance_method


创建文件:app/controllers/products_controller.rb

class ProductsController < ApplicationController
   def index
   end
end


运行rake spec,得到错误:

     ActionController::UrlGenerationError:
       No route matches {:action=>"index", :controller=>"products"}


配置相关config/routes.rb

resources :products do
   collection do
      get :index
   end
end


运行rake spec,得到错误:

Failure/Error: get :index
     ActionView::MissingTemplate:

修改app/controllers/products_controller.rb

class ProductsController < ApplicationController
   def index
      render :nothing => true
   end
end


这样就完成我们的第一个步骤,虽然看似这个步骤什么都没测,其实不然,在这一步中,我们搭建好了routes,同时创建了必要的controller类和其对应的方法。


step 2:返回JSON

安装rabl

在Gemfile中添加rabl

gem 'rabl'

bundle install

参考Rails + rabl


修改测试:spec/products/products_controller_spec.rb

render_views

describe 'products controller' do
   before(:all) do
      @products = [
         Product.new({:id => 1, :name => 'apple juice', :description => 'good'}),
         Product.new({:id => 2, :name => 'banana juice', :description => 'just so so'})
      ]
   end

   it 'get index of products' do
      expect(Product).to receive(:all).and_return(@products).once

      get :index, {:format => :json}
      expect(response).to have_http_status(200)

      products_json = JSON.parse(response.body)
      expect(products_json.size).to eq(2)
   end
end


运行测试rake spec

得到错误:

NameError:
       uninitialized constant Product


创建model Product:

rails g model Product name:string description:text

rake db:migrate


运行测试rake spec

得到错误:

    Failure/Error: products_json = JSON.parse(response.body)
     JSON::ParserError:
       A JSON text must at least contain two octets!

这是因为我们的response不对,并且我们没有配置怎么获取json格式的输出。


创建文件: app/views/products/index.json.rabl

collection @products, :object_root => false
attributes :name


再次运行测试rake spec,测试通过


step3: 添加更多的字段

在 spec/products/products_controller_spec.rb中

products_json = JSON.parse(response.body)
expect(products_json.size).to eq(2)

expect(products_json[0]['id']).to eq(1)
expect(products_json[1]['id']).to eq(2)

expect(products_json[0]['name']).to eq('apple juice')
expect(products_json[1]['name']).to eq('banana juice')

expect(products_json[0]['description']).to eq('good')
expect(products_json[1]['description']).to eq('just so so')

expect(products_json[0]['uri']).to end_with('/products/1')
expect(products_json[1]['uri']).to end_with('/products/2')


在app/views/products/index.json.rabl中

collection @products, :object_root=>false
attributes :id, :name, :description

node :uri do |product|
   product_url product
end


4.GET /products => user get a product of specified id

step 1: 创建对应的controller方法,返回HTTP 200

添加测试:spec/products/products_controller_spec.rb

it 'get product by product id' do
   get :show, {:id => 1}
   expect(response).to have_http_status(200)
end


对应修改:app/controllers/products_controller.rb

def show
   render :nothing => true
end


对应修改:config/routes.rb

resources :products do
   collection do
      get :index
   end

   member do
      get :show
   end
end

rake spec测试通过


step 2:创建对应的JSON显示

添加测试:spec/products/products_controller_spec.rb

before(:all) do
   #... ...
   @product = Product.new({:id => 1, :name => 'apple juice', :description => 'good'})
end

it 'get product by product id' do
   expect(Product).to receive(:find).with(1).and_return(@product).once

   get :show, {:id => 1, :format => :json}
   expect(response).to have_http_status(200)

   product_json = JSON.parse(response.body)
   expect(product_json['id']).to eq(1)
   expect(product_json['name']).to eq('apple juice')
   expect(product_json['description']).to eq('good')
   expect(product_json['uri']).to end_with('/products/1')
end


对应修改:app/controllers/products_controller.rb

def show
   @product = Product.find(params[:id].to_i)
end

Q:params[:id].to_i,为什么这里从测试代码过来的params[:id]它使一个string类型呢


添加JSON显示:app/views/products/show.json.rabl

object false

node(:id) { |product| @product.id }
node(:name) { |product| @product.name }
node(:description) { |product| @product.description }
node(:uri) { |product| product_url @product }


运行测试,通过


step 3:重构rabl

修改app/views/products/show.json.rabl

object @product

attributes :id, :name, :description

node(:uri) { |product| product_url product }


修改app/views/products/index.json.rabl

collection @products

extends 'products/show'


配置rabl:创建文件config/initializers/rabl_config.rb

Rabl.configure do |config|
   config.include_json_root = false
end


运行测试,通过,这样减少了rabl间的重复代码


step 4:HTTP 404

添加测试:spec/products/products_controller_spec.rb

it 'get 404 when product not found' do
   expect(Product).to receive(:find).with(100).and_raise(ActiveRecord::RecordNotFound)

   get :show, {:id => 100, :format => :json}
   expect(response).to have_http_status(404)
end


对应修改:

class ProductsController < ApplicationController
   rescue_from ActiveRecord::RecordNotFound, with: :product_not_found

   #... ... 

   def show
      @product = Product.find(params[:id])
   end

   protected
      def product_not_found
         response.status = :not_found
      end
end

参考rescue_from


(更新中,欢迎指教)

将会要修改的部分是如何写好rspec,参考:http://betterspecs.org/

构建艺术:Ruby中RESTful API的精粹实践 Ruby,以其优雅的语法和强大的框架,为实现RESTful API提供了得天独厚的优势。本文将深入探讨如何在Ruby中构建RESTful API,从理论到实践,从框架选择到代码实现,带你一步步领略RESTful API的构建艺术。本文以深入浅出的方式,为读者提供了关于在Ruby中构建RESTful API的全面指南,旨在帮助开发者掌握这一关键技能,并在实际工作中得心应手。通过本文的学习,你将能够构建出既优雅又高效的RESTful API,为你的应用程序增添无限可能。在API开发中,错误处理是必不可少的。 阅读详情

相关推荐

Ruby-一个超酷的RestfulApi自动生成器Kaola

Kaola(考拉,英文koala)是一个全自动的restful api代码自动生成系统。给定一个数据库,只需要配置好数据库连接,koala可以通过扫描数据库自动生成全套的restful api的后端代码。通过预先约定好的接口调用规范,前端就可以直接开发应用系统了。

cocoapods 出现JSON::ParserError - A JSON text must at least contain two octets!错误解决

问题出现 如何解决 总结 问题出现 某次pod install 就突然出现这个错误,试了好多方法无法解决,cocoapods的github上issue里面也有人提到这个问题,但是没有啥解决方案,经过我的探索,发现问题所在,废话不多说,看看怎么解决。 无论是pod install 还是pod update,均提示如上错误,试过重装cocoapods、重新clone工程等方法都无效。...

axllll的博客 2353

RESTful.Rails.Development.2015.10.pdf

RESTful.Rails.Development.2015.10.pdf

rails 返回json_使用Rails 5构建RESTful JSON API-第三部分

rails 返回jsonIn part two of this tutorial, we added token-based authentication with JWT (JSON Web Tokens) to our todo API. 在本教程的第二部分中,我们向Todo API中添加了基于JWT (JSON Web令牌)的基于令牌的身份验证。 In this final part o...

culiu9261的博客 527

利用运放设计简单有源滤波器(低通、高通、带通)

本文旨在帮助刚接触模电的同学快速设计一个实用可靠的运放,故我将不会说一些晦涩难懂的原理,只给出仿真电路图。

WeiTong0527的博客 3万+

win2012 r2 + IIS8.5 伪静态设置脚本映射

win2012 r2 + IIS8.5 伪静态设置脚本映射,网站用的.net fromwork 2.0 ,应用程序池设置了32位支持

xueking87的专栏 3239

rails 返回json_使用Rails 5构建RESTful JSON API-第二部分

rails 返回jsonIn part one of this tutorial, we managed to generate an API-only Rails application, set up a testing framework, and use TDD to implement the todo API. 在本教程的第一部分中,我们设法生成了仅API的Rails应用程序,建立了...

culiu9261的博客 559

Linux与Windows双系统,安装完linux后无法通过grub进入Windows的解决方法

先装Windows 10,Windows可正常启动,再装Kali,Kali提示装grub后照装。然而装完后重启发现无Windows选项。

sakurashockwave的博客 6454

Ruby on rails 实战圣经:RESTful 应用程序

什么是 RESTful?The first 90%of the code accounts for the first 90% of the development time. The remaining10% of the code accounts for the other 90% of the development time. – TomCargill, 贝尔实验室的面向对象程序专家RE

Felomeng的技术博客 1万+

半导体工厂自动化实战:用secs4net实现设备与MES系统通信(附完整代码)

本文详细介绍了如何利用secs4net框架实现半导体工厂设备与MES系统的高效通信。通过解析SECS/GEM协议的核心架构、关键业务场景实现及性能优化实践,帮助开发者快速掌握工业自动化通信技术,提升生产效率和系统稳定性。

transformer2023的博客 892

基于FPGA的PCIe核系列:FPGA root模式生成工程例子分析(1)

一、 PCIE系统架构 1.1 PCIE分层结构 PCIE结构 1.2 TLP包 四种TLP类型。 Memory (内存空间操作) IO (IO空间操作) Configuration (配置操作) Message (信息操作) 四种类型TLP,如果有需要响应,称为Non-Posted TLP,如果没有需要响应,称为Posted TLP。 TLP包类型 1.2.1 TLP结构 TLP数据格式 1.2.2 Header各个字段的含义 Header格式 ...

huangshanhu的博客 3432

rails restful 总结

1.什么是rest? 首先解释一下什么是rest,rest全称:Representational State Transfer, 中文意思是表述(编者注:通常译为表征)性状态转移。REST指的是一组架构约束条件和原则。" 如果一个架构符合REST的约束条件和原则,我们就称它为RESTful架构。(解释来自百度百科) REST有主要有两个核心精神:1. 使用Resource来当做识别的资源,也就...

Pre_wen 804

ISP一键下载电路分析+74HC1G66GW(信号图)

之前要不用的最小系统的开发板要不就是用的SWD调试口,没有注意过ISP一键下载电路是个怎么回事,因为需要就简单的看了一下野火的ISP一键下载电路。 默认情况一下,一般我们的程序都是从用户闪存也就是内部的FLASH启动的, 对于F103RCT6来说ROM的大小是512kb,启动地址位0x8000000,这个在IDE keil里可以看的到,如下图。 首先简单理解一下ISP是什么: 可以把他理解为芯片厂商出场时固化在ROM当中的一段程序,它的功能就是把你写的程序一点点的搬运到FLASH当中,它引出了两个引脚

lipengyu1363658871的博客 4861

有意练习--Rails RESTful(一)

书要反复提及《哪里有天才》在说,大多数所谓的天才是通过反复刻意练习获得。当你的练习时间达到10000几个小时后,。你将成为该领域的专家。 近期在学习rails怎样实现RESTful Web Service。自己想给自己设计一个练习的模板,进行重复练习。开发过程採用的是TDD的方式进行开发。 练习背景: 我们涉及三个Domain对象,Products、Orde...

aofan9566的博客 192

Redis TLS 加密传输实战:从证书生成到安全配置

本文详细介绍了为Redis启用TLS加密传输的完整实战流程。从阐述TLS加密的必要性开始,逐步指导读者生成自签名CA和服务器证书,并深入解析Redis服务端的核心安全配置,包括端口设置、认证模式与性能优化。最后,提供了主流客户端连接示例及生产环境下的排错与运维最佳实践,帮助构建安全的Redis通信通道。

weixin_29274969的博客 515

CATIA文件的网页预览方案

CATIA是工业设计中广泛使用的专业软件,产出`.CATPart`或 `.CATProduct`等文件类型,当资产数量较大时,我们希望快捷预览这些文件,就有了`CATPart`文件网页预览的需求 但我们知道,网页上无法直接渲染`CATPart`这种复杂的文件, CATIA生成的文件(如 `CATPart` 和 `CATProduct`)不仅包含三维几何信息(例如点、线和曲面),还涵盖了丰富的元数据与专业设计特征。 那有没有办法,能实现CATIA文件在网页上的便捷预览?

weixin_44211633的博客 1447

写在最前

这是我写的第一篇技术博文。在接下去有可能写第二篇第三篇的之前,我比较担忧的事情是我能在这上面坚持多久。为什么这么说呢?一来,担心琐碎的事情比较多;二来,不是每一件零散的事情都是值得记录的;三来,写博文对我而言是一件比较纠结的事情。暂时就说这么些吧。 我目前是在一家主营科研技术对接的团队里负责主站API后台的开发。我们主站使用前后台分离的开发模式。前端使用AngularJS开发单页应用,后端...

weixin_30449239的博客 82

深度学习工具包 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")

python flask

打个比方,你要做一桌子菜。Flask就像给你一口锅和一把刀,其他你自己配。Django呢,它直接给你一个带全套厨具的厨房,连菜单都帮你拟好了——模型、视图、模板、后台管理、用户认证、安全防护、数据库迁移,甚至还有自带的开发服务器和测试框架。它的哲学就是“开箱即用”,让你少操心那些基础设施的事。核心其实就几个东西:一个叫ORM的东西,让你用Python代码操作数据库,不用写SQL;一个叫URL路由的东西,把用户访问的地址和你的代码逻辑连起来;还有一套模板系统,用来生成前端的HTML页面。

leohu0723的博客 33

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

AI时代RAD开发:Vibe Coding与规范驱动开发的融合实践

快速应用开发(RAD)是一种旨在缩短开发周期、通过迭代和原型设计加速交付的软件工程方法论。其核心原理在于平衡速度与质量,利用现代工具链实现快速反馈和用户参与。在AI编程助手普及的今天,RAD的技术价值被重新放大,开发者能借助AI进一步提升原型构建和代码生成效率。应用场景涵盖从探索性项目到团队协作的大型系统。当前,AI辅助编程主要衍生出两种风格:一是依赖直觉与对话迭代的Vibe Coding,适合快速验证和模糊需求启动;二是强调设计先行的规范驱动开发,通过明确定义的契约(如OpenAPI)保证代码一致性和可维

weixin_34234721的博客 437

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

The Rails Way 读书笔记 | Chapter 4 & 5

REST, Resources, and Rails Before REST came I (and pretty much everyone else) never really knew where to put stuff. —Jonas Nicklas on the Ruby on Rails mailing list Routing and CRUD 当你在routes...

weixin_34284188的博客 215

CocoaPods 的简单快速安装方法

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33862514的博客 170

用Ruby实现RESTful API设计:Ruby是一种简洁且功能强大的编程语言,常用于Web服务和API开发。主题包括学习Ruby on Rails框架、RESTful API设计和数据库交互。

Ruby,这门语言的名字听起来就像是一条清澈的小溪,它以其简洁和优雅著称。Ruby的设计哲学是“程序员的幸福”,这意味着它旨在让编程变得更加愉快。它的语法简单直观,读起来就像是在读一篇优美的散文。而且,Ruby还有一个强大的社区支持,这使得学习和使用Ruby变得更加容易。本文的目标是带你领略Ruby on Rails的魅力,就像是一位导游,带你游览这条美丽的河流。我们将从安装和配置开始,然后深入探讨RESTful API的设计原则,再到数据库交互技术,最后讨论性能优化和维护。

一个平平无奇的博客,一个平平无奇的人,一个平平无奇的约定 796

Restful例子

如果你要做rails restful的工作,建议先看看管网的 http://api.rubyonrails.org/classes/ActionController/Resources.html 1. 安裝 Ruby on Rails 基本環境 (windows) 下載安裝 1-Click Rails Installer 下載安裝 E-TextEditor ,安裝過程會出...

horace_lee的专栏 145

那些rails的第一道坎

p ActionController::InvalidAuthenticityToken in Admin::ProductsController#create skip_before_action :verify_authenticity_token

kiwi_coder 1928
上一篇: Rails + rabl
下一篇: 用CasperJs自动浏览页面
kiwi小白
博客等级 码龄14年 153粉丝 154原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值