diff --git a/.gitignore b/.gitignore index 5b61ab0..1a7325f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ /log/* !/log/.keep /tmp + +.byebug_history diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..5859406 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.2.3 diff --git a/Gemfile b/Gemfile index 7847421..83cad65 100644 --- a/Gemfile +++ b/Gemfile @@ -17,15 +17,12 @@ gem 'coffee-rails', '~> 4.1.0' # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks -gem 'turbolinks' +# gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', '~> 0.4.0', group: :doc -gem 'feedjira' -gem 'twitter-bootstrap-rails' - # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' @@ -35,6 +32,10 @@ gem 'twitter-bootstrap-rails' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development +group :development do + gem 'quiet_assets' +end + group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' @@ -46,3 +47,6 @@ group :development, :test do gem 'spring' end +gem 'feedjira' +gem 'bootstrap-sass', '~> 3.3.6' +gem 'slim-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 5d60463..877b9f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,8 +37,14 @@ GEM thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) arel (6.0.3) + autoprefixer-rails (6.1.2) + execjs + json binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) + bootstrap-sass (3.3.6) + autoprefixer-rails (>= 5.2.1) + sass (>= 3.3.4) builder (3.2.2) byebug (8.2.0) coffee-rails (4.1.0) @@ -83,6 +89,8 @@ GEM nokogiri (1.6.6.4) mini_portile (~> 0.6.0) pg (0.18.4) + quiet_assets (1.1.0) + railties (>= 3.1, < 5.0) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -124,6 +132,15 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + slim (3.0.6) + temple (~> 0.7.3) + tilt (>= 1.3.3, < 2.1) + slim-rails (3.0.1) + actionmailer (>= 3.1, < 5.0) + actionpack (>= 3.1, < 5.0) + activesupport (>= 3.1, < 5.0) + railties (>= 3.1, < 5.0) + slim (~> 3.0) spring (1.4.4) sprockets (3.4.0) rack (> 1, < 3) @@ -131,16 +148,10 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) + temple (0.7.6) thor (0.19.1) thread_safe (0.3.5) tilt (2.0.1) - turbolinks (2.5.3) - coffee-rails - twitter-bootstrap-rails (3.2.0) - actionpack (~> 4.1) - execjs (~> 2.2) - rails (~> 4.1) - railties (~> 4.1) tzinfo (1.2.2) thread_safe (~> 0.1) uglifier (2.7.2) @@ -156,17 +167,21 @@ PLATFORMS ruby DEPENDENCIES + bootstrap-sass (~> 3.3.6) byebug coffee-rails (~> 4.1.0) feedjira jbuilder (~> 2.0) jquery-rails pg + quiet_assets rails (= 4.2.2) sass-rails (~> 5.0) sdoc (~> 0.4.0) + slim-rails spring - turbolinks - twitter-bootstrap-rails uglifier (>= 1.3.0) web-console (~> 2.0) + +BUNDLED WITH + 1.10.6 diff --git a/README.md b/README.md index f693153..4efa0f8 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# feedreader-demo +# feedreader diff --git a/README.rdoc b/README.rdoc deleted file mode 100644 index dd4e97e..0000000 --- a/README.rdoc +++ /dev/null @@ -1,28 +0,0 @@ -== README - -This README would normally document whatever steps are necessary to get the -application up and running. - -Things you may want to cover: - -* Ruby version - -* System dependencies - -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ... - - -Please feel free to use a different markup language if you do not plan to run -rake doc:app. diff --git a/app/assets/images/favicon.png b/app/assets/images/favicon.png new file mode 100644 index 0000000..14afe76 Binary files /dev/null and b/app/assets/images/favicon.png differ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index bcb49bf..fef814a 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,17 +1,5 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// //= require jquery +//= require bootstrap-sprockets //= require jquery_ujs -//= require twitter/bootstrap -//= require turbolinks +// require turbolinks //= require_tree . diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js.coffee deleted file mode 100644 index 9440679..0000000 --- a/app/assets/javascripts/bootstrap.js.coffee +++ /dev/null @@ -1,3 +0,0 @@ -jQuery -> - $("a[rel~=popover], .has-popover").popover() - $("a[rel~=tooltip], .has-tooltip").tooltip() diff --git a/app/assets/javascripts/entries.coffee b/app/assets/javascripts/entries.coffee deleted file mode 100644 index 24f83d1..0000000 --- a/app/assets/javascripts/entries.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# 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://coffeescript.org/ diff --git a/app/assets/javascripts/feeds.coffee b/app/assets/javascripts/feeds.coffee deleted file mode 100644 index 24f83d1..0000000 --- a/app/assets/javascripts/feeds.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# 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://coffeescript.org/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index f9cd5b3..0000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any styles - * defined in the other CSS/SCSS files in this directory. It is generally better to create a new - * file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss new file mode 100644 index 0000000..3f2850c --- /dev/null +++ b/app/assets/stylesheets/application.scss @@ -0,0 +1,3 @@ +// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables" +@import "bootstrap-sprockets"; +@import "bootstrap"; diff --git a/app/assets/stylesheets/bootstrap_and_overrides.css b/app/assets/stylesheets/bootstrap_and_overrides.css deleted file mode 100644 index 131fcfd..0000000 --- a/app/assets/stylesheets/bootstrap_and_overrides.css +++ /dev/null @@ -1,7 +0,0 @@ -/* - =require twitter-bootstrap-static/bootstrap - - Use Font Awesome icons (default) - To use Glyphicons sprites instead of Font Awesome, replace with "require twitter-bootstrap-static/sprites" - =require twitter-bootstrap-static/fontawesome - */ \ No newline at end of file diff --git a/app/assets/stylesheets/entries.scss b/app/assets/stylesheets/entries.scss deleted file mode 100644 index 53d6246..0000000 --- a/app/assets/stylesheets/entries.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the entries controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/feeds.scss b/app/assets/stylesheets/feeds.scss deleted file mode 100644 index a00cb5b..0000000 --- a/app/assets/stylesheets/feeds.scss +++ /dev/null @@ -1,3 +0,0 @@ -// Place all the styles related to the feeds controller here. -// They will automatically be included in application.css. -// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index f2a64ba..5ba4f2e 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb @@ -1,17 +1,13 @@ class EntriesController < ApplicationController - before_action :set_feed, only: :index def index + @feed = Feed.find(params[:feed_id]) @entries = @feed.entries.order('published desc') end def show + @feed = Feed.find(params[:feed_id]) @entry = Entry.find(params[:id]) end - private - - def set_feed - @feed = Feed.find(params[:id]) - end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..aa92bd4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,11 @@ module ApplicationHelper + def full_title(page_title) + base_title = 'Feed reader' + + if @title.nil? + base_title + else + "#{base_title} | #{@title}" + end + end end diff --git a/app/helpers/entries_helper.rb b/app/helpers/entries_helper.rb deleted file mode 100644 index ed8c595..0000000 --- a/app/helpers/entries_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module EntriesHelper -end diff --git a/app/helpers/feeds_helper.rb b/app/helpers/feeds_helper.rb deleted file mode 100644 index d48dcc2..0000000 --- a/app/helpers/feeds_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module FeedsHelper -end diff --git a/app/views/entries/index.html.erb b/app/views/entries/index.html.erb deleted file mode 100644 index 67b261f..0000000 --- a/app/views/entries/index.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
- <% @entries.each do |entry| %> -
-
- <%= link_to entry.title, entry %> - published <%= time_ago_in_words(entry.published) %> ago. -
-
- <% end %> -
diff --git a/app/views/entries/index.slim b/app/views/entries/index.slim new file mode 100644 index 0000000..84dd08f --- /dev/null +++ b/app/views/entries/index.slim @@ -0,0 +1,21 @@ +- @title = "Entries of feed: #{@feed.name}" + +h1 + = @feed.name +hr + +p + = link_to 'Back', feeds_path + +- @entries.each do |entry| + .panel.panel-default + .panel-body + ' + = link_to entry.title, feed_entry_path(@feed, entry) + ' + ' - + i + ' published + = time_ago_in_words(entry.published) + ' + ' ago. diff --git a/app/views/entries/show.html.erb b/app/views/entries/show.html.erb deleted file mode 100644 index 0a0ca1f..0000000 --- a/app/views/entries/show.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -
-

<%= link_to @entry.title, @entry.url %>

- published on <%= @entry.published %> by <%= @entry.author %> -

- <%= @entry.content.html_safe %> -

-
diff --git a/app/views/entries/show.slim b/app/views/entries/show.slim new file mode 100644 index 0000000..9280ae3 --- /dev/null +++ b/app/views/entries/show.slim @@ -0,0 +1,19 @@ +- @title = "Entry of feed: #{@feed.name}" + +h3 + = link_to @entry.title, @entry.url +i + ' published on + = @entry.published + ' + - if @entry.author.present? + ' by + = @entry.author +p + = @entry.content.html_safe if @entry.content.present? +hr +p + = @entry.summary.html_safe if @entry.summary.present? + +hr += link_to 'Back', feed_entries_path(@feed) diff --git a/app/views/feeds/_form.html.erb b/app/views/feeds/_form.html.erb deleted file mode 100644 index 3ba6042..0000000 --- a/app/views/feeds/_form.html.erb +++ /dev/null @@ -1,29 +0,0 @@ -<%= form_for(@feed) do |f| %> - <% if @feed.errors.any? %> -
-

<%= pluralize(@feed.errors.count, "error") %> prohibited this feed from being saved:

- - -
- <% end %> - -
- <%= f.label :name %>
- <%= f.text_field :name %> -
-
- <%= f.label :url %>
- <%= f.text_field :url %> -
-
- <%= f.label :description %>
- <%= f.text_area :description %> -
-
- <%= f.submit %> -
-<% end %> diff --git a/app/views/feeds/_form.slim b/app/views/feeds/_form.slim new file mode 100644 index 0000000..d97b85a --- /dev/null +++ b/app/views/feeds/_form.slim @@ -0,0 +1,24 @@ += form_for(@feed) do |f| + - if @feed.errors.any? + #error_explanation + h2 + = pluralize(@feed.errors.count, "error") + | prohibited this feed from being saved: + ul + - @feed.errors.full_messages.each do |message| + li + = message + .field + = f.label :name + br + = f.text_field :name + .field + = f.label :url + br + = f.text_field :url + .field + = f.label :description + br + = f.text_area :description + .actions + = f.submit diff --git a/app/views/feeds/edit.html.erb b/app/views/feeds/edit.html.erb deleted file mode 100644 index 48274f0..0000000 --- a/app/views/feeds/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -

Editing Feed

- -<%= render 'form' %> - -<%= link_to 'Show', @feed %> | -<%= link_to 'Back', feeds_path %> diff --git a/app/views/feeds/edit.slim b/app/views/feeds/edit.slim new file mode 100644 index 0000000..dcda563 --- /dev/null +++ b/app/views/feeds/edit.slim @@ -0,0 +1,10 @@ +- @title = "Edit feed: #{@feed.name}" + +h1 + | Editing Feed + += render 'form' += link_to 'Show', @feed +' +' | += link_to 'Back', feeds_path diff --git a/app/views/feeds/index.html.erb b/app/views/feeds/index.html.erb deleted file mode 100644 index d3c1047..0000000 --- a/app/views/feeds/index.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -
-

<%= notice %>

- -

Listing Feeds

- - - - - - - - - - - - - <% @feeds.each do |feed| %> - - - - - - - - - <% end %> - -
NameUrlDescription
<%= feed.name %><%= feed.url %><%= feed.description %><%= link_to 'Show', feed %><%= link_to 'Edit', edit_feed_path(feed) %><%= link_to 'Destroy', feed, method: :delete, data: { confirm: 'Are you sure?' } %>
- -
- -<%= link_to 'New Feed', new_feed_path %> -
diff --git a/app/views/feeds/index.json.jbuilder b/app/views/feeds/index.json.jbuilder deleted file mode 100644 index 2dbf7f6..0000000 --- a/app/views/feeds/index.json.jbuilder +++ /dev/null @@ -1,4 +0,0 @@ -json.array!(@feeds) do |feed| - json.extract! feed, :id, :name, :url, :description - json.url feed_url(feed, format: :json) -end diff --git a/app/views/feeds/index.slim b/app/views/feeds/index.slim new file mode 100644 index 0000000..df73436 --- /dev/null +++ b/app/views/feeds/index.slim @@ -0,0 +1,33 @@ +- @title = 'Main page' + +p#notice + = notice +h1 + | Listing Feeds +table.table + thead + tr + th + | Name + th + | Url + th + | Description + th[colspan="3"] + tbody + - @feeds.each do |feed| + tr + td + = link_to feed.name, feed_entries_path(feed) + td + = feed.url + td + = feed.description + td + = link_to 'Show', feed + td + = link_to 'Edit', edit_feed_path(feed) + td + = link_to 'Destroy', feed, method: :delete, data: { confirm: 'Are you sure?' } +br += link_to 'New Feed', new_feed_path diff --git a/app/views/feeds/new.html.erb b/app/views/feeds/new.html.erb deleted file mode 100644 index ea150be..0000000 --- a/app/views/feeds/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New Feed

- -<%= render 'form' %> - -<%= link_to 'Back', feeds_path %> diff --git a/app/views/feeds/new.slim b/app/views/feeds/new.slim new file mode 100644 index 0000000..cc2fb09 --- /dev/null +++ b/app/views/feeds/new.slim @@ -0,0 +1,6 @@ +- @title = 'New feed' + +h1 + | New Feed += render 'form' += link_to 'Back', feeds_path diff --git a/app/views/feeds/show.html.erb b/app/views/feeds/show.html.erb deleted file mode 100644 index 3b1a2ae..0000000 --- a/app/views/feeds/show.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -
-

There are <%= link_to "#{@feed.entries.count} entries", entries_path %> available for the feed <%= @feed.name %>

-
- <%= link_to 'Edit', edit_feed_path %> - <%= link_to 'Back', feeds_path %> -
diff --git a/app/views/feeds/show.json.jbuilder b/app/views/feeds/show.json.jbuilder deleted file mode 100644 index db600e1..0000000 --- a/app/views/feeds/show.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.extract! @feed, :id, :name, :url, :description, :created_at, :updated_at diff --git a/app/views/feeds/show.slim b/app/views/feeds/show.slim new file mode 100644 index 0000000..74385df --- /dev/null +++ b/app/views/feeds/show.slim @@ -0,0 +1,13 @@ +- @title = "Feed: #{@feed.name}" + +h3 + ' There are + = link_to "#{@feed.entries.count} entries", feed_entries_path(@feed) + ' + ' available for the feed + = @feed.name +hr += link_to 'Edit', edit_feed_path +' +' | += link_to 'Back', feeds_path diff --git a/app/views/layouts/_footer.slim b/app/views/layouts/_footer.slim new file mode 100644 index 0000000..e69de29 diff --git a/app/views/layouts/_header.slim b/app/views/layouts/_header.slim new file mode 100644 index 0000000..e69de29 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb deleted file mode 100644 index 1fd3293..0000000 --- a/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - Feedreader - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> - <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/app/views/layouts/application.slim b/app/views/layouts/application.slim new file mode 100644 index 0000000..97ad19d --- /dev/null +++ b/app/views/layouts/application.slim @@ -0,0 +1,24 @@ +doctype html +html + head + title = full_title(yield(:title)) + = stylesheet_link_tag 'application', media: 'all' + = javascript_include_tag 'application' + = javascript_include_tag 'http://html5shim.googlecode.com/svn/trunk/html5.js' + + meta name="keywords" content="feed reader" + meta content="text/html; charset=utf-8" http-equiv="Content-Type" + meta name="author" content="Solyanik Yuri" + meta name="description" content="Feed reader" + + meta content="width=device-width, initial-scale=1" name="viewport" + meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" + + = favicon_link_tag 'favicon.png', rel: 'icon', type: 'image/png' + = csrf_meta_tags + + body + = render 'layouts/header' + .container + = yield + = render 'layouts/footer' diff --git a/config/database.yml b/config/database.yml index f6dd668..b471f80 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,85 +1,18 @@ -# PostgreSQL. Versions 8.2 and up are supported. -# -# Install the pg driver: -# gem install pg -# On OS X with Homebrew: -# gem install pg -- --with-pg-config=/usr/local/bin/pg_config -# On OS X with MacPorts: -# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config -# On Windows: -# gem install pg -# Choose the win32 build. -# Install PostgreSQL and put its /bin directory on your path. -# -# Configure Using Gemfile -# gem 'pg' -# default: &default adapter: postgresql encoding: unicode - # For details on connection pooling, see rails configuration guide - # http://guides.rubyonrails.org/configuring.html#database-pooling pool: 5 + user: <%= ENV["DB_USER"] %> + password: <%= ENV["DB_PASS"] %> development: <<: *default - database: feedreader_development + database: feedreader_dev - # The specified database role being used to connect to postgres. - # To create additional roles in postgres see `$ createuser --help`. - # When left blank, postgres will use the default role. This is - # the same name as the operating system user that initialized the database. - #username: feedreader - - # The password associated with the postgres role (username). - #password: - - # Connect on a TCP socket. Omitted by default since the client uses a - # domain socket that doesn't need configuration. Windows does not have - # domain sockets, so uncomment these lines. - #host: localhost - - # The TCP port the server listens on. Defaults to 5432. - # If your server runs on a different port number, change accordingly. - #port: 5432 - - # Schema search path. The server defaults to $user,public - #schema_search_path: myapp,sharedapp,public - - # Minimum log levels, in increasing order: - # debug5, debug4, debug3, debug2, debug1, - # log, notice, warning, error, fatal, and panic - # Defaults to warning. - #min_messages: notice - -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. test: <<: *default database: feedreader_test -# As with config/secrets.yml, you never want to store sensitive information, -# like your database password, in your source code. If your source code is -# ever seen by anyone, they now have access to your database. -# -# Instead, provide the password as a unix environment variable when you boot -# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database -# for a full rundown on how to provide these environment variables in a -# production deployment. -# -# On Heroku and other platform providers, you may have a full connection URL -# available as an environment variable. For example: -# -# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" -# -# You can use this database configuration with: -# -# production: -# url: <%= ENV['DATABASE_URL'] %> -# production: <<: *default - database: feedreader_production - username: feedreader - password: <%= ENV['FEEDREADER_DATABASE_PASSWORD'] %> + database: feedreader_prod diff --git a/config/locales/en.bootstrap.yml b/config/locales/en.bootstrap.yml deleted file mode 100644 index 8d75119..0000000 --- a/config/locales/en.bootstrap.yml +++ /dev/null @@ -1,23 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - breadcrumbs: - application: - root: "Index" - pages: - pages: "Pages" - helpers: - actions: "Actions" - links: - back: "Back" - cancel: "Cancel" - confirm: "Are you sure?" - destroy: "Delete" - new: "New" - edit: "Edit" - titles: - edit: "Edit %{model}" - save: "Save %{model}" - new: "New %{model}" - delete: "Delete %{model}" diff --git a/config/routes.rb b/config/routes.rb index cfef835..41072a7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,6 @@ Rails.application.routes.draw do resources :feeds do - member do - resources :entries, only: [:index, :show] - end + resources :entries, only: [:index, :show] end diff --git a/db/migrate/20151213185941_add_summary_to_entries.rb b/db/migrate/20151213185941_add_summary_to_entries.rb new file mode 100644 index 0000000..9ae9074 --- /dev/null +++ b/db/migrate/20151213185941_add_summary_to_entries.rb @@ -0,0 +1,5 @@ +class AddSummaryToEntries < ActiveRecord::Migration + def change + add_column :entries, :summary, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index c6bdc93..6800240 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20151128141751) do +ActiveRecord::Schema.define(version: 20151213185941) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -25,6 +25,7 @@ t.integer "feed_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.text "summary" end create_table "feeds", force: :cascade do |t| diff --git a/lib/tasks/sync.rake b/lib/tasks/sync.rake index 52cc3c9..7a6a9bd 100644 --- a/lib/tasks/sync.rake +++ b/lib/tasks/sync.rake @@ -4,7 +4,7 @@ namespace :sync do content = Feedjira::Feed.fetch_and_parse feed.url content.entries.each do |entry| local_entry = feed.entries.where(title: entry.title).first_or_initialize - local_entry.update_attributes(content: entry.content, author: entry.author, url: entry.url, published: entry.published) + local_entry.update_attributes(content: entry.content, author: entry.author, url: entry.url, published: entry.published, summary: entry.summary) p "Synced Entry - #{entry.title}" end p "Synced Feed - #{feed.name}"