title: ruby on rails associations newbie
body: <p>This might be considered as a re-post of <a href="https://stackoverflow.com/questions/9245476/rails-3-associations-error/9245684#comment11648767_9245684">rails 3 associations error</a>. But its something which I am not able to understand . But ok ... heres the deal.. I have asked a question in here which was related to a table schema. The post is <a href="https://stackoverflow.com/questions/9213535/what-is-bad-in-this-table-schema-structure/9222079#9222079">what is bad in this table schema structure</a> and the query was :</p>
  <pre><code>`CREATE TABLE &quot;pages&quot; (
     &quot;id&quot; INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
     &quot;title&quot; varchar(255),
     &quot;body&quot; varchar(255),
     &quot;author&quot; varchar(255), 
     &quot;email&quot; varchar(255), 
     &quot;reference&quot; varchar(255),
     &quot;created_at&quot; datetime,
     &quot;updated_at&quot; datetime);`
  </code></pre>
  <p>I was suggested that I should create separate tables for author, and that is what I tried and messed up. Can anyone please tell me how exactly should the associations work with my scenario? I really need to understand the ROR associations well.</p>
  <h1>edit-1</h1>
  <p>Here is my pages migration code:</p>
  <pre><code>class CreatePages &lt; ActiveRecord::Migration
    def self.up
      create_table :pages do |t|
        t.string :title, :unique =&gt; true, :limit =&gt; 50
        t.string :body, :limit =&gt;255
        t.string :email, :unique =&gt; true, :limit =&gt; 50
        t.string :reference, :limit =&gt; 40
        t.timestamps
      end
      
    end
  
    def self.down
      drop_table :pages
    end
  end
  </code></pre>
  <p>and here is my author migrations:</p>
  <pre><code>class CreateAuthors &lt; ActiveRecord::Migration
    def change
      create_table :authors do |t|
        t.string :author, :unique =&gt; true, :null =&gt; false, :limit =&gt; 50
        t.timestamps
      end
    end
  end
  </code></pre>