Digitale Seiten
Ruby
code posted
by
Digital
created at 08 Jul 09:30, updated at 09 Jul 17:08
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 |
def edit_me(object, check = false, model_name = "") if check object.editors.include?(current_user) ? result = true : nil end if current_user.admin? || result if model_name.empty? model_name = object.class.to_s.underscore end class_name = object.class.to_s.underscore link_to "Edit #{model_name}", send("edit_#{class_name}_path", object) end end |
417 Bytes in 2 ms with coderay