On Wednesday, 3 April 2013 at 8:29 PM, Rich Buggy wrote:
Hi everyone,I'm building a multi-tenant application and I'd like some of the ID's to be per tenant. It's using the path based multi-tenant approach. For example - /:account/invoices/:idI've got the routing working correctly but the ID's are being generated automatically so they are unique across the application, not just the tenant. This isn't ideal because each tenant should start from 1.I already store the next id in the tenant table so they can choose to start from a number other than 1. This is important as someone with existing data may decide to not start from 1. I think there are a number of ways I can deal with this.1. If I was doing this without rails I'd make the tenant_id + id a composite field and set the id manually when creating the record. Is there are an easy way to do this with rails?2. I could add number field and accept that number != id. This is easy but ugly because /demo/invoices/123456 could be invoice 13. I could add a number field and try to muck with the routing so it used number instead of idDoes anyone know of a good guide or blog post on how to do this?Rich--
You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rails-oceani...@googlegroups.com.
To post to this group, send email to rails-...@googlegroups.com.
Visit this group at http://groups.google.com/group/rails-oceania?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Hi everyone,I'm building a multi-tenant application and I'd like some of the ID's to be per tenant. It's using the path based multi-tenant approach. For example - /:account/invoices/:idI've got the routing working correctly but the ID's are being generated automatically so they are unique across the application, not just the tenant. This isn't ideal because each tenant should start from 1.I already store the next id in the tenant table so they can choose to start from a number other than 1. This is important as someone with existing data may decide to not start from 1. I think there are a number of ways I can deal with this.1. If I was doing this without rails I'd make the tenant_id + id a composite field and set the id manually when creating the record. Is there are an easy way to do this with rails?2. I could add number field and accept that number != id. This is easy but ugly because /demo/invoices/123456 could be invoice 13. I could add a number field and try to muck with the routing so it used number instead of idDoes anyone know of a good guide or blog post on how to do this?Rich--
You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rails-oceani...@googlegroups.com.
To post to this group, send email to rails-...@googlegroups.com.
Visit this group at http://groups.google.com/group/rails-oceania?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Does anyone know of a good guide or blog post on how to do this?
--
You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rails-oceani...@googlegroups.com.
To post to this group, send email to rails-...@googlegroups.com.
Visit this group at http://groups.google.com/group/rails-oceania?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.