Title / Description
Code 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
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code