On Tuesday, October 27, 2015 at 7:22:15 PM UTC-7, Jeremy Swartwood wrote: > > I tried to setup explicit reader/writer and use the plugin for models > (Didn't see this before): plugin :sharding > > It seemed to work, however, it has the same issue as i've had all along. I > can't create a object off the model. > > In this situation, when using the plugin :sharding, it appears to convert > the class/object/model into a datatset > > reference = model_object.server(:write_access).create(params_hash) > > > - NoMethodError - undefined method `create' for > #<Sequel::MySQL::Dataset: "SELECT * FROM `enrolleet`"> > > create is a Model class method, not a dataset method, and you are calling create on the dataset (Model.server returns a dataset). If you are using the sharding plugin, you should do:
reference = model_object.create_using_server(:write_access, params_hash) Note that if you set your read-only servers with the :read_only key, and make your writable master the default server, Model.create will default to using the writable master. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
