guacamole: Models in subfolders

13 views
Skip to first unread message

Klaus Humme

unread,
Nov 20, 2014, 5:13:58 AM11/20/14
to ashi...@googlegroups.com
Hi everybody,

in my rails app I decided to sort my models in subfolders, i.e. app/models for normal user frontend-dependent models, app/models/admin for administration models and so on.

The models in app/models/admin look like:

class Admin::FilingReasonTemplate
  include
Guacamole::Model
 
 
#...
end

and for the referring collection which reside in app/collections/admin

class Admin::FilingReasonTemplatesCollection
  include
Guacamole::Collection
end

Now, when I try to create a model with

seed = Admin::FilingReasonTemplate.new(description: 'something)
Admin::FilingReasonTemplatesCollection.save seed

the creation of the collection fails with

GET http://localhost:8529/_db/ecasso_development/_api/collection/admin/filing_reason_templates
GET http
://localhost:8529/_db/ecasso_development/_api/collection/admin/filing_reason_templates 404
POST http
://localhost:8529/_db/ecasso_development/_api/collection
POST http
://localhost:8529/_db/ecasso_development/_api/collection 400
Ashikawa::Core::BadSyntax: 1208: cannot create collection: illegal name

I think Ashikawa tries to create a subfolder 'admin' in collections instead of creating a collection named admin_filing_reason_templates.

Are there any suggestions how to solve this?

Cheers
Klaus


Dirk Breuer

unread,
Nov 20, 2014, 10:11:17 AM11/20/14
to ashi...@googlegroups.com
Hi Klaus,

great to see you're going all the way with Guacamole. And sorry for the problems along that way.

Currently we don't have a nice configuration interface for that sort of things nor do handle namespaces
correctly.

Nevertheless you could 'just' overwrite the responsible methods in your collection classes:

class Admin::FilingReasonTemplatesCollection
include Guacamole::Collection

def self.collection_name
super.gsub('/', '_')
end

def self.model_class
Admin::FilingReasonTemplate
end
end

This should fix your problems for now. I will create an issue to address this.

Cheers
Dirk
> --
> You received this message because you are subscribed to the Google Groups "Ashikawa ArangoDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ashikawa+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages