lib/generators/templates/rest/rest_endpoint.rb.erb in grape_resource-0.1.10 vs lib/generators/templates/rest/rest_endpoint.rb.erb in grape_resource-0.1.11
- old
+ new
@@ -22,12 +22,16 @@
end
desc "Create"
params do
<% @entities.each do |k, v| %>remove
+ <% if v == "Datetime" %>remove
+ optional :<%= k %>, type: String, desc: 'Format is dd/mm/yyyy hh:mm:ss. Invalid date is ignored'
+ <% else %>remove
optional :<%= k %>, type: <%= v %>
<% end %>remove
+ <% end %>remove
end
post "/" do
p = <%= name.camelize.singularize %>.new <%= name.underscore.singularize %>_params
results = p.save!
present :status, results
@@ -36,10 +40,14 @@
desc "Update"
params do
requires :id, type: String
<% @entities.each do |k, v| %>remove
+ <% if v == "Datetime" %>remove
+ optional :<%= k %>, type: String, desc: 'Format is dd/mm/yyyy hh:mm:ss. Invalid date is ignored'
+ <% else %>remove
optional :<%= k %>, type: <%= v %>
+ <% end %>remove
<% end %>remove
end
put "/" do
p = <%= name.camelize.singularize %>.find(params.id)
p.update <%= name.underscore.singularize %>_params