Skip to content

Instantly share code, notes, and snippets.

View JonasNielsen's full-sized avatar

Jonas Bylov JonasNielsen

View GitHub Profile
<h1>Listing people</h1>
<table>
<% @enterprises.each do |ent| %>
<tr>
<th colspan="8"><%= ent.name %></th>
</tr>
class Enterprise < ActiveRecord::Base
has_many :branches
has_many :people, :through => :branches
end
class Branch < ActiveRecord::Base
has_many :people
belongs_to :enterprise
end
<h1>Listing people</h1>
<table>
<% @enterprises.each do |ent| %>
<tr>
<th colspan="8"><%= ent.name %></th>
</tr>
class Enterprise < ActiveRecord::Base
has_many :branches
has_many :people, :through => :branches
end
class Branch < ActiveRecord::Base
has_many :people
belongs_to :enterprise
end
CREATE TABLE "branches" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "address" varchar(255), "city" varchar(255), "zip_code" integer, "created_at" datetime, "updated_at" datetime, "enterprise_id" integer);
CREATE TABLE "enterprises" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime);
CREATE TABLE "people" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar(255), "last_name" varchar(255), "sex" varchar(255), "age" integer, "email" varchar(255), "created_at" datetime, "updated_at" datetime, "branch_id" integer);
CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL);
CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version");
Processing PeopleController#new (for 127.0.0.1 at 2010-02-02 14:22:49) [GET]
Enterprise Load (0.4ms) SELECT * FROM "enterprises" LIMIT 1
Branch Load (0.4ms) SELECT * FROM "branches" WHERE ("branches".enterprise_id = 1) LIMIT 1
Person Load (0.1ms) SELECT * FROM "people" WHERE ("people".branch_id = 3) LIMIT 1
%h1 About
%p Here are some text about the business!
- content_for :client_authorization do
= render :partial => 'shared/client_authorization'
- content_for :admin_menu do
= render :partial => 'shared/admin_menu'
- remote_form_for :topic, :url => topics_path(:topic), :html => {:id => 'topic_form'} do |f|
= f.hidden_field :slideshow_id, :value => slideshow_id
= f.label :title
= f.text_field :title
%br/
= f.submit 'Add Topic'
# ERROR RETURNED ---------
ActionView::TemplateError (ActionView::Helpers::JavaScriptProxy#to_str should return String) on line #7 of app/views/topics/create.rjs:
4: page.replace_html :notice, flash[:notice]
5: flash.discard
6:
7: page.create_topics_sortable()
app/helpers/topics_helper.rb:7:in `create_topics_sortable'
app/views/topics/create.rjs:7:in `_run_rjs_app47views47topics47create46rjs'
app/views/topics/create.rjs:1:in `_run_rjs_app47views47topics47create46rjs'
page.make_topics_sortable
# RETURNS ERROR:
# ActionView::TemplateError (stack level too deep)
# The sortable_element function is somehow the problem