<?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>Jan Sterba &#187; Rails</title>
	<atom:link href="http://jansterba.com/category/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://jansterba.com</link>
	<description>JavaFX, Rails and me.</description>
	<lastBuildDate>Sun, 04 Apr 2010 17:50:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Rails, factory_girl and has_many</title>
		<link>http://jansterba.com/2010/rails-factory_girl-and-has_many/</link>
		<comments>http://jansterba.com/2010/rails-factory_girl-and-has_many/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 17:29:56 +0000</pubDate>
		<dc:creator>jan</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://jansterba.com/?p=54</guid>
		<description><![CDATA[This is just a quick note that some people might find useful. I do not write factory_girl Factories that often and when I do I always keep its RDoc opened up because I never seem to remember the API (after not using it for a while). The problem I had few times before and the [...]]]></description>
			<content:encoded><![CDATA[	<p>This is just a quick note that some people might find useful. I do not write <a href="http://github.com/thoughtbot/factory_girl">factory_girl</a> Factories that often and when I do I always keep <a href="http://rdoc.info/projects/thoughtbot/factory_girl">its RDoc</a> opened up because I never seem to remember the <span class="caps">API</span> (after not using it for a while).</p>

	<p>The problem I had few times before and the problem I set out to fix today was: &#8220;What to do when you want to create multiple objects for your <strong>has_many association</strong>?&#8221; Now, this seems like a simple task for <a href="http://github.com/thoughtbot/factory_girl">factory_girl</a> callbacks. I tried many approaches, this is my final one and I am happy it works.</p>

	<p>Lets say we have a model <em>Bundle</em> and it <strong>has_many</strong> <em>BundleItem</em>s. Then a factory that creates a <em>Bundle</em> with exactly four <em>BundleItem</em>s will look like this:</p>

<pre name="code" class="ruby">Factory.define :bundle do |f|
  f.bundle_items do |bundle|
    res = []
    4.times do
      res << Factory.build(:bundle_item, :bundle => bundle.result)
    end
    res
  end
end</pre>

	<p>The only thing I am quite unhappy about is that this calls <a href="http://rdoc.info/rdoc/thoughtbot/factory_girl/blob/22d322085ec1ff8b16264126f19f4c2788bf30a1/Factory/Proxy.html#result-instance_method">Proxy.result</a> sooner than it would originally happen, but I simply do not see a better way around this. Suggestions are welcome!</p>]]></content:encoded>
			<wfw:commentRss>http://jansterba.com/2010/rails-factory_girl-and-has_many/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A storm in the Rails cup</title>
		<link>http://jansterba.com/2009/a-storm-in-the-rails-cup/</link>
		<comments>http://jansterba.com/2009/a-storm-in-the-rails-cup/#comments</comments>
		<pubDate>Sat, 02 May 2009 17:19:23 +0000</pubDate>
		<dc:creator>jan</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://jansterba.com/?p=19</guid>
		<description><![CDATA[If you (like me) have not attended the GoGaRuCo you still probably have heard about the big controversy and discussion started there. I first did not plan to but now I decided to formalize my take on this. For anyone interested. So it all started by Matt Aimonetti giving a presentation at the Golden Gate [...]]]></description>
			<content:encoded><![CDATA[	<p>If you (like me) have not attended the GoGaRuCo you still probably have heard about the big controversy and discussion started there. I first did not plan to but now I decided to formalize my take on this. For anyone interested.</p>

	<p><span id="more-19"></span></p>

	<p>So it all started by Matt Aimonetti giving a presentation at the Golden Gate Ruby Conference. The presentation title is <em>CouchDB: Perform like a pr0n star</em> and you can see the slides yourself on <a href="http://www.slideshare.net/mattetti/couchdb-perform-like-a-pr0n-star">slideshare</a>. Shortly after the conference, the organizers began to apologize for the allegedly offensive content of the presentation and others began to express their opinions (sorry, too lazy to dig up all the links) too. What struck me as quite a surprise was when even <a href="http://martinfowler.com">Martin Fowler</a>, the guy we all love, also came up with <a href="http://martinfowler.com/bliki/SmutOnRails.html">his opinion</a>. This brought this topic to quite a different light for me.</p>

	<p>I think there are two parts of this story. Both equally interesting. The first is how this presentation reflects on <em>women in the software industry</em>. First, I don&#8217;t know how is Software (or IT for that matter) any different from any other business. Women have to fight their way up to the top. But this a true for any minority entering a space controlled by someone else. Sure, the fashion is a domain of women, but do they complain of having little man to work with? I wouldn&#8217;t know for sure. In the end this all comes down to discrimination issues, be it positive or negative. Now imagine, that you would do a <em>search and replace</em> in the presentation and replace the female pictures with male bodies. Would it be offensive to us men? Would that change the nature of the presentation? Would it change the message? Well not, for sure. Or at least the message about CouchDB. But it would definitely be much less enjoyable for me and most of the guys for sure. I like woman body and I am not ashamed of it, neither is Matt, I think. We are talking about <em>programming concepts</em> or <em>patterns</em> being <em>sexy</em>, but when someone chooses to declare the sexiness of a product by associating it with something what is generally perceived as sexy he gets marked sexist? Is the fact that a picture of a female body is generally more appealing to me making me sexist? I hope not. Simply this all trying to be <em>politically correct</em> is sometimes making me sick. Anything you do can lead to offending someone. Should you do your best not to offend, you probably will not attract either, heck you probably will end up doing nothing at all. Or nothing of any importance to anyone.</p>

	<p>Which directly leads to the second issue in hand. The Rails community in all this. When characterizing a community people tend to take the opinion of its leaders as characteristic ones. I am not saying that it is a bad thing, it just may lead to wrong conclusions. From what I have read it seams (and I am with Martin on this one) that so far the <em>Rails leadership</em> has been not very active on the issue. As I already wrote, no matter how hard you try, you can always find people offended by your actions. The sexism is a very very watched front and Matt did not try very hard to avoid it, but heck why should he? How hard it is to say: &#8220;Sorry, no offense intended!&#8221; and move on? People who would be still offended afterwards are just offended because they want to be, because they misunderstood and are not willing to understand. From what I can tell from the slides is that there was nothing directed towards women in IT. And generally men are expressing their concerns about this matter. Do women have difficulties being successful in this business? Sure. But the only way to help them is to make them equal partners, not a privileged sub-community. Com&#8217; on gals, the party&#8217;s open!</p>

	<p>What I have been trying to say with the last paragraph is that Rails world <strong>is</strong> edgy. There are conflicts, but those are a requirement for things to move somewhere. And I am with Marin on this one again. Rails pushed the perception of how web frameworks should be like. Lets keep pushing guys and screw those <em>old evils</em> and anyone who comes trying to enforce them. There is nothing wrong with saying &#8220;This is how we do stuff and if you don&#8217;t like it, <strong>fork it</strong>! The beauty of open-source. I know it is not as easy as it sounds, but trying to make everyone happy either requires a lot of money to convince them that you can make them happy of a hell lot of effort that be used in better ways. I am for not trying to please everyone. I am for being truthful and honest. I am for not playing games of politics. This all looks like politics to me.</p>]]></content:encoded>
			<wfw:commentRss>http://jansterba.com/2009/a-storm-in-the-rails-cup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
