Archive for category Ruby
ERROR: rvm requires autoreconf to install the selected ruby interpreter however autoreconf was not found in the PATH.
Posted by pardeep in Installation, Rails, Ruby, Ruby on Rails, Uncategorized on November 30, 2011
This problem generally occurs in 1.8.7-head
In ubuntu this can solve your problem.
apt-get install automake
Convert utf-8 to chinese in ruby on rails
Posted by Deepak in Rails, Ruby, Ruby on Rails, Uncategorized on September 14, 2011
Sample code to send a utf-8 string in subject line of email. Its pretty simple and straight forward
def send_to_lead(lead_email, from_email, from_name, offer_id, club_id, customer_id)
@customer_name = from_name
@customer_email = from_email
str = “期待很快就可!”
# str= “subject in english”
subject=str
if str[0..1]==”&#”
subject_raw = str.gsub(“&#”,”").gsub(“!”,”").split(“;”)
subject=”"
subject_raw.each {|t| subject += [t.to_i].pack(“U*”)}
end
mail(:to => lead_email,
:from => “\”"+from_name+”\”" + “<”+from_email+”>”,
:charset => ‘utf-8′,
:subject => subject,
:reply_to => ‘noreply@buddyreferralsystem.com’,
:content_type =>’multipart/alternative’,
:content_transfer_encoding => ’8bit’,
“X-Mailer” => “Ruby (1.9.2)”
).deliver
end
Rails ActionMailer STARTTLS bug solution
Posted by Deepak in Rails, Ruby, Ruby on Rails on September 13, 2011
This is a common rails mailer issue and bug new programmers,
Net::SMTPAuthenticationError in InviteController#send_email_invites
530 5.7.0 Must issue a STARTTLS command first. u10sm46215072pbr.12 the solution of this problem is to include following settings in your environment.rb file
config/environments/development.rb
-----------------------------------
require 'tlsmail' #key but not always described
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true, #this is the important part!
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'xtargets.com',
:authentication => :plain,
:user_name => '-------',
:password => '-------'
}
Chargify API : Charge card using Basic authentication and Post Request
require “net/https”
require “uri”
data = Hash.new
data["charge"] = Hash.new
data["charge"]["amount"] = amount_to_charge
data["charge"]["memo"] = ‘This is the description of the one time charge.’
or
