Commit 6cbfb2b

mo khan <mo@mokhan.ca>
2013-06-24 04:12:46
update link model to match what embedly returns
1 parent a081b91
app/models/link.rb
@@ -1,5 +1,5 @@
 class Link < ActiveRecord::Base
-  attr_accessible :description, :heading, :url, :image_url, :user_id, :author, :author_url
+  attr_accessible :url, :description, :title, :thumbnail_url
   validates :url,  :presence => true
   belongs_to :user
   acts_as_taggable
app/models/user.rb
@@ -3,5 +3,6 @@ class User < ActiveRecord::Base
 
   attr_accessible :name, :email, :password, :password_confirmation, :remember_me
   has_many :needs
+  has_many :links
   acts_as_tagger
 end
app/views/links/index.html.erb
@@ -28,13 +28,15 @@ $('form').on('submit', function(){
       <tr>
         <th></th>
         <th></th>
-        <th>Need</th>
-        <th>Tags</th>
+        <th></th>
         <th></th>
       </tr>
       <% @links.each do |link| %>
         <tr>
         <td><%= link.url %></td>
+        <td><%= link.description %></td>
+        <td><%= link.title %></td>
+        <td><%= image_tag link.thumbnail_url %></td>
       </tr>
     <% end %>
     </table>
db/migrate/20130623155032_create_links.rb
@@ -2,11 +2,9 @@ class CreateLinks < ActiveRecord::Migration
   def change
     create_table :links do |t|
       t.string :url
-      t.string :image_url
-      t.string :heading
+      t.string :title
       t.text :description
-      t.string :author
-      t.string :author_url
+      t.string :thumbnail_url
       t.integer :user_id
       t.timestamps
     end
db/schema.rb
@@ -48,14 +48,12 @@ ActiveRecord::Schema.define(:version => 20130624022039) do
 
   create_table "links", :force => true do |t|
     t.string   "url"
-    t.string   "image_url"
-    t.string   "heading"
+    t.string   "title"
     t.text     "description"
-    t.string   "author"
-    t.string   "author_url"
+    t.string   "thumbnail_url"
     t.integer  "user_id"
-    t.datetime "created_at",  :null => false
-    t.datetime "updated_at",  :null => false
+    t.datetime "created_at",    :null => false
+    t.datetime "updated_at",    :null => false
   end
 
   create_table "needs", :force => true do |t|