<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dogan kaya berktas &#187; rails</title>
	<atom:link href="http://doganberktas.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://doganberktas.com</link>
	<description>is actually from a small planet somewhere in the vicinity of Betelgeuse</description>
	<lastBuildDate>Thu, 26 Jan 2012 00:29:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Amazon S3 and Paperclip on Rails 3</title>
		<link>http://doganberktas.com/2010/09/14/amazon-s3-and-paperclip-rails-3/</link>
		<comments>http://doganberktas.com/2010/09/14/amazon-s3-and-paperclip-rails-3/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 16:53:43 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=662</guid>
		<description><![CDATA[I previously posted about Using Amazon S3 with Paperclip. This post will talk about same topic. But this time for Rails 3. Install aws-s3 by adding Gemfile gem 'aws-s3' and run bundle install Create s3.yml file under config directory and enter your Amazon S3 credentials (also I assume you created the buckets for development and [...]]]></description>
			<content:encoded><![CDATA[<p>I previously posted about <a href="http://doganberktas.com/tag/amazon-s3/">Using Amazon S3 with Paperclip</a>. This post will talk about same topic. But this time for Rails 3.</p>
<li>Install aws-s3 by adding Gemfile
<pre>gem 'aws-s3'</pre>
<p>and run</p>
<pre>bundle install</pre>
</li>
<li>Create s3.yml file under config directory and enter your Amazon S3 credentials (also I assume you created the buckets for development and production)
<pre>development:
  bucket: bucket-dev
  access_key_id: xxx
  secret_access_key: xxx
test:
  bucket: bucket-test
  access_key_id: xxx
  secret_access_key: xxx
production:
  bucket: bucket-pro
  access_key_id: xxx
  secret_access_key: xxx</pre>
</li>
<li> Open your model file that will hold the attachment and modify it as follows:
<pre>  #paperclip
  has_attached_file :photo,
       :styles =&gt; {
       :thumb=&gt; "100x100#",
       :small  =&gt; "400x400&gt;" },
     :storage =&gt; :s3,
     :s3_credentials =&gt; "#{RAILS_ROOT}/config/s3.yml",
     :path =&gt; "/:style/:id/:filename"</pre>
</li>
<p>That&#8217;s it! Simple isn&#8217;t it.</p>
<p>links that might help</p>
<li><a href="http://docs.heroku.com/s3">http://docs.heroku.com/s3</a></li>
<li><a href="http://stackoverflow.com/questions/3055105/establishing-connection-w-amazon-s3-from-heroku">http://stackoverflow.com/questions/3055105/establishing-connection-w-amazon-s3-from-heroku</a></li>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/09/14/amazon-s3-and-paperclip-rails-3/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Paperclip on Rails 3 &#8212; damn easy!</title>
		<link>http://doganberktas.com/2010/09/12/paperclip-on-rails-3-damn-easy/</link>
		<comments>http://doganberktas.com/2010/09/12/paperclip-on-rails-3-damn-easy/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 12:03:29 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[amazon s3]]></category>
		<category><![CDATA[file attachment]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails 3]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=640</guid>
		<description><![CDATA[Paperclip is a Rails plug-in for attaching files to models. Using Paperclip is also very easy to use, it can thumbnail your images and also send the files to Amazon S3. From this link, you can find the steps for creating a Rails project from scratch with paperclip. http://jameswilding.net/2010/07/24/paperclip-rails-3/ As I have already had a [...]]]></description>
			<content:encoded><![CDATA[<p>Paperclip is a Rails plug-in for attaching files to models. Using Paperclip is also very easy to use, it can thumbnail your images and also send the files to Amazon S3.</p>
<p>From this link, you can find the steps for creating a Rails project from scratch with paperclip.<br />
<a href="http://jameswilding.net/2010/07/24/paperclip-rails-3/"> http://jameswilding.net/2010/07/24/paperclip-rails-3/</a></p>
<p style="text-align: left;">As I have already had a project that needs file attachments, I follow a slightly different path.</p>
<p><a title="Milan Train Station at Midnight" href="http://flickr.com/photos/95572727@N00/211239773"><img class="aligncenter" src="http://farm1.static.flickr.com/83/211239773_940d75fc4d.jpg" alt="" width="450" height="298" /></a></p>
<p>The steps for adding a file attachment is as follows:</p>
<ol>
<li>Install Paperclip</li>
<pre>$ rails plugin install git://github.com/thoughtbot/paperclip.git</pre>
<li>Add image attribute to your model</li>
<pre>  #paperclip
  has_attached_file :photo,
     :styles =&gt; {
       :thumb=&gt; "100x100#",
       :small  =&gt; "400x400&gt;" }</pre>
<li>Create migration file and add the necessary columns to your database</li>
<pre>$ rails generate migration add_photo_to_microposts photo_file_name:string photo_content_type:string photo_file_size:integer</pre>
<pre>rake db:migrate</pre>
<li>Change you form</li>
<pre>
<div id="_mcePaste">&lt;%= form_for @micropost  , :html =&gt; { :multipart =&gt; true } do |f| %&gt;</div>
<div id="_mcePaste">  &lt;%= f.file_field :photo %&gt;</div>
<div id="_mcePaste">  ...</div>
</pre>
<li>Change view that will show the uploaded image (optional)</li>
<pre>&lt;% if micropost.photo.exists? then %&gt;
	&lt;%= image_tag micropost.photo.url(:small) %&gt;
&lt;% end %&gt;</pre>
</ol>
<p>That&#8217;s it. It is done.</p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/09/12/paperclip-on-rails-3-damn-easy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using Different AWS S3 Buckets on Different Rails Environments</title>
		<link>http://doganberktas.com/2010/08/10/using-different-aws-s3-buckets-on-different-rails-environments/</link>
		<comments>http://doganberktas.com/2010/08/10/using-different-aws-s3-buckets-on-different-rails-environments/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 16:34:10 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[amazon s3]]></category>
		<category><![CDATA[aws s3]]></category>
		<category><![CDATA[delayed job]]></category>
		<category><![CDATA[delayed_job]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=533</guid>
		<description><![CDATA[Below is the process for using different buckets on Amazon S3 with your production and development environments (Paperclip) 1. Add config vars to your Heroku environment  http://blog.heroku.com/archives/2009/4/7/config-vars/ heroku config:add S3_BUCKET=production-bucket-name S3_KEY=8N029N81 S3_SECRET=9s83109d3+583493190 2. Add the same constants to your .profile file export S3_BUCKET=development-bucket-name export S3_KEY=888888888 export S3_SECRET=999999999 ps . Blog Post on Heroku about AWS [...]]]></description>
			<content:encoded><![CDATA[<p>Below is the process for using different buckets on Amazon S3 with your production and development environments (Paperclip)</p>
<p>1. Add config vars to your Heroku environment  <a href="http://blog.heroku.com/archives/2009/4/7/config-vars/">http://blog.heroku.com/archives/2009/4/7/config-vars/</a></p>
<pre>heroku config:add S3_BUCKET=production-bucket-name S3_KEY=8N029N81 S3_SECRET=9s83109d3+583493190
</pre>
<p>2. Add the same constants to your .profile file</p>
<p>export S3_BUCKET=development-bucket-name<br />
export S3_KEY=888888888<br />
export S3_SECRET=999999999</p>
<p>ps . Blog Post on Heroku about AWS S3 &#8212; http://blog.heroku.com/archives/2009/4/7/config-vars/</p>
<p>ps2. and yes this post is also about  <a href="http://heatmap.me">heatmap.me</a> which is my pet project for online heatmap generation.</p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/08/10/using-different-aws-s3-buckets-on-different-rails-environments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending E-mail with Rails via Gmail (Spoiler Alert! this is for dummies)</title>
		<link>http://doganberktas.com/2010/07/30/sending-e-mail-with-rails-via-gmail-spoiler-alert-this-is-for-dummies/</link>
		<comments>http://doganberktas.com/2010/07/30/sending-e-mail-with-rails-via-gmail-spoiler-alert-this-is-for-dummies/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 22:06:56 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[actionmailler]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[RoR]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=502</guid>
		<description><![CDATA[Yes, Rails is super cool, everything is super easy, and so far I really fall in love with it. But why is it that hard to send an e-mail via Gmail !?! So after messing up a couple of git branches, I finally get it work, yey! Here are the steps: Watch the railscast about [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, Rails is super cool, everything is super easy, and so far I really fall in love with it. But why is it that hard to send an e-mail via Gmail !?!</p>
<p>So after messing up a couple of git branches, I finally get it work, yey!</p>
<p>Here are the steps:</p>
<ul>
<li>Watch the railscast about sending <a href="http://railscasts.com/episodes/61-sending-email">email</a></li>
<li>Install the gem with TLS</li>
<pre>sudo gem install ambethia-smtp-tls -v '1.1.2' --source http://gems.github.com</pre>
<li>Add the following to your environment.rb (Be careful after the Rails::Initializer.run do |config| block. )</li>
<pre>#to the top of file
require 'smtp-tls'

...
#to the very end of the file
ActionMailer::Base.smtp_settings =
{
    :address =&gt; "smtp.gmail.com",
    :port =&gt; 587,
    :domain =&gt; "gmail.com",
    :user_name =&gt; "dkberktas",#not with @gmail.com
    :password =&gt; "xxxyyyzzz",
    :authentication =&gt; :plain,
    :enable_starttls_auto =&gt; true
}</pre>
<li>Run the mailer generator by</li>
<pre>script/generate mailer user_mailer
</pre>
<li>Go to UserMailer class and add the method</li>
<pre>  def registration_confirmation()
    recipients  "xxx@gmail.com"
    from        "xxx@gmail.com"
    subject     "Thank you for being that awesome"
    body        "no I am just kidding" #if you want to pass parameter do it like this -- &gt; ":user =&gt; user"
  end
</pre>
<li>Add a sample method to application controller and add it to the routes.rb</li>
<pre>#in application controller
  def mailDeneme
    UserMailer.deliver_registration_confirmation()
    render :text =&gt; "OK"
  end
#in routes.rb
map.mail  '/mail',  :controller =&gt; 'application', :action =&gt; 'mailDeneme'
</pre>
</ul>
<p>If you see an error like this:</p>
<pre>Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first.</pre>
<p>You miss the item above about  installing smtp-tls gem. Read it again again, or check this forum <a href="http://www.railsforum.com/viewtopic.php?id=20777">post</a>.</p>
<p>ps. <a href="http://guides.rubyonrails.org/action_mailer_basics.html">This</a> is the official rails guide.<br />
ps2. this is another <a href="http://douglasfshearer.com/blog/gmail-smtp-with-ruby-on-rails-and-actionmailer">link</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/07/30/sending-e-mail-with-rails-via-gmail-spoiler-alert-this-is-for-dummies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Background Jobs in Rails &#8212; Delayed_job</title>
		<link>http://doganberktas.com/2010/07/22/background-jobs-in-rails/</link>
		<comments>http://doganberktas.com/2010/07/22/background-jobs-in-rails/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 23:06:47 +0000</pubDate>
		<dc:creator>dkberktas</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[remotespots]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[background jobs]]></category>
		<category><![CDATA[delayed job]]></category>
		<category><![CDATA[long tasks]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://doganberktas.com/?p=468</guid>
		<description><![CDATA[Rails has lots of options for background jobs, the list below is a collection of link that help my choose Delayed Jobs which is a simple and capable enough one. Blog post which is a good summary of alternatives &#8212; (kind of a survey) A related question on StackOverflow Blog post about Delayed Job link [...]]]></description>
			<content:encoded><![CDATA[<p>Rails has lots of options for background jobs, the list below is a collection of link that help my choose Delayed Jobs which is a simple and capable enough one.</p>
<ul>
<li><a href="http://4loc.wordpress.com/2010/03/10/background-jobs-in-ruby-on-rails">Blog post</a> which is a good summary of alternatives &#8212; (kind of a survey)</li>
<li>A related question on <a href="http://stackoverflow.com/questions/1107127/multiple-uploads-to-amazon-s3-from-ruby-on-rails-what-background-processing-sys/3304293#3304293">StackOverflow </a></li>
<li>Blog post about Delayed Job <a href="http://www.therailsway.com/2009/7/22/do-it-later-with-delayed-job">link</a></li>
<li><strong>Heroku <a href="http://docs.heroku.com/background-jobs">suggests</a> </strong><strong>Delayed Job, so this is the one I am looking for <img src='http://doganberktas.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </strong></li>
<li>and finally <a href="http://docs.heroku.com/delayed-job">this</a> is the Heroku guide for using Delayed Job</li>
<li><strong><a href="http://railscasts.com/episodes/171-delayed-job">Railcast</a> about Delyaed_job</strong></li>
<li><strong><a href="http://wiki.github.com/tobi/delayed_job/tips-and-tricks">Tip&amp;Tricks</a> </strong></li>
</ul>
<p>If you are interested, we are using Delayed Job for creating our heatmaps for <a href="http://remotespots.com">remotespots</a> usability testing site. Heatmap project will probably work as a separate project so that others can also use it for creating heatmaps on top of their images. Stay tuned for the heatmap side project!</p>
<p>Steps for Delayed_job</p>
<ul>
<li>Install the plugin from github (from collectiveideas) with</li>
<pre>script/plugin install git://github.com/collectiveidea/delayed_job.git</pre>
<li>Create the model</li>
<pre>script/generate delayed_job</pre>
<pre>rake db:migrate</pre>
<li>You can set priority and a certain time for the job to be put on queue.</li>
<pre>send_later(:your_method_name, -3, 3.days.from_now)</pre>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://doganberktas.com/2010/07/22/background-jobs-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

