ruby - Rhomobile 4.1.1 - How to create local (non-sync) table -


following documentation trying create first model in rhomobile 4.1.1

it advised create ruby class, , said framework create necessary table. must have misunderstood because not working way.

model in app/auth/auth.rb

class auth   include rhom::fixedschema    set :schema_version, '0.1'    property :session_token, :string   property :remember_token, :string    def self.auth_record     @auth_record ||= begin       if find(:count) == 0         create       else         find :first       end     end   end  end 

as can see trying create fixed schema single record table. not using rhosync. result there no table created, missing step. hint appreciated.

my mistake have

require 'auth/auth' 

on top of 1 of files.

the framework relies on const_missing load , initialize model (inject dependencies, create tables, ...). explicitly required source file, constant defined therefore rhodes internal did not perform needed initialization. removing require fixed problem.

lesson learned, says 1) not solid coding , 2) undocumented.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -