diff --git a/app/assets/javascripts/feeds.js.coffee b/app/assets/javascripts/feeds.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/feeds.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/feeds.css.coffee b/app/assets/stylesheets/feeds.css.coffee new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb new file mode 100644 index 0000000..cce59f0 --- /dev/null +++ b/app/controllers/feeds_controller.rb @@ -0,0 +1,2 @@ +class FeedsController < ApplicationController +end diff --git a/app/helpers/feeds_helper.rb b/app/helpers/feeds_helper.rb new file mode 100644 index 0000000..d48dcc2 --- /dev/null +++ b/app/helpers/feeds_helper.rb @@ -0,0 +1,2 @@ +module FeedsHelper +end diff --git a/app/models/feed.rb b/app/models/feed.rb new file mode 100644 index 0000000..1948d20 --- /dev/null +++ b/app/models/feed.rb @@ -0,0 +1,8 @@ +class Feed < ActiveRecord::Base + has_many :items + + validates_uniqueness_of :url + validates_presence_of :title + + scope :recent, order(:published, :asc).limit(10) +end diff --git a/app/models/item.rb b/app/models/item.rb new file mode 100644 index 0000000..0561bcd --- /dev/null +++ b/app/models/item.rb @@ -0,0 +1,6 @@ +class Item < ActiveRecord::Base + belongs_to :feed + + validates_presence_of :title, :author, :content + validates_uniqueness_of :url +end diff --git a/db/migrate/20120407164816_create_feeds.rb b/db/migrate/20120407164816_create_feeds.rb new file mode 100644 index 0000000..f6efdf5 --- /dev/null +++ b/db/migrate/20120407164816_create_feeds.rb @@ -0,0 +1,10 @@ +class CreateFeeds < ActiveRecord::Migration + def change + create_table :feeds do |t| + t.string :url + t.string :title + + t.timestamps + end + end +end diff --git a/db/migrate/20120407165240_create_items.rb b/db/migrate/20120407165240_create_items.rb new file mode 100644 index 0000000..08a2068 --- /dev/null +++ b/db/migrate/20120407165240_create_items.rb @@ -0,0 +1,15 @@ +class CreateItems < ActiveRecord::Migration + def change + create_table :items do |t| + t.string :title + t.string :url + t.string :author + t.text :content + t.time :published + + t.references :feed + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..1bc3161 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,34 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20120407165240) do + + create_table "feeds", :force => true do |t| + t.string "url" + t.string "title" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "items", :force => true do |t| + t.string "title" + t.string "url" + t.string "author" + t.text "content" + t.time "published" + t.integer "feed_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end diff --git a/test/fixtures/feeds.yml b/test/fixtures/feeds.yml new file mode 100644 index 0000000..0fe3f4e --- /dev/null +++ b/test/fixtures/feeds.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + uri: MyString + title: MyString + +two: + uri: MyString + title: MyString diff --git a/test/fixtures/items.yml b/test/fixtures/items.yml new file mode 100644 index 0000000..4ce5338 --- /dev/null +++ b/test/fixtures/items.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + title: MyString + url: MyString + author: MyString + content: MyText + published: 2012-04-07 18:52:40 + +two: + title: MyString + url: MyString + author: MyString + content: MyText + published: 2012-04-07 18:52:40 diff --git a/test/functional/feeds_controller_test.rb b/test/functional/feeds_controller_test.rb new file mode 100644 index 0000000..6d26a84 --- /dev/null +++ b/test/functional/feeds_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class FeedsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/feed_test.rb b/test/unit/feed_test.rb new file mode 100644 index 0000000..b018d6b --- /dev/null +++ b/test/unit/feed_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class FeedTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/feed_helper_test.rb b/test/unit/helpers/feed_helper_test.rb new file mode 100644 index 0000000..db262f4 --- /dev/null +++ b/test/unit/helpers/feed_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class FeedHelperTest < ActionView::TestCase +end diff --git a/test/unit/item_test.rb b/test/unit/item_test.rb new file mode 100644 index 0000000..f564d81 --- /dev/null +++ b/test/unit/item_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ItemTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end