Code Monkey home page Code Monkey logo

Comments (9)

thhermansen avatar thhermansen commented on July 23, 2024

Hi,

First, a couple of tips. In your models you can do:

class UserInterest < MassiveRecord::ORM::Table
  # default_id is called if id is nil when you try to read an id (for instance when saved if called)
  def default_id
    # next_id() goes via the IdFactory to figure out the
    # next id for the class. You can ofc do whatever you want here :-)
    next_id
  end
end

This will result in next id for your class, just like you do above.

Have you tried user.interests.reload to see if it returns something? As far as I can see you are using it correctly, so maybe there is a bug here too.

from massive_record.

jamiltao avatar jamiltao commented on July 23, 2024

I read in your issues that there was a method like next_id(), but I
couldn't find it, thanks for the tip! I'll give reload a try, I'll let
you know what happens

from massive_record.

jamiltao avatar jamiltao commented on July 23, 2024

no luck with user.interests.reload :( still returns an empty array

ruby-1.9.2-p180 :001 > u = HbaseUser.first
=> #<HbaseUser id: "10", profile_id: "10", interest_ids: [33, 34, 35, 36, 37], button_ids: [], first_name: "Test",   last_name: "User", email: "[email protected]", password: nil, updated_at: "2011-05-25 22:42:46 -0400"> 
ruby-1.9.2-p180 :002 > u.interests
=> [] 
ruby-1.9.2-p180 :003 > u.interests.reload
=> [] 

from massive_record.

thhermansen avatar thhermansen commented on July 23, 2024

Oki, I'll see if I have the time this weekend to test it myself with a simple Rails application or something :-)

from massive_record.

jamiltao avatar jamiltao commented on July 23, 2024

awesome thanks, I'll wait for your findings :) If you don't mind sharing
the code for the sample app, it would be a big help to me :)

from massive_record.

thhermansen avatar thhermansen commented on July 23, 2024

Hi again!

I have set up a test / example application here https://github.com/thhermansen/massive_record_test_app where I did test references many. Seems to me that it's working fine. You can take a look at it to see if you spot something different from what you do.

The test application contains some comments to the examples, plus some very basic rspec tests which are all passing. Hope it helps - please tell me how it goes :-)

from massive_record.

jamiltao avatar jamiltao commented on July 23, 2024

I went through the sample app, and tried out the different ways to use references_many, and nothing was working until i decided to use the develop branch instead of the gem. Once I did that, everything started working properly. So somewhere in between the last gem release and the current develop branch, references_many wasn't working :p

Thanks for the sample app, it would be great if you could keep updating it in your free time to show off massive_record's features.

BTW, (and this should probably be a separate post) I don't suppose you have gotten devise to play nicely with massive_record? And in case you are interested, I modified a paperclip module for mongodb to work with massive_record (https://github.com/jamiltao/massive-record-paperclip)

from massive_record.

thhermansen avatar thhermansen commented on July 23, 2024

I have gotten devise to work. It was a bit hackish, but I can put up the code for it in the example app :-) Guess its time to write some wiki pages as well soon hehe. Good to see you have implemented paperclip support. I have used Carrierwave for attachments in Companybook's project.

from massive_record.

thhermansen avatar thhermansen commented on July 23, 2024

For a how-to on Devise, see: https://github.com/CompanyBook/massive_record/wiki/MassiveRecord-and-Devise. I hope that I wrote something which are possible to understand :-p

from massive_record.

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.