Set default values to model attributes using attribute method

preview_player
Показать описание
#rubyonrails #ror #railscallbacks #rordev #railsdevelopment
Hello Friends

In this lecture, we will see how to set default values to ActiveRecord model attributes using the attribute method. This method is only available since rails 5 so you can only use this into either rails 5 or other higher versions of rails. Please watch the complete lecture for a better understanding.

Thanks
Рекомендации по теме
Комментарии
Автор

Sir, please come with new series for Ruby On Rails backend

DhananjayDeore-nymk
Автор

Hi, many thanks!

attribute, define_method "#{role_name}?" and set_user_role

replace: 

enum role: %I[super_admin admin manager editor collaborator].freeze, _default: :admin

ledockol
welcome to shbcf.ru