def allow_all
@allow_all = true
end
def allow(controllers, actions)
@allowed_actions ||= {}
Array(controllers).each do |controller|
Array(actions).each do |action|
@allowed_actions[[controller.to_s, action.to_s]] = true
end
end
end
end
end
but there is something wrong
NoMethodError in PrimaryPagesController#index
undefined method `allow' for #Permission:0x007fcaee54a310
Rails.root: /Users/freshlhy/rails_projects/first_app
class Permission
def initialize(current_user)
allow :index_page, [:index]
allow :static_pages, [:about, :contact]
allow :sessions, [:new, :create, :destroy]
allow :users, [:edit, :update]
end
end
but there is something wrong
NoMethodError in PrimaryPagesController#index
undefined method `allow' for #Permission:0x007fcaee54a310
Rails.root: /Users/freshlhy/rails_projects/first_app
Application Trace | Framework Trace | Full Trace
app/models/permission.rb:3:in
initialize'
new'app/controllers/application_controller.rb:12:in
app/controllers/application_controller.rb:12:in
current_permission'
authorize'app/controllers/application_controller.rb:20:in
How to use Handlebars instead of eco in rails ?
egghead.io can't open.......
Looking forward to series for AngularJS:
parties
nested_urls
widget
...
Thank you so mach and it works for me.