Skip to content

Instantly share code, notes, and snippets.

a new challenge is on the way....

Thaichor Seng thaichor

a new challenge is on the way....
View GitHub Profile
View user_form.rb
class User < ApplicationRecord
has_one :car
validates :username, presence: true,
validates :username, length: { maximum: 100 }
validates :age, numericality: { only_integer: true }
class Car < ApplicationRecord
enum vehicle_type: %i[suv van compact]
thaichor / base_form.rb
Created Jan 31, 2020
Rails Service Design Patterns - Form Object - BaseForm
View base_form.rb
class BaseForm
include ActiveModel::Model
def persisted?
def save
return false unless valid?