Thanks for posting this. Could you also provide on example (of a model) that uses this concern to ensure multi tenancy?
Hey, Thanks for reading. You can easily include the concerns and use them as you go. For eg.)
If you have a user class that you want to make current'able, add the following code:
current'able
# app/models/user.rb class User < ActiveRecord::Base include ActsAsCurrent end # app/helpers/application_helper.rb class ApplicationHelper def current_user return User.current if User.current User.find(session[:id]).make_current end end # app/controllers/application_controller.rb class ApplicationController < ActionController::Base after_filter :reset_current_user private def reset_current_user User.reset_current end end
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for posting this. Could you also provide on example (of a model) that uses this concern to ensure multi tenancy?
Hey, Thanks for reading. You can easily include the concerns and use them as you go. For eg.)
If you have a user class that you want to make
current'able
, add the following code: