<?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>Kevin Bedell on Internet Tech &#187; ruby on rails</title>
	<atom:link href="http://www.kbedell.com/tag/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kbedell.com</link>
	<description>Discussions on Ruby on Rails, Agile Development and the Boston Tech Scene.</description>
	<lastBuildDate>Mon, 09 Jan 2012 15:40:56 +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>Securing Cloud-Based Ruby on Rails Applications: Why I like Engine Yard.</title>
		<link>http://www.kbedell.com/2011/06/22/securing-cloud-based-ruby-on-rails-applications-why-i-like-engine-yard/</link>
		<comments>http://www.kbedell.com/2011/06/22/securing-cloud-based-ruby-on-rails-applications-why-i-like-engine-yard/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 13:22:15 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[aws-ec2]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[leanstartup]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[engine yard]]></category>

		<guid isPermaLink="false">http://www.kbedell.com/?p=364</guid>
		<description><![CDATA[A customer of mine referred me to an article on Cloud Deployment on Amazon Web Services&#8217; EC2 platform that discussed common security holes users are leaving in their instances. The article, Amazon&#8217;s Cloud is Full of Holes, warned that poor practices by AWS users were leaving their applications ripe for attack. I completely understand the [...]]]></description>
			<content:encoded><![CDATA[<p>A customer of mine referred me to an article on Cloud Deployment on Amazon Web Services&#8217; EC2  platform that discussed common security holes users are leaving in their instances. The article, <a href=" http://www.itworld.com/security/175927/researchers-aws-users-are-leaving-security-holes">Amazon&#8217;s Cloud is Full of Holes</a>, warned that poor practices by AWS users were leaving their applications ripe for attack.</p>
<p>I completely understand the issues behind the story and I agree &#8212; it&#8217;s much easier to create a new instance on AWS than it is to understand how secure it is. A lot of people have the skills to create instances; fewer have the skills to ensure they&#8217;re secure.</p>
<p>This, by the way, is one of the reasons I really like deploying Rails applications on <a href="http://www.engineyard.com/">Engine Yard</a>.</p>
<p>When you create an instance on <a href="http://www.engineyard.com/">Engine Yard</a>, here are some of the security features you get:</p>
<ul>
<li>It&#8217;s impossible to &#8216;ssh&#8217; directly into a system with a username/password. &#8216;ssh keys&#8217; are required.</li>
<li>You can only connect to the machines as the &#8216;deploy&#8217; user &#8212; not as root or any other user.</li>
<li>Once you login, you have sudo access and can swith user to root, but only after you&#8217;re on the machine already.</li>
<li>To enable &#8216;ssh&#8217; connection for a particular user, you have to log into the Engine Yard admin panel and upload the user&#8217;s public key then specifically authorize them on a particular instance.</li>
<li>The apps in the stack (passenger, rails, mysql, postgresql, etc) are run under accounts with restricted access.</li>
<li>The database passwords only exist on the instance and are generated random strings.</li>
</ul>
<p>This isn&#8217;t to say that they&#8217;re perfect, but I think it does say that a good deal of care has been taken to make sure the instances are secure. Most of the examples in the article were from users who were inexperienced or lacked the knowledge to secure their instances. </p>
<p>I once worked with another customer who deployed their applications using a different (yet commonly used) deployment tool. It created their instances using one of the popular Ubuntu-based AMI&#8217;s. </p>
<p>There were a number of security issues with the implementation &#8212; primary access to the instances was done using &#8216;ssh&#8217; with &#8216;root&#8217; as the login, the database accounts were setup with no passwords, etc. Not that the tool they used didn&#8217;t allow these things, but they took extra time to implement and the person who&#8217;d set it up hadn&#8217;t done so.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kbedell.com/2011/06/22/securing-cloud-based-ruby-on-rails-applications-why-i-like-engine-yard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Interview with David Heinemeier Hansson (DHH), Creator of Ruby on Rails.</title>
		<link>http://www.kbedell.com/2011/04/29/interview-with-david-heinemeier-hansson-dhh-creator-of-ruby-on-rails/</link>
		<comments>http://www.kbedell.com/2011/04/29/interview-with-david-heinemeier-hansson-dhh-creator-of-ruby-on-rails/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 16:05:00 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[interview]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[dhh]]></category>

		<guid isPermaLink="false">http://www.kbedell.com/?p=333</guid>
		<description><![CDATA[[This article originally appeared as the cover story Linux Journal Issue #147, published in July of 2006 -- back when I was still just learning Ruby on Rails. -- Kevin Bedell] Kevin: For our readers who are unfamiliar with Ruby and Rails, can you give us a short description of what they are and what [...]]]></description>
			<content:encoded><![CDATA[<p>[This article originally appeared as <a href="http://www.linuxjournal.com/article/8686">the cover story Linux Journal Issue #147</a>, published in July of 2006 -- back when I was still just learning Ruby on Rails. -- Kevin Bedell]</p>
<p><i><b>Kevin: For our readers who are unfamiliar with Ruby and Rails, can you give us a short description of what they are and what makes them different from other development environments?<br />
</b></i></p>
<p>DHH: Ruby is a dynamic and object-oriented programming language created in 1995 by Yukihiro Matsumoto. It has been described as a cross between Smalltalk and Perl, but I don&#8217;t think that juxtaposition does it justice. Ruby is, more than anything else, a language for writing beautiful code that makes programmers happy.</p>
<p>Rails, then, is an attempt to mold the beauty and productiveness of Ruby into a solution for Web applications. We&#8217;ve sought to adhere to the same core principle that guided the development of Ruby: make the programmer happy!</p>
<p>This might all sound mighty fluffy, but only until you recognize that the single-most important factor in programmer productivity is motivation. And, happy programmers are certainly motivated programmers. Thus, if you optimize for happiness, you&#8217;re optimizing for motivation, which ultimately leads to an optimization for productivity.</p>
<p><i><b>Kevin: What is Rails? Why was it developed?</b></i></p>
<p>DHH: Rails is an extraction from a solution to a real problem. It&#8217;s not a science project. It&#8217;s not something clever men sat down and designed in the highest of ivory towers. It&#8217;s simply the generic pieces that were left after I tried to use Ruby to create Basecamp—the Web-based project management system from 37signals.</p>
<p>That means it&#8217;s a very pragmatic, very targeted framework with a strong sense of direction. You might not share its vision, but it undeniably has one. I like to call that opinionated software. And Rails sure has a lot of opinions.</p>
<p>From one point of view, it could be said to be the collection of opinions I have about how Web applications should be constructed. Surely you can use Ruby on Rails without sharing all my opinions on how to create Web applications, but the more opinions you share, the less work is put upon you.</p>
<p>And, these opinions are surprisingly simple. They aim to give most people most of what they want, most of the time. It&#8217;s a strong disagreement with the conventional wisdom that everything should be configurable, that the framework should be impartial and objective. In my mind, that&#8217;s the same as saying that everything should be equally hard.</p>
<p><i><b>Kevin: I&#8217;ve been reading about Active Record and the ORM (Object-Relational Mapping) capabilitites (or how the application interfaces with databases) that are available using Ruby on Rails. Can you comment on this?</b></i></p>
<p>DHH: Active Record has, by many, been called the crown of Rails. Its core mission is to make relational data mesh seamlessly with an object-oriented domain model. And to do so with a minimum of explicit configuration.</p>
<p>So, you&#8217;ll have a Person class that&#8217;s automatically mapped to a people table (notice the cases and pluralization that Rails automatically figures out). This Person class will then have a first_name method if the people table has a first_name column. So, we&#8217;re using reflection and conventions to escape the XML situps that plague frameworks of the old world.</p>
<p>Although the lack of explicit configuration scores high points with the Enterprise crowd used to Hibernate, EJBs and other Java frameworks, it&#8217;s the mere notion of ORM that wins big with the PHP/.NET crowd. Active Record relieves you from the vast majority of all SQL writing. It&#8217;s automatically constructed on the fly. No more three-line INSERTs, no more repetitive, tedious UPDATEs. The only SQL left is the bottleneck-clearing work where actual brainpower is involved on how to make this query go really fast.</p>
<p><i><b>Kevin: For many of our readers to adopt Ruby and Rails (or convince their management to let them), they need real success stories. Where has Ruby and Rails been used to build scalable, production applications?<br />
</b></i></p>
<p>DHH: Ruby on Rails has been a huge hit inside a lot of organizations. We have some 400 people signed up as working either partially or completely in a Rails-related job. So, like an iceberg, the bulk of the action happens below the surface.</p>
<p>But, we do have a good number of public success stories too. My own company, 37signals, has four widely popular applications used by hundreds of thousands to manage their projects (Basecamp), their personal life (Backpack), their to-do lists (Ta-Da List) and their collaborative writing (Writeboard). That suite has been the number-one poster child for Ruby on Rails and has helped win over a lot of doubters.</p>
<p>But 37signals is by no means the only small team doing big things with Ruby on Rails. The Robot Co-op has a suite of social networks that includes 43things, 43places and 43people. Together, these networks push more than two and a half million dynamic page views a day across their three-machine setup.</p>
<p>Odeo is running Ruby on Rails to power its podcasting portal in front of thousands of subscribers. Evan Williams created Blogger and knows a thing or two about running a huge, public site. He&#8217;s at the wheel at Odeo.</p>
<p>Strongspace is just one of several Rails applications in the making from TextDrive. They provide gigabytes of secure hosting in the sky. It&#8217;s a really cool and smooth site by the same guys that carry the title of being the official Rails hosting firm.</p>
<p>And, that&#8217;s just a small taste. We have major applications in everything from e-commerce to productivity to content—you name it. There are very few kinds of Web applications left that Rails hasn&#8217;t been used to create.</p>
<p><i><b>Kevin: By the way, I&#8217;ve been a Backpack user for a while and I love it. Was it completely developed using Rails?</b></i></p>
<p>DHH: Backpack is indeed 100% Ruby on Rails. When it launched, it was a mere 2,000 lines of code.</p>
<p><i><b>Kevin: Java had been around for a while before it really penetrated the enterprise. It took the development of J2EE for it to establish itself as a true “enterprise development platform”. The addition of transactional management, flexible deployment strategies and so on seemed required for it to mature into that role. Could you see Ruby and Rails eventually following a similar path, or do you think its role will be something different?</b></i></p>
<p>DHH: We have a wide enterprise audience that uses Rails simply because it gets the job done, faster. I think we&#8217;ve seen the peak of Java in the enterprise. I&#8217;m sensing an understanding that while Java and the J2EE gang certainly has its uses in legacy integration, huge distributed setups that require two-phase commits and so on, it&#8217;s way overkill for the majority of applications created in the enterprise.</p>
<p>Dave Thomas from the Pragmatic Programmers recently expressed this as “cracking nuts with a sledgehammer”. Yes, a few special jobs do need sledgehammers. But you don&#8217;t need to use it [a sledgehammer] for all the other jobs that need to get done.</p>
<p>That&#8217;s why having a company standard on something like Java and J2EE seems so nonsensical. Why would you use the heaviest and slowest machinery to solve the 80% of the business that would rather have its valuable software two, three, five or ten times faster? Or, whatever the multiplier is in your environment. So, keep the big guns in store for that last 20% that actually requires it.</p>
<p><i><b>Kevin: Is there anything else you think is important to tell our readers about Ruby and Rails?</b></i></p>
<p>DHH: Give it a try! We&#8217;ve fought hard to make Ruby on Rails the easiest Web-application framework to try out. Get Ruby, get RubyGems (the apt-get of Ruby libraries), gem install rails, rails my_application, and you have your application skeleton running and ready to produce.</p>
<p>It&#8217;s hard to relay in words just how fast and easy it is to get started. So, I would invite your readers to check out the 15-minute video on the Rails Web site where we build a complete, if simple, blogging engine. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.kbedell.com/2011/04/29/interview-with-david-heinemeier-hansson-dhh-creator-of-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A simple example of automating the creation of named_scopes in rails</title>
		<link>http://www.kbedell.com/2010/12/02/simple_example_of_automating_creation_of_named_scopes_rails/</link>
		<comments>http://www.kbedell.com/2010/12/02/simple_example_of_automating_creation_of_named_scopes_rails/#comments</comments>
		<pubDate>Fri, 03 Dec 2010 04:34:59 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[metaprogamming]]></category>
		<category><![CDATA[named_scope]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.kbedell.com/?p=213</guid>
		<description><![CDATA[Here&#8217;s a common scenario: You have an attribute that can be a set of specific values, like the status of a transaction that can be &#8216;processing&#8217;, &#8216;succeeded&#8217; or &#8216;failed&#8217;.  You now want to make it easy to check these values on your model object and you think you might want to create a named scope [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a common scenario:</p>
<p>You have an attribute that can be a set of specific values, like the status of a transaction that can be &#8216;processing&#8217;, &#8216;succeeded&#8217; or &#8216;failed&#8217;.  You now want to make it easy to check these values on your model object and you think you might want to create a named scope for one of more of them.</p>
<p>Here&#8217;s a simple &#8216;design pattern&#8217; that makes this easy and fast.</p>
<p>First, define a Module within your Class and use it to define constants for the allowed values, then put those values in an Array. This tightens up the code by encouraging developers to only set that attribute to one of the &#8216;predefined&#8217; values. For example:</p>
<pre>
class Transaction &lt; ActiveRecord::Base

  # Allowed values for attribute 'status'
  module Status
    PROCESSING = 'processing'
    SUCCEEDED   = 'succeeded'
    FAILED     = 'failed'
  end
  STATUSES = [Status::PROCESSING, Status::SUCCEEDED, Status::FAILED]

end
</pre>
<p>This is a simple &#8216;design pattern&#8217; that encourages the use of good practices in development.</p>
<p>Now that we&#8217;ve got this in place, let&#8217;s spin up some ruby magic to automate the creation of status methods and named scopes for each of the different values. We&#8217;ll do so with this bit of code:</p>
<pre>
STATUSES.each do |status|
   # Define a 'setter' method for each status value
   define_method "#{status}!".to_sym do
     self.status = status
   end
   # Define an 'interrogator' method for each status value
   define_method "#{status}?".to_sym do
     self.status == status
   end
  # Define a named scope for each status value
   self.named_scope status.to_sym, :conditions =&gt; { :status =&gt; status }
 end
</pre>
<p>It&#8217;s part of the magic of Ruby that classes can so easily extend themselves by adding new methods. </p>
<p>And if you change the allowed values for the &#8216;status&#8217; field, simply modify the Module definition and add the new value to the array &#8212; creation of named scopes and the other methods will be taken care of automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kbedell.com/2010/12/02/simple_example_of_automating_creation_of_named_scopes_rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get the contents of the database.yml file from ActiveRecord</title>
		<link>http://www.kbedell.com/2009/03/06/how-to-get-the-contents-of-the-database-ml-file-from-activerecord-and-connect-to-two-databases-at-once/</link>
		<comments>http://www.kbedell.com/2009/03/06/how-to-get-the-contents-of-the-database-ml-file-from-activerecord-and-connect-to-two-databases-at-once/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 14:09:17 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[activerecord]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.kbedell.com/?p=70</guid>
		<description><![CDATA[Save to delicious. Sometimes when using Active Record you may want to create a database connection to a database other than the default database specified in your database.yml file. When this happens, the easiest way to do it is to use the Class-level convenience method on ActiveRecord::Base. Like this: Imagine your database.yml entry looks like [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://delicious.com/url/c5db65f90af6455a805484b6e7c67ccf">Save to delicious.</a></p>
<p>Sometimes when using Active Record you may want to create a database connection to a database other than the default database specified in your database.yml file.</p>
<p>When this happens, the easiest way to do it is to use the Class-level convenience method on ActiveRecord::Base. Like this:</p>
<p>Imagine your database.yml entry looks like this:</p>
<pre>development_foo:
  adapter: mysql
  encoding: utf8
  database: foo
  pool: 5
  username: my_user
  password: my_pass
  socket: /tmp/mysql.sock</pre>
<p>Now you want to create active record models that use that database connection. Here&#8217;s how:</p>
<pre># 'Bar' model points to the table 'bars' in the database 'foo'

class Bar &lt; ActiveRecord::Base

  # specify the database.yml entry
  $db_config = 'development_foo'

  # Fetch the database.yml configuration
  $config = ActiveRecord::Base.configurations[$db_config]

 # Now we can establish a connection to that database and
 # this ActiveRecord model class will point to that database.
  establish_connection $config

end</pre>
<p>It&#8217;s simple!</p>
<h6>Copyright Kevin Bedell, 2009<br />
All this code can be freely used under the terms of the MIT License.</h6>
]]></content:encoded>
			<wfw:commentRss>http://www.kbedell.com/2009/03/06/how-to-get-the-contents-of-the-database-ml-file-from-activerecord-and-connect-to-two-databases-at-once/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

