Authorisation:
and you should take a look to authorisation from scratch. it works perfectly for me,
but i'm still very interested to see what cancan2 will bring :)
any ideas how to implement the accessible_by for the index action?
like with cancan:
@projects = Project.accessible_by(current_ability)
# This module adds the accessible_by class method to a model. It is included in the model adapters.
# An alternative action can optionally be passed as a second argument.
#
# @articles = Article.accessible_by(current_ability, :update)
#
# Here only the articles which the user can update are returned.
def accessible_by(ability, action = :index)
ability.model_adapter(self, action).database_records
end
also just do a migration for hstore:
def self.up
execute "CREATE EXTENSION hstore"
end
def self.down
execute "DROP EXTENSION hstore"
end
end
config.active_record.schema_format = :sql
helped to run minitest with hstore
thanks Ryan!
i will learn ember.js :)
btw, anyone having this?
$ rake db:test:prepare
rake aborted!
PG::Error: ERROR: type "hstore" does not exist
LINE 1: ...te, "tags" character varying(255)[], "properties" hstore, "c...
+1 :)
still didn't found a way to do it, but the multi tenancy casts are a great help to succeed with my goals.
thanks so much to ryan for all the great episodes!
@4awre
there are several ways, look at this:
for Devise:
https://github.com/plataformatec/devise/wiki/How-To:--Isolate-users-to-log-into-a-single-subdomain
http://blog.plataformatec.com.br/tag/subdomain/
http://blog.plataformatec.com.br/tag/subdomain/
Authorisation:
and you should take a look to authorisation from scratch. it works perfectly for me,
but i'm still very interested to see what cancan2 will bring :)
Permissions.permission_for(user) shows nearly what i'm looking for, but it doesn't work for the index action where a the customer_id matches.
any ideas how to implement the accessible_by for the index action?
like with cancan:
@projects = Project.accessible_by(current_ability)
# This module adds the accessible_by class method to a model. It is included in the model adapters.
# An alternative action can optionally be passed as a second argument.
#
# @articles = Article.accessible_by(current_ability, :update)
#
# Here only the articles which the user can update are returned.