Skip to content

Instantly share code, notes, and snippets.

Element HasOneToMany Blocks
Block HasOne Element OR HasOne Data
Element AlwaysBelongsTo Definition
Definition HasZeroToMany Elements
Element AlwaysBelongsTo Transformation
Transformation HasZeroToMany Elements
# have this
attribs = ['src', 'alt', 'title', 'longdesc']
# call this
raw Liquid::Template.parse(@element.template.data).render(
'src' => data['src'],
'alt' => data['alt'],
'title' => data['title'],
'longdesc' => data['longdesc'],
)
<%=
raw Liquid::Template.parse(
'<table>{% tablerow item in items cols: 2 %}
<td>{{ item.id }}</td>
<td>{{ item.created_at }}</td>
{% endtablerow %}
</table>
'
).render('items' => Element.find(:all).collect{|item| item.attributes})
%>
class CreateContentelements < ActiveRecord::Migration
def self.up
create_table :contentelements do |t|
t.string :name
t.text :data
t.references :elementdefinition
t.timestamps
end
end
<?php
class AccessComponent extends Object {
public $settings = array();
public $defaults = array(
'admin_required' => array(),
'auth_denied' => array(),
'auth_required' => array(),
'denied' => array(),
'callback' => 'initialize');