Project

General

Profile

Actions

Feature #6383

open

modifying flash from model hooks

Added by Randy Syring about 14 years ago. Updated almost 14 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
2010-09-13
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

It doesn't currently seem possible to modify the flash[:notice] (or any other type) from a model hook. In controller_issues_edit_after_save() I would like to be able to do something like:

context[:controller].flash[:notice] << 'something to append to the flash message'

In my usage, context[:controller] is Nil. Furthermore, even if context[:controller] was accessible, I am not sure context[:controller].flash would be available. I worked on a plugin 6-8 months ago and don't think that worked (but I could be remembering incorrectly).

In order to work around that, I did:


module RedmineCerb4IssuesControllerPatch
  def self.included(base) # :nodoc:
    base.send(:include, InstanceMethods)
  end

  module InstanceMethods
    # make flash publically accessible so we can use it in our hooks
    def pflash
      flash
    end
  end

and was using context[:controller].pflash[:notice] with some success. My messages were getting added to the flash message. However, I seemed to have broken request/session encapsulation b/c the messages I added to flash seemed to hang around when other issues were saved.

Actions #1

Updated by Eric Davis about 14 years ago

(I asked Randy Syring on IRC to open this as a reminder for me. The assignment is valid.)

Actions #2

Updated by Eric Davis almost 14 years ago

  • Assignee deleted (Eric Davis)

I am stepping down from working on Redmine. If someone else is interesting in working on this issue, feel free to reassign it to them.

Eric Davis

Actions

Also available in: Atom PDF