itsme213 asked:

What is the API generated from Og macros?

Tags:

To get, set, append, prepend, iterate, ... etc.

What constructors are generated?

(2 attempts)

goku2 answered:

You sould take a look into the Og::EntityMixin module. run the gem_server command from your shell.

In your browser type http://localhost:8808 and follow the og link. Then in the classes frame look for Og::EntityMixin and there are some of the methods that your Og classes have to find, save, etc.

Cheers!

Rating: 0

Rayman answered:

Many. Nitro/OG is pure magic.

One nice example is assign:

##model.rb
class User
  property :name, String
  property :icon, WebImage
end

##controller.rb

def save_user(oid=nil)
  if oid.nil?
    u = User.create
  else
    u = User[oid.to_i]
  end
  
  u.assign request
  u.save
end

..and the new happy user automatically gets his data from a POST request.

there are many mysterious and scary helper methods like:

find_or_create_by_name params['name']
etc..

Rating: 0