Hi Riccardo,<div><br></div><div>Thanks - that seems to work - <a href="https://github.com/kimptoc/scope-enum-tester--using-enumerated_attribute">https://github.com/kimptoc/scope-enum-tester--using-enumerated_attribute</a></div>
<div><br></div><div>Regards,</div><div>Chris<br><br><div class="gmail_quote">On 7 September 2011 09:57, Riccardo Tacconi <span dir="ltr"><<a href="mailto:rtacconi@gmail.com">rtacconi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br><br>I use a gem file.<br><br>In your gemfile add:<br><br>gem 'enumerated_attribute'<br><br>In your model:<br>
<br>enum_attr :doc_type, %w(diploma teacher_reference student_reference course_outline)<br><br>Otherwise you can use (in your model) something like this:<br>
<br> ROLES = %w[admin manager user].freeze<br> <br> def role_in_list<br> errors.add(:base, "Role #{self.role} is not allowed") unless User::ROLES.include?(self.role)<br> end<div><div></div><div class="h5">
<br><br></div></div></blockquote></div></div>