Skip to content

Instantly share code, notes, and snippets.

View obelich's full-sized avatar
:octocat:
Aprendiendo Dart + Flutter

Oscar Miguel Amezcua Estrella obelich

:octocat:
Aprendiendo Dart + Flutter
View GitHub Profile
@obelich
obelich / rb
Last active November 15, 2017 17:59
Snippet para paperclip en modelo
has_attached_file :$Campo$, default_url: 'noicon.png'
validates_attachment_content_type :$Campo$, content_type: /\Aimage/
@obelich
obelich / rb
Created November 15, 2017 17:59
has_many :$Nombre$, dependent: :destroy
@obelich
obelich / rb
Created November 15, 2017 18:00
has_many :$Modelo$,, dependent: :destroy
accepts_nested_attributes_for :$Modelo$, allow_destroy: true, reject_if: proc { |att| att['$Campo$'].blank? }
@obelich
obelich / rb
Created November 15, 2017 18:00
has_many :$Modelo$, through: :$ModeloIntermedio$
@obelich
obelich / rb
Created November 15, 2017 18:01
after_initialize :set_defaults
def set_defaults
self.$field$ ||= $content$
end
@obelich
obelich / rb
Last active November 15, 2017 18:03
Iniciar Validación
validates :$Campo$
@obelich
obelich / rb
Created November 15, 2017 18:04
, presence: true
@obelich
obelich / rb
Created November 15, 2017 18:04
, uniqueness: true
@obelich
obelich / rb
Created November 15, 2017 19:42
add_column :$Tabla$, :$Campo$, :$tipo$
@obelich
obelich / rb
Created November 15, 2017 19:42
add_column :$Tabla$, :$Campo$, :date