diff --git a/.hound.yml b/.hound.yml index 869e42463..d62d2897a 100644 --- a/.hound.yml +++ b/.hound.yml @@ -6,5 +6,5 @@ haml: config_file: .haml-lint.yml scss: config_file: .scss-lint.yml -# eslint: -# config_file: .eslintrc +eslint: + config_file: .eslintrc diff --git a/Gemfile.lock b/Gemfile.lock index de0b44b30..d18bb7ea6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM public_suffix (>= 2.0.2, < 4.0) arel (6.0.4) ast (2.3.0) - autoprefixer-rails (7.2.2) + autoprefixer-rails (7.2.3) execjs bcrypt (3.1.11) better_errors (2.2.0) @@ -353,8 +353,8 @@ GEM omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.4.0) - oauth2 (~> 1.0) + omniauth-oauth2 (1.5.0) + oauth2 (~> 1.1) omniauth (~> 1.2) omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) @@ -376,7 +376,7 @@ GEM moneta (~> 0.8.1) plupload-rails (1.2.1) rails (>= 3.1) - poltergeist (1.16.0) + poltergeist (1.17.0) capybara (~> 2.1) cliver (~> 0.3.1) websocket-driver (>= 0.2.0) diff --git a/app/models/planting.rb b/app/models/planting.rb index 85e5277c0..c51166264 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -26,6 +26,7 @@ class Planting < ActiveRecord::Base scope :finished, -> { where(finished: true) } scope :current, -> { where(finished: false) } scope :interesting, -> { has_photos.one_per_owner } + scope :recent, -> { order(created_at: :desc) } scope :one_per_owner, lambda { joins("JOIN members m ON (m.id=plantings.owner_id) LEFT OUTER JOIN plantings p2 diff --git a/app/models/post.rb b/app/models/post.rb index 76dfcd5d8..43885e99d 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -43,7 +43,7 @@ class Post < ActiveRecord::Base # return posts sorted by recent activity def self.recently_active - Post.all.sort do |a, b| + Post.order(created_at: :desc).sort do |a, b| b.recent_activity <=> a.recent_activity end end diff --git a/app/views/home/_crops.html.haml b/app/views/home/_crops.html.haml index 274cd4957..6f881dc32 100644 --- a/app/views/home/_crops.html.haml +++ b/app/views/home/_crops.html.haml @@ -14,7 +14,7 @@ .col-md-4.hidden-xs - cache cache_key_for(Planting) do %h2= t('.recently_planted') - = render partial: 'plantings/list', locals: { plantings: Planting.includes(:owner, :photos).interesting.first(6) } + = render 'plantings/list', plantings: Planting.includes(:owner, :photos).interesting.recent.first(6) .row .col-md-12 diff --git a/app/views/home/_discuss.html.haml b/app/views/home/_discuss.html.haml index 9ffc6b502..36cc1d0f9 100644 --- a/app/views/home/_discuss.html.haml +++ b/app/views/home/_discuss.html.haml @@ -2,7 +2,7 @@ - posts = Post.limit(6) - if posts - = render partial: "posts/summary", locals: { posts: posts, howmany: 6 } + = render "posts/summary", posts: posts, howmany: 6 - cache cache_key_for(Forum) do - forums = Forum.all.order(:name) diff --git a/spec/views/seeds/show.html.haml_spec.rb b/spec/views/seeds/show.html.haml_spec.rb index 975f2baa1..4feb75d55 100644 --- a/spec/views/seeds/show.html.haml_spec.rb +++ b/spec/views/seeds/show.html.haml_spec.rb @@ -5,6 +5,7 @@ describe "seeds/show" do controller.stub(:current_user) { nil } @seed = FactoryBot.create(:seed) assign(:seed, @seed) + assign(:photos, @seed.photos) end it "renders attributes in
" do