Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

efries's Profile

GitHub User: efries

Comments by efries

Avatar

also just do a migration for hstore:

def self.up
execute "CREATE EXTENSION hstore"
end

def self.down
execute "DROP EXTENSION hstore"
end
end

Avatar

config.active_record.schema_format = :sql

helped to run minitest with hstore

Avatar

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...

Avatar

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!

Avatar

@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 :)

Avatar

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.

  allow_action :cabinets, [ :index, :new, :create, :edit, :update ] do |cabinet|
    cabinet.customer_id == user.customer_id
Avatar

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