Created
September 12, 2010 01:58
-
-
Save ionas/575763 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
def self.down | |
drop_table :contentelements | |
end | |
end | |
class CreateElementdefinitions < ActiveRecord::Migration | |
def self.up | |
create_table :elementdefinitions do |t| | |
t.string :name | |
t.text :description | |
t.text :options | |
t.text :template | |
t.timestamps | |
end | |
end | |
def self.down | |
drop_table :elementdefinitions | |
end | |
end | |
class Contentelement < ActiveRecord::Base | |
belongs_to :elementdefinition | |
end | |
class Elementdefinition < ActiveRecord::Base | |
has_many :contentlements | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New contentelement
<%= render 'form' %>
<%= link_to 'Back', contentelements_path %>
form
<%= form_for(@contentelement) do |f| %>
<% if @contentelement.errors.any? %>
<%= pluralize(@contentelement.errors.count, "error") %> prohibited this contentelement from being saved:
<% end %>
<%= f.text_field :name %>
<%= f.text_area :data %>
<%= f.text_field :elementdefinition %>