CiviCRM | CiviCRM Community Site GroupCamp | Online project management, web-based collaboration software, cloud-based applications ActiveRecord::Associations::ClassMethods Associations are a set of macro-like class methods for tying objects together through foreign keys. They express relationships like “Project has one Project Manager” or “Project belongs to a Portfolio”. Each macro adds a number of methods to the class which are specialized according to the collection or association symbol and the options hash. It works much the same way as Ruby's own attr* methods. class Project < ActiveRecord::Base belongs_to :portfolio has_one :project_manager has_many :milestones has_and_belongs_to_many :categoriesend The project class now has the following methods (and more) to ease the traversal and manipulation of its relationships: Project#portfolio, Project#portfolio=(portfolio), Project#portfolio.nil? A word of warning Don't create associations that have the same name as instance methods of ActiveRecord::Base. Auto-generated methods See also Instance Public methods below for more details. Singular associations (one-to-one) Overriding generated methods One-to-one Caching
Projecto Colibri: Estimados utilizadores, equipa do Projecto Colibri lançou a sua mais recente versão. O Projecto Colibri RCP5 A versão 4 irá ser descontinuada em 31-12-2009, apesar de continuar a funcionar vai deixar de ter suporte e ser desenvolvida Aconselhamos que todos os utilizadores comecem a preparar a transição para a versão 5.0 até ao fim do ano de 2009. 1 De Janeiro de 2010 - Nova versão do ficheiro SAF-T PT, imposta pela Portaria n.º 1192/2009, de 08/10. 1 De Janeiro de 2011 - Obrigatoriedade de utilização de software certificado para todas as empresas que, cumulativamente, emitam mais de 500 vendas e facturem mais de 100.000EUR por ano. Para mais informações visite-nos em www.projectocolibri.com
Active Record Basics 1 What is Active Record? Active Record is the M in MVC - the model - which is the layer of the system responsible for representing business data and logic. Active Record facilitates the creation and use of business objects whose data requires persistent storage to a database. It is an implementation of the Active Record pattern which itself is a description of an Object Relational Mapping system. 1.1 The Active Record Pattern Active Record was described by Martin Fowler in his book Patterns of Enterprise Application Architecture. 1.2 Object Relational Mapping Object-Relational Mapping, commonly referred to as its abbreviation ORM, is a technique that connects the rich objects of an application to tables in a relational database management system. 1.3 Active Record as an ORM Framework Active Record gives us several mechanisms, the most important being the ability to: 2 Convention over Configuration in Active Record 2.1 Naming Conventions 2.2 Schema Conventions 3 Creating Active Record Models
Simple Groupware - open source groupware and cms ActiveRecord::Inheritance Active Record allows inheritance by storing the name of the class in a column that by default is named “type” (can be changed by overwriting Base.inheritance_column). This means that an inheritance looking like this: class Company < ActiveRecord::Base; endclass Firm < Company; endclass Client < Company; endclass PriorityClient < Client; end When you do Firm.create(name: "37signals"), this record will be saved in the companies table with type = “Firm”. You can then fetch this row again using Company.where(name: '37signals').first and it will return a Firm object. Be aware that because the type column is an attribute on the record every new subclass will instantly be marked as dirty and the type column will be included in the list of changed attributes on the record. Company.new.changed? If you don't have a type column defined in your table, single-table inheritance won't be triggered. Note, all the attributes for all the cases are kept in the same table. Namespace Methods initialize_dup