DELETE /products/1/delete looks rather confusing, I think it is better to use POST verb in this case: POST /products/1/delete. Also, these are perfectly valid RESTful routes, there is nothing wrong with them.
I would also suggest to extend your routing DSL explicitly instead of patching Rails internal classes so that the modification is obvious for you and others. This will also avoid troubles with external engines that will expect default behavior.
ruby
# lib/delete_resource_route.rbmoduleDeleteResourceRoutedefresources(*args, &block)
super(*args) doyieldif block_given?
member do
get :delete
delete :delete, action::destroyendendendend# config/routes.rb
require 'delete_resource_route'Example::Application.routes.draw do
extend DeleteResourceRoute
resources :categories
resources :products
root to:'products#index'end
There is no PayPal yet in my work, but it was interesting to watch this episode. One thing that bothers me though is that you skip testing part which is crucial in billing and payments. I know, the episode would be two times longer if you covered this as well but it was very scary to see you just quickly testing the stuff in a browser.
I find it better to put the global scope directly into the controller:
That way everything outside it will work the same way as before.
Did you see turbolinks? Looks like you are developing the same thing.
Anyone had luck with using jQuery File Upload UI in Rails?
DELETE /products/1/delete
looks rather confusing, I think it is better to use POST verb in this case:POST /products/1/delete
. Also, these are perfectly valid RESTful routes, there is nothing wrong with them.I would also suggest to extend your routing DSL explicitly instead of patching Rails internal classes so that the modification is obvious for you and others. This will also avoid troubles with external engines that will expect default behavior.
I have used
ActiveModel::Serializers::JSON
module to make a serializer/presenter class and I like this approach better than Jbuilder.There is XML Builder that comes bundled with Rails ("builder" gem)
You can skip
require "rubygems"
since Ruby 1.9This is why we are saving them into a separate variable
But when you get out of it in production you'd better have a well-tested billing system :-)
Since jQuery 1.6 you should use
prop()
method to set boolean attributes:$('input[type=submit]').prop('disabled', true)
There is no PayPal yet in my work, but it was interesting to watch this episode. One thing that bothers me though is that you skip testing part which is crucial in billing and payments. I know, the episode would be two times longer if you covered this as well but it was very scary to see you just quickly testing the stuff in a browser.
http://guides.rubyonrails.org/routing.html#specifying-constraints