ruby on rails - How can I scope acts_as_taggable_on_stereoids by Account? -


If I have my website logically divided into accounts (like acme.mywebsite.com, xyz.mywebsite.com) , How can I apply the act-edge-tag-on-steroid and extract the tags through an existing account?

To give a bit more detail, if I'm entering Acme, T xyz wants to see the tag from the subdomain.

I have considered work-to-taggable, but the reference is provided only if you want different sections of the tag for the same model.

Assume I have understood your question that you have more than one account in your account Tags that can be applied to any model in your application that says that the_work_ass_tagetable should do the following which you want

  class ApplicationController  

You can add the following application controller to make the subdomain accessible to all tasks. ActionController :: Base before_filter: getSubdomain def getSubdomain @current_subdomain (Self.request.subdomains [0]) Ends

Assuming that you link a tag to a subdomain, how can you create a designated area in your database then This example assumes that the subdomain is a user name and your tagging model belongs to a user, then you can use a designated scope on your tag model to select those related to the subdomain only.

  class tag & lt; ActiveRecord :: Base ... Named_Space: find_by_subdomain, labmda do | Subdomain | {: Johns = & gt; "Users.id = tags.user_id", users: conditions => ["Users.name =?", Subdomain]} End End  

Then to retrieve the tag on posts created by a user related to a subdomain: Posts.tags.find_by_subdomain (@subdomain)

NB: You must have enhanced the tag model provided by the work-of-tagable-steroid to add the following. - A column connects each account to one account. - Specification recognition for the scope of the scope. Allow multiple accounts to have the same tag.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -