check rights

Ruby code posted
created at 24 Jul 18:30

Edit | Back
1
2
3
4
5
6
7
8
9
  def check_rights
    begin
      name = self.class.name.underscore.split("_")[0].capitalize.singularize
      o = eval(name).find(params[:id])
      notowner = o.user != current_user
    rescue
    end
    raise "not an owner!" if notowner
  end
257 Bytes in 4 ms with coderay