Namespace in Ripple?

Thomas Fee gasbeing at gmail.com
Fri Jul 1 14:57:19 EDT 2011


Thanks for the tip - I'll try it... But before everyone goes July 4th crazy,
maybe I can slip in another serious question:

In ActiveRecord, one can connect to two databases simultaneously, e.g. in a
copy program, like the code sample below.

Can this be done with Ripple?

$config = <<load from YAML file>>

class SDatabase < ActiveRecord::Base
  self.abstract_class = true
  establish_connection $config['source']
end
class DDatabase < ActiveRecord::Base
  self.abstract_class = true
  establish_connection $config['destination']
end

module S
  class Root < SDatabase ;end
end
module D
  class Root < DDatabase ;end
end

def copy_roots
  S::Root.find(:all).each do |s|
    a = common_changes(s)
    d = D::Root.new(a)
    d.save!
  end
end



On Fri, Jul 1, 2011 at 11:20 AM, Sean Cribbs <sean at basho.com> wrote:

> Because it's an accessor method, that would need to be
>
> self.bucket_name = 'tcweb_roots'
>
> On Fri, Jul 1, 2011 at 1:18 PM, Aphyr <aphyr at aphyr.com> wrote:
>
>> class TcWeb::Root
>>  include Ripple::Document
>>  bucket_name = 'roots' # or tcweb_roots, whatever
>>  ...
>> end
>>
>>
>> On 07/01/2011 08:25 AM, Thomas Fee wrote:
>>
>>> I'm currently using Ripple with the application name prepended to the
>>> typename in an effort to artificially create a namespace for app, to not
>>> collide with other apps, e.g.
>>>
>>> class TcwebRoot
>>>   include Ripple::Document
>>>   property :typed_root_symbol, String, :presence => true
>>>   key_on   :typed_root_symbol
>>>   # et cetera
>>> end
>>>
>>> Where "Tcweb" is the appname functioning as a namespace prefix. The
>>> object class should ideally be called just "Root". I would prefer to not
>>> have "Tcweb" mangled into the classname.
>>>
>>> Does Ripple allow this sort of thing?...
>>>
>>> Ripple::namespace("Tcweb")
>>> class Root
>>>   include Ripple::Document
>>>   property :typed_root_symbol, String, :presence => true
>>>   # et cetera
>>> end
>>>
>>> Note:
>>> With my name mangling, plus Ripple's name mapping conventions, a
>>> TcwebRoot object is currently queried like this...
>>> http://172.22.59.51:8098/riak/**tcweb_roots/%24200-KOR%7C0<http://172.22.59.51:8098/riak/tcweb_roots/%24200-KOR%7C0>
>>>
>>>
>>>
>>> ______________________________**_________________
>>> riak-users mailing list
>>> riak-users at lists.basho.com
>>> http://lists.basho.com/**mailman/listinfo/riak-users_**lists.basho.com<http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com>
>>>
>>
>> ______________________________**_________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/**mailman/listinfo/riak-users_**lists.basho.com<http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com>
>>
>
>
>
> --
> Sean Cribbs <sean at basho.com>
> Developer Advocate
> Basho Technologies, Inc.
> http://www.basho.com/
>
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110701/f94d9ea1/attachment.html>


More information about the riak-users mailing list