On Fri, October 23, 2015 03:19, Colin Law wrote:

>
> I have not used it, but since no-one else has suggested anything,
> perhaps prepend_view_path is an option.
>
> Colin
>

Thanks.  Funnily enough that is what I started with:

  self.prepend_view_path(
    Pathname.new(
      File.join( File.dirname( __FILE__ ) )
                ).realpath.to_s
                        )

Which does work in the stand-alone script using actionmailer (4.0.13) 
but which seems not to work inside a Rails-4.2 project.  At least not
the way I think that it should.  From what I have read the
prepend_path adds to the existing Rails constructed path which will
always include the root portion of the calling controller name, in the
case of the currencies_controller this would prepend the value to
'/currencies' rather than stipulate an absolute search path.

I strongly suspect that something RoR is doing in the background is
causing these problems.  I just cannot seem to find a way to avoid or
undo it for this specific controller.

In the RoR app a link is called from the currencies_controller.

```ruby
  # Send an email with the latest commerical forex rates
  # POST /forex/send/commercial/rates
  def hll_th_forex_send_commercial_rates_notice

    @comm_curr = HLLCommercialForexRatesNotice.find_and_email_rates

```

```ruby
class HLLCommercialForexRatesNotice
. . .
    @comm_curr.each do |currency|
      unless currency.currency_code == currency.default_base_currency
       # mail_rtn = MailerPublic.deliver_forex_hll_commercial_rates(
        HllThForexMailer.hll_th_forex_commercial_rates_notice(
          currency,
          date,
          to_address,
          fm_address ).deliver_now # or: #deliver_later
      end
    end
. . .

In the stand alone script the mailer is directly invoked.

```ruby
    @comm_curr.each do |currency|
      unless currency.currency_code == currency.default_base_currency
        HllThForexMailer.hll_th_forex_send_commercial_rates_notice(
          currency, date, to_address, fm_address ).deliver
      end
    end
```

-- 
***          e-Mail is NOT a SECURE channel          ***
        Do NOT transmit sensitive data via e-Mail
James B. Byrne                mailto:[email protected]
Harte & Lyne Limited          http://www.harte-lyne.ca
9 Brockley Drive              vox: +1 905 561 1241
Hamilton, Ontario             fax: +1 905 561 0757
Canada  L8E 3C3

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/e032c70d1fd027e241a76b56efa9d4ad.squirrel%40webmail.harte-lyne.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to