Upgrade to rails 4.1
This commit is contained in:
parent
6188567931
commit
6e990fed4c
23 changed files with 179 additions and 197 deletions
|
|
@ -237,7 +237,7 @@ class FoodsoftConfig
|
|||
}
|
||||
}
|
||||
# allow engines to easily add to this
|
||||
engines = Rails::Engine::Railties.engines.select { |e| e.respond_to?(:default_foodsoft_config) }
|
||||
engines = Rails::Engine.subclasses.map(&:instance).select { |e| e.respond_to?(:default_foodsoft_config) }
|
||||
engines.each { |e| e.default_foodsoft_config(cfg) }
|
||||
cfg
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class MessagesController < ApplicationController
|
|||
|
||||
# Renders the "inbox" action.
|
||||
def index
|
||||
@messages = Message.public.page(params[:page]).per(@per_page).order('created_at DESC').includes(:sender)
|
||||
@messages = Message.pub.page(params[:page]).per(@per_page).order('created_at DESC').includes(:sender)
|
||||
end
|
||||
|
||||
# Creates a new message object.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Message < ActiveRecord::Base
|
|||
|
||||
scope :pending, -> { where(:email_state => 0) }
|
||||
scope :sent, -> { where(:email_state => 1) }
|
||||
scope :public, -> { where(:private => false) }
|
||||
scope :pub, -> { where(:private => false) }
|
||||
|
||||
# Values for the email_state attribute: :none, :pending, :sent, :failed
|
||||
EMAIL_STATE = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/ insert_after 'erb[silent]:contains("<dashboard_middle_mark>")'
|
||||
- if FoodsoftMessages.enabled?
|
||||
- unless Message.public.empty?
|
||||
- unless Message.pub.empty?
|
||||
%section#messages
|
||||
%h2= t '.messages.title'
|
||||
= render 'messages/messages', messages: Message.public.order('created_at DESC').limit(5), pagination: false
|
||||
= render 'messages/messages', messages: Message.pub.order('created_at DESC').limit(5), pagination: false
|
||||
%p= link_to t('.messages.view_all'), messages_path
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
- if pagination
|
||||
- if Message.public.count > 20
|
||||
- if Message.pub.count > 20
|
||||
= items_per_page
|
||||
= pagination_links_remote messages
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# Generic token verifier with foodcoop scope
|
||||
# @todo use +Rails.application.message_verifier+ when possible
|
||||
class TokenVerifier < ActiveSupport::MessageVerifier
|
||||
|
||||
def initialize(prefix)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue