GithubHelp home page GithubHelp logo

Comments (7)

langalex avatar langalex commented on June 19, 2024

without the ruby_class we don't know which class to use when converting the document into a ruby object. also, you can't do things like finding all blog posts without knowing wether a particular document is a blog post or not.

from couch_potato.

shenoudab avatar shenoudab commented on June 19, 2024

but what if every database have only one Model. as say that this database have documents which represent "Post" Model.
so when converting to Ruby Object i know that i will convert them to Post Model.
and also finding Posts, as every document in that database is represent a Post Model ....

from couch_potato.

langalex avatar langalex commented on June 19, 2024

do you have any specific reason to put every kind of document into a separate database? if not you might find your mindset stuck in SQL land... anyway if you have reasons to do so, then you can overwrite the to_hash method in CouchPotato and filter out the ruby_class attribute.

from couch_potato.

shenoudab avatar shenoudab commented on June 19, 2024

thanks for your support ... as i will have a database to represent one Model.. the core model.

but i'd like to ask .. is overwriting the to_hash method ... will not write the "ruby_class" in the document and also the dynamic views ..

from couch_potato.

langalex avatar langalex commented on June 19, 2024

i don't know what you are talking about, can you rephrase your question?

from couch_potato.

shenoudab avatar shenoudab commented on June 19, 2024

sorry, i'd like to ask how to ignore write the ruby_class property in the document.
and also ignore represent the ruby_class in dynamic views offered by couch_potato.

is overwriting to_hash method will cover the above.

from couch_potato.

langalex avatar langalex commented on June 19, 2024
def to_hash
  hash = super.dup
  hash.delete('ruby_class')
  hash
end

the auto generated view all check for the ruby_class, so you have to provide your own map function:

view :my_view, :type => :custom, :map => "function(doc) {emit(...)}"

from couch_potato.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.