Skip to content

Instantly share code, notes, and snippets.

@dtakahas
Last active December 28, 2021 03:56
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtakahas/5367693 to your computer and use it in GitHub Desktop.
Save dtakahas/5367693 to your computer and use it in GitHub Desktop.
How is babby formed in Rails?
class Babby < PragnentGirl::GetPragnent
attr_accessible :name, :mother, :location, :pragnent_girl_id
belongs_to :pragnent_girl
before_save :destroy_instain_mothers
after_save :pary_for_father
#How is babby formed?
def initialize(name, mother_id)
@name = name
@pragnent_girl_id = mother_id
@mother = PragnentGirl.find(mother_id).name
@location = "ar"
end
private
#They need to do way instain mother> who kill thier babbys. becuse these babby cant frigth back
def destroy_instain_mothers
@mothers = Mother.where(:babby_can_frigth_back => false)
@mothers.each do |mother|
do_way(mother) if mother.instain?
end
end
# i am truley sorry for your lots
def pary_for_father
@fathers = Father.where(:chrilden_status => "lost")
@fathers.each do |father|
pary_for(father)
end
end
end
@darth10
Copy link

darth10 commented Mar 13, 2014

Indeed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment