на сервере sql у вас есть (как минимум) два типа DateTime
:
Каждый из этого типа может быть привязан к .Net DateTime
, но DateTime.MinValue
всегда 0001/01/01. Поэтому, если столбец sql настроен как дата и время, сервер sql выдает аргумент, когда вы пытаетесь написать DateTime.MinValue
.
Таким образом, вы можете:
DateTime.MinValue
[ 1113] есть и другие соображения, такие как DateTime2 против DateTime в SQL Server
I believe it's specified by REST. Here's a list for ya:
GET /items #=> index
GET /items/1 #=> show
GET /items/new #=> new
GET /items/1/edit #=> edit
PUT /items/1 #=> update
POST /items #=> create
DELETE /items/1 #=> destroy
Edited to add to get all those routes, in config/routes.rb, simply add map.resources :items
Rails defines seven controller methods for RESTful resources by convention. They are:
Action HTTP Method Purpose ------------------------------------------------------------------------- index GET Displays a collection of resources show GET Displays a single resource new GET Displays a form for creating a new resource create POST Creates a new resource (new submits to this) edit GET Displays a form for editing an existing resource update PUT Updates an existing resource (edit submits to this) destroy DELETE Destroys a single resource
Note that because web browsers generally only support GET and POST, Rails uses a hidden field to turn these into PUT and DELETE requests as appropriate.
Specifying map.resources :items
in config/routes.rb
gets you those seven methods "for free". You can list all the routes within your application at any time by entering rake routes
in the console.
The best place to learn about this would be the Routing Guide.
Как сказал Дон Верв, взгляните на свой файл rout.rb. Там у вас, вероятно, есть что-то вроде этого:
map.resources :items
Здесь рельсы связывают запросы POST и GET с определенными действиями. Чтобы увидеть, как это работает, посмотрите на ссылки из других ответов. Документы помогают тонну.
Для всех маршрутов и действий, с которыми они связаны, вы можете ввести rake route
в командную строку, когда вы находитесь в корневом каталоге вашего rails. Это покажет вам все (с точки зрения маршрутизации), что дает вам эшафот.
Это очень поможет, но это не прямой ответ на ваш вопрос. Следующая команда выведет список отображений, используемых вашим приложением, чтобы вам не приходилось запоминать все детали или догадываться.
$ rake routes
Чтобы ответить более прямо, это соглашение, которое использует рельсы. Вы устанавливаете это отображение, когда помещаете что-то вроде следующего в ваши маршруты. Rb
map.resources :items
map.resources is a method that automagically gives you the REST routes and path helpers as well. This is a nice feature if you already know and understand how rails' restful routing works but it is also a bit of a hindrance for learning rails because too much is hidden.
Railsguides has a nice routes guide.