Tag: ruby-on-rails

# shared model methods (and callbacks, validates, scopes, associations) - instance and class

module Item  
extend ActiveSupport::Concern
  
  # instance associations, scopes, validations, callbacks, methods, private methods  
  included do    
    belongs_to :user    
    has_many :collaborations, 

Like JavaScript anonymous undefined functions

With the yield statement

def test
   puts "You are in the method"
   yield
   puts "You are again back to the method"
   yield
end
test {puts "You are in the block"}


def test
   yield 5
   puts "You are in the method test"
   yield 100
end
test {|i| puts