Wednesday, November 7, 2012

Internal error in Forbidden Patterns Policy


Microsoft Visual Studio

This override warning in VS occur when editing files

Internal error in Forbidden Patterns Policy.
Error Loading The Forbidden Patterns Policy policy (The policy assembly 'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy, Version-10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5fd23423' is not registered.). Installation instructions:

Error Loading The Forbidden Patterns Policy policy (The policy assembly 'Microsoft.TeamFoundation.PowerTools.CheckinPolicies.ForbiddenPatternsPolicy, Version-10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5fd23423' is not registered.). Installation instructions:

To solve this please ensure you have the TFS Powertools extensions for Visual Studio installed.

Goto tools->extension manager and you should find it in the online section.

http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f

Rails SMTP email setup

I am using rails 3.2.6.

To setup SMTP email using ruby:

1. Add the following code into the /config/environment.rb

require File.expand_path('../application', __FILE__)

# Initialize the rails application AppName::Application.initialize!

ActionMailer::Base.delivery_method = :smtp

ActionMailer::Base.smtp_settings = {
:address => "smtp.host.com",
:port => 587,
:user_name => "email host",
:password => "email password hot",
:authentication => :plain,
:enable_starttls_auto => "true"
}

ActionMailer::Base.raise_delivery_errors = true

2. Create /app/mailers/appnamemailers.rb with the following content
class Appnamemailers < ActionMailer::Base
default :from => "email@hostemail.comd"


def welcome_email()
@url = "http://www.example.com"
mail(:to => "test@gmail.com", :subject => "Welcome to rails app")
end
end
2. To test run rails console
3. Execute the command Appnamemailers.welcome_email().deliver

Monday, November 5, 2012

rails script generate heroku

The article in this page

https://devcenter.heroku.com/articles/smtp

mentions about running a ./script/generate mailer <name>.

For my Rails 3.2.6 version, it does not contain the generate script file. So instead run with this command

rails generate mailer <name>