Enviar búsqueda
Cargar
Validações no Ruby on Rails
•
1 recomendación
•
15,518 vistas
Eduardo Mendes
Seguir
Breve apresentação sobre algumas validações do Rails no Model
Leer menos
Leer más
Tecnología
Denunciar
Compartir
Denunciar
Compartir
1 de 10
Descargar ahora
Descargar para leer sin conexión
Recomendados
Element Styles and Positioning
Element Styles and Positioning
alexisabril
用jQuery玩弄你的網頁1
用jQuery玩弄你的網頁1
Mu Chun Wang
Hello, Canvas.
Hello, Canvas.
Seth McLaughlin
Javascipt ch1
Javascipt ch1
Brady Cheng
A SOLID Design in InterSystems ObjectScript
A SOLID Design in InterSystems ObjectScript
AnastasiaDyubaylo
DevNexus 2016
DevNexus 2016
Stephanie Brubaker
Css responsive
Css responsive
AbhishekMondal42
JavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQuery
katbailey
Recomendados
Element Styles and Positioning
Element Styles and Positioning
alexisabril
用jQuery玩弄你的網頁1
用jQuery玩弄你的網頁1
Mu Chun Wang
Hello, Canvas.
Hello, Canvas.
Seth McLaughlin
Javascipt ch1
Javascipt ch1
Brady Cheng
A SOLID Design in InterSystems ObjectScript
A SOLID Design in InterSystems ObjectScript
AnastasiaDyubaylo
DevNexus 2016
DevNexus 2016
Stephanie Brubaker
Css responsive
Css responsive
AbhishekMondal42
JavaScript the Smart Way - Getting Started with jQuery
JavaScript the Smart Way - Getting Started with jQuery
katbailey
Plone Interactivity
Plone Interactivity
Eric Steele
devise tutorial - 2011 rubyconf taiwan
devise tutorial - 2011 rubyconf taiwan
Tse-Ching Ho
Tame Accidental Complexity with Ruby and MongoMapper
Tame Accidental Complexity with Ruby and MongoMapper
Giordano Scalzo
Simple blog wall creation on Java
Simple blog wall creation on Java
Max Titov
Node.js 與 google cloud storage
Node.js 與 google cloud storage
onlinemad
Building sustainable RESTFul services
Building sustainable RESTFul services
Ortus Solutions, Corp
The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!
Donny Wals
Testing swagger contracts without contract based testing
Testing swagger contracts without contract based testing
Алексей Стягайло
Webauthn Tutorial
Webauthn Tutorial
FIDO Alliance
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
pauldix
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
pauldix
Barcamp Auckland Rails3 presentation
Barcamp Auckland Rails3 presentation
Sociable
Seguranca em APP Rails
Seguranca em APP Rails
Daniel Lopes
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
Rob Tweed
Api's and ember js
Api's and ember js
Edwin Cruz
Active Record Form Helpers, Season 1
Active Record Form Helpers, Season 1
RORLAB
Deploying your static web app to the Cloud
Deploying your static web app to the Cloud
Christoffer Noring
Resource Registries: Plone Conference 2014
Resource Registries: Plone Conference 2014
Rob Gietema
How to implement authorization in your backend with AWS IAM
How to implement authorization in your backend with AWS IAM
Provectus
Rails3 changesets
Rails3 changesets
Wen-Tien Chang
JavaScript - Introdução com Orientação a Objetos
JavaScript - Introdução com Orientação a Objetos
Eduardo Mendes
AngularJS - Rotas
AngularJS - Rotas
Eduardo Mendes
Más contenido relacionado
Similar a Validações no Ruby on Rails
Plone Interactivity
Plone Interactivity
Eric Steele
devise tutorial - 2011 rubyconf taiwan
devise tutorial - 2011 rubyconf taiwan
Tse-Ching Ho
Tame Accidental Complexity with Ruby and MongoMapper
Tame Accidental Complexity with Ruby and MongoMapper
Giordano Scalzo
Simple blog wall creation on Java
Simple blog wall creation on Java
Max Titov
Node.js 與 google cloud storage
Node.js 與 google cloud storage
onlinemad
Building sustainable RESTFul services
Building sustainable RESTFul services
Ortus Solutions, Corp
The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!
Donny Wals
Testing swagger contracts without contract based testing
Testing swagger contracts without contract based testing
Алексей Стягайло
Webauthn Tutorial
Webauthn Tutorial
FIDO Alliance
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
pauldix
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
pauldix
Barcamp Auckland Rails3 presentation
Barcamp Auckland Rails3 presentation
Sociable
Seguranca em APP Rails
Seguranca em APP Rails
Daniel Lopes
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
Rob Tweed
Api's and ember js
Api's and ember js
Edwin Cruz
Active Record Form Helpers, Season 1
Active Record Form Helpers, Season 1
RORLAB
Deploying your static web app to the Cloud
Deploying your static web app to the Cloud
Christoffer Noring
Resource Registries: Plone Conference 2014
Resource Registries: Plone Conference 2014
Rob Gietema
How to implement authorization in your backend with AWS IAM
How to implement authorization in your backend with AWS IAM
Provectus
Rails3 changesets
Rails3 changesets
Wen-Tien Chang
Similar a Validações no Ruby on Rails
(20)
Plone Interactivity
Plone Interactivity
devise tutorial - 2011 rubyconf taiwan
devise tutorial - 2011 rubyconf taiwan
Tame Accidental Complexity with Ruby and MongoMapper
Tame Accidental Complexity with Ruby and MongoMapper
Simple blog wall creation on Java
Simple blog wall creation on Java
Node.js 與 google cloud storage
Node.js 與 google cloud storage
Building sustainable RESTFul services
Building sustainable RESTFul services
The Testing Games: Mocking, yay!
The Testing Games: Mocking, yay!
Testing swagger contracts without contract based testing
Testing swagger contracts without contract based testing
Webauthn Tutorial
Webauthn Tutorial
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
Building Web Service Clients with ActiveModel
Barcamp Auckland Rails3 presentation
Barcamp Auckland Rails3 presentation
Seguranca em APP Rails
Seguranca em APP Rails
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
Api's and ember js
Api's and ember js
Active Record Form Helpers, Season 1
Active Record Form Helpers, Season 1
Deploying your static web app to the Cloud
Deploying your static web app to the Cloud
Resource Registries: Plone Conference 2014
Resource Registries: Plone Conference 2014
How to implement authorization in your backend with AWS IAM
How to implement authorization in your backend with AWS IAM
Rails3 changesets
Rails3 changesets
Más de Eduardo Mendes
JavaScript - Introdução com Orientação a Objetos
JavaScript - Introdução com Orientação a Objetos
Eduardo Mendes
AngularJS - Rotas
AngularJS - Rotas
Eduardo Mendes
Angular JS - Fundamentos
Angular JS - Fundamentos
Eduardo Mendes
Singleton - Padrão de Projeto
Singleton - Padrão de Projeto
Eduardo Mendes
Layout Fluido
Layout Fluido
Eduardo Mendes
Web Design Responsivo
Web Design Responsivo
Eduardo Mendes
Html - Aula 4
Html - Aula 4
Eduardo Mendes
Html - Aula 3
Html - Aula 3
Eduardo Mendes
Introdução à Internet, Http e HTML
Introdução à Internet, Http e HTML
Eduardo Mendes
ExtJS-4
ExtJS-4
Eduardo Mendes
Jquery 2
Jquery 2
Eduardo Mendes
Jquery
Jquery
Eduardo Mendes
Estimativas de Esforço - Engenharia de Software
Estimativas de Esforço - Engenharia de Software
Eduardo Mendes
Java web 6 JSP Expression Language Taglib parte 2
Java web 6 JSP Expression Language Taglib parte 2
Eduardo Mendes
Padrão Iterator
Padrão Iterator
Eduardo Mendes
Padroes Template-Method (Método Gabarito)
Padroes Template-Method (Método Gabarito)
Eduardo Mendes
Padrão Command
Padrão Command
Eduardo Mendes
Padrão Fachada
Padrão Fachada
Eduardo Mendes
Padrão Adapter
Padrão Adapter
Eduardo Mendes
Web Design Responsivo
Web Design Responsivo
Eduardo Mendes
Más de Eduardo Mendes
(20)
JavaScript - Introdução com Orientação a Objetos
JavaScript - Introdução com Orientação a Objetos
AngularJS - Rotas
AngularJS - Rotas
Angular JS - Fundamentos
Angular JS - Fundamentos
Singleton - Padrão de Projeto
Singleton - Padrão de Projeto
Layout Fluido
Layout Fluido
Web Design Responsivo
Web Design Responsivo
Html - Aula 4
Html - Aula 4
Html - Aula 3
Html - Aula 3
Introdução à Internet, Http e HTML
Introdução à Internet, Http e HTML
ExtJS-4
ExtJS-4
Jquery 2
Jquery 2
Jquery
Jquery
Estimativas de Esforço - Engenharia de Software
Estimativas de Esforço - Engenharia de Software
Java web 6 JSP Expression Language Taglib parte 2
Java web 6 JSP Expression Language Taglib parte 2
Padrão Iterator
Padrão Iterator
Padroes Template-Method (Método Gabarito)
Padroes Template-Method (Método Gabarito)
Padrão Command
Padrão Command
Padrão Fachada
Padrão Fachada
Padrão Adapter
Padrão Adapter
Web Design Responsivo
Web Design Responsivo
Último
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Roshan Dwivedi
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Enterprise Knowledge
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
V3cube
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Katpro Technologies
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Results
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Paola De la Torre
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
Último
(20)
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Validações no Ruby on Rails
1.
Validações! http://edgeguides.rubyonrails.org/ active_record_validations.html
2.
Validações Rails • Configurações no
modelo • Garantem que somente objetos válidos sejam persistidos • Métodos que disparam • create • save • update • update_attributes
3.
Obrigatório class Person <
ActiveRecord::Base validates :name, presence: true validates_presence_of :idade end
4.
Tamanho class Person <
ActiveRecord::Base validates :name, length: { minimum: 2 } validates :bio, length: { maximum: 500 } validates :password, length: { in: 6..20 } validates :registration_number, length: { is: 6 } end
5.
Tamanho class Essay <
ActiveRecord::Base validates :content, length: { minimum: 300, maximum: 400, too_short: "minimo %{count} caracteres", too_long: "maximo %{count} caracteres" } end
6.
Numéricos class Player <
ActiveRecord::Base validates :points, numericality: true validates :games_played, numericality: { only_integer: true } end
7.
Numéricos :greater_than :equal_to :greater_than_or_equal_to :odd :less_than :even :less_than_or_equal_to ! !
8.
Unicidade class Account <
ActiveRecord::Base validates :email, uniqueness: true end
9.
Unicidade class Holiday <
ActiveRecord::Base validates :name, uniqueness: { scope: :year, message: "should happen once per year" } end
10.
Unicidade class Person <
ActiveRecord::Base validates :name, uniqueness: { case_sensitive: false } end
Descargar ahora