TryingModels
This project rocks and uses MIT-LICENSE.
Basically to create new Rails Plugins.
In this example, I create acts_as_tryable plugins follow the Rails Guide Plugins.
Understand the ActiveSupport::Concern and deep undertood both include vs extend.
Bundle
gem install trying_models
How
Adding acts_as_tryable to your model file. Ex: app/models/article.rb
class Article < ActiveRecord::Base
acts_as_tryable
endUse
Everywhere when you look at the @instance
Ex:
@article = Article.new(name: "example", content: "example")
# try call hello method
@article.hello
# result
# -> "Undefined Method"
# -> it replacement for `raise exception default make app crash`It not very awesome, It basic and very Simple, It show me how to understand extend include attributes how active record work