vim-rails
vim-rails copied to clipboard
Shortcut support for ActionMailer Previews still pending?
I just updated the latest version of Rails.vim, but it seems to not register in both the readme and actual plug-in support for ActiveMailer previews.
I'd imagine shortcuts for ActiveMailer::Preview files would be mapped to Rpreview or added to the list of files associated with Rmailer.
Such files would always be in test/mailers/previews and specs/mailers/previews according to what I know about them through the Rails 4.1 guides and Obie's TR4W book.
So one potential clash is we already have an :Rpreview command that does something else. :R navigation commands are deprecated, so I'm okay with not creating one for a brand new navigation command, but it will require special casing in the code. It may be a while before I get around to it.
These filenames always end in _preview.rb, correct? Is there a generator I can play with?
I understand now, I saw :Rpreview in the updated files you modified a few days ago thinking that was code towards support for ActiveMailer::Preview. I thought it was potentially a Windows--specific problem.
Is there a generator you can play with? Doesn't seem like there is a generator for it yet.
Based on all the Rails 4.1 RCs I've ran rails g to see all the generators (The recent release of Rails 4.1 on Windows has an exception raised when you run the command (Sprocket::Rails::VERSION (NameError), at least for me), I haven't seen a generator for it.
Edit: @rafaelfranca just fixed that; There is an automatic generation of the _preview version of mailers.
I haven't seen it generate with the use of the ActiveMailer generator either.
The file names do end with preview given the examples I've read and tried out like the following I tried out inside spec\mailers\previews:
class BanNoticePreview < ActionMailer::Preview
def ban_notice
user = FactoryGirl.create(:banned_user) # or just create(:banned_user) now since the latest version of FactoryGirl
BanNotice.ban_notice(user).deliver
end
end
@tpope: WIth the NameError issue sorted out by @rafaelfranca, you have an updated version of mailer you can play with.
The command
rails g mailer banNotice
Outputs
create app/mailers/ban_notice.rb
invoke erb
create app/views/ban_notice
invoke test_unit
create test/mailers/ban_notice_test.rb
create test/mailers/previews/ban_notice_preview.rb