Colin Law wrote in post #1182464:
> On 26 March 2016 at 09:30, Naveed Alam <li...@ruby-forum.com> wrote:
>> You might have expected an instance of ActiveRecord::Base.
>> The error occurred while evaluating nil.[]
>>
>>     app/models/privilege.rb:24:in `applicable?'
>
> The error says you have called the method [] on an object that is nil.
> You don't seem to have shown us line 24 of privilege.rb (and the
> surrounding lines).
>
> Colin

class Privilege < ActiveRecord::Base
  has_and_belongs_to_many :users
  belongs_to :privilege_tag

  def applicable?
    role_plugin_hash = 
Authorization::Engine.instance.roles_plugin_hash[self.name.underscore.to_sym]
    role_plugin_hash.nil? ? false : (role_plugin_hash.include? nil) ? 
true : (role_plugin_hash & FedenaPlugin.accessible_plugins).present? ? 
true : false
  end
end

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/04a2942c34a60793638634e1982e9e86%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to