As long as you supply the DB::Expr on at least the 3rd argument, you can get away with leaving nothing in 1st and 2nd args and the following should work as well:. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 11 years, 1 month ago. Active 7 years, 1 month ago. Viewed 11k times.
Improve this question. Now that v3 has better docs and I've had a chance to get used to it-- I'm enjoying it thoroughly.
Add a comment. Active Oldest Votes. In my product edit view I have a select form field to select one of many methodologies or none empty first option.
Everything worked OK until today that I had to make an adjustment to the system in which since now selecting a methodology can be optional. The problem is that now when I save the model selecting the empty option, instead of the expected NULL , I get a 0 zero value.
What form input are you using for choosing the methodology? If so, the value of choosen option is probably set to 0 when no methodology is choosen, and send with other form data. Even if the submitted form field is blank it's a string with any empty value - not NULL. This gets cast as 0 when saved to an INT field at least in mysql. To preserve a null value do something like this:. Sign up using Facebook. Sign up using Email and Password.
Post as a guest Name. Email Required, but never shown. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming Featured on Meta.
Now live: A fully responsive profile. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.
0コメント