Main Page

From Cubawiki

Jump to: navigation, search

There is some documentation missing, i'm working on it!

Articles in this wiki provide in-depth information on Cuba, Lore and related projects, including their usage. Here is a list of all articles.

Cuba will be renamed to and released as "beamr application framework" on rubyforge. In tutorials in this wiki, you would have to replace "Cuba" by "Beamr", but i will change this as soon as the first release is out.

Download Lore

Via svn:

svn checkout svn://rubyforge.org/var/svn/lore

Install Lore

You can checkout Lore's trunk (svn checkout svn://rubyforge.org/var/svn/lore/trunk), or install it via rubygems (recommended):

gem install lore

For the brave: There is also svn://rubyforge.org/var/svn/lore/branches/next, the work in progress on lore's upcoming release. Stuff in this branch is *not* guaranteed to be stable, so be sure to run at least the test suite (ruby dev/test/ts_lore.rb) before even trying it, and do not use it for production.

Defining models looks like this:

# File: my_app/models/my_model.rb
require 'lore/model' 
class MyModel < Lore::Model
  table :mymodel, :public             # table name and schema
  primary_key :key_a, :key_a_id_seq   # Primary key name and its sequence, if required
  primary_key :key_b, :key_a_id_seq   # Another primary key name and its sequence, if required
# ...
end

To use models defined with Lore, you need a procedure like

require 'lore/connection'
logins = { :your_db_name => [ 'user', 'pass' ] }
Lore.setup(:logins => logins)
Lore::Context.enter :your_db_name

# You can load your models now: 
require 'my_app/models/my_model.rb'

# Set up caching, optional: 
Lore.enable_mmap_cache
require 'lore/cache/mmap_entity_cache'
Table_Accessor.use_entity_cache Lore::Cache::MMap_Entity_Cache

# You can access your data now: 
MyModel.find(5).with(MyModel.some_attribute.ilike('%foo%').entities

Tutorials

If you are looking for tutorials, try our courses on Lore and Cuba.

Here is a list of all articles.

Feel free to add your (working) example code or complete the tutorials by features they don't cover yet.

But don't post bug complains or questions on the framework and/or API in this wiki!


Send your questions on Cuba, Lore and anything about it to me, or even better: Post a request at rubyforge.

Please post bugs you encountered in our issue tracking on rubyforge



Consult the User's Guide for information on using the wiki software.

Personal tools