Skip to content

Model issues in TitaniumDeveloper (Desktop) #2

@rudylattae

Description

@rudylattae

I am having problems using JazzRecord with TitaniumDeveloper (1.2.1). I've tried it on both Winblows (XP Pro SP3) and Linux (Ubuntu 8.04 - Hardy Heron).

It looks like I am able to connect to a db ok:

JazzRecord.adapter = new JazzRecord.TitaniumAdapter({dbFile: 'junky'});

I create my model and automigrate it ok:

JunkModel = new JazzRecord.Model({
    table: 'junk_models',
    columns: {
        title: 'string',
        description: 'string'
    }
});
JazzRecord.migrations = {};
JazzRecord.migrate();

I can even create a new instance of a model:

var junk = JunkModel.create({
    title: 'Drink some junk',
    description: 'Some serious junk for you!'
});

// using Jasmine sweetness to BDD my way through it, I can:
expect(junk.id).not.toBe(null);    // passes
expect(junk.title).toEqual('Drink some junk');    // passes

What I cannot seem to do is to .save() a record or read in any records from the db. Any of those actions generate a "Not found" error and that makes Jazz puke.

junk.title = 'Fresh junk';
junk.save();   // throws a "Not found" error
var junks = JunkModel.all();   // throws a "Not found" error

The interesting thing is that "create()" successfully creates a new model instance and persists the provided data to the db. Anything beyond that fails miserably.

I know JazzRecord is still in development so I can't hold out too much hope for it being feature complete. The reason I am attempting to use it is that I am working on a tiny Titanium Developer (Desktop) application and I have gotten to the point where I don't want to be messing with model specific SQL. I put on a brave face and was on my way to hack up a model wrapper for the Titanium.DB API when I JR caught my eye. Compared to Impel and persistencejs. JR comes closest to meeting my needs with regards to Titanium DB API support (or lack thereof :p), pluggable db adapters and fluent pure javascript syntax.

Before giving up, I will go ahead and try to dive into the source and see if there are any rapid fixes I can contribute. In the mean time, I would like to know what your plans are for supporting the current and future iterations of Titanium. Specifically:

  • Will you be able to take a look at the JSSpec specs in TD 1.2.1? I run them and out of 80 examples, there are 2 failures and 5 errors in the "Model" and "Auto-linking and unlinking" spec groups.
  • Is there a time frame for having reasonably complete coverage for Titanium?

Even if I end up not using JazzRecord, I should mention that I was very impressed with it. The implementation of the db wrapper is very slik and I'm sure once you throw call back support into the mix, things will get all kinds of funky fresh! Good job and all the best.

PS: I'll update this issue if I proceed any further with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions