<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>DevChix » Rails</title>
	
	<link>http://www.devchix.com</link>
	<description>Boys can't have all the fun</description>
	<pubDate>Sat, 04 Jul 2009 06:18:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/devchix/zKMD" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>RailsBridge</title>
		<link>http://www.devchix.com/2009/05/04/railsbridge/</link>
		<comments>http://www.devchix.com/2009/05/04/railsbridge/#comments</comments>
		<pubDate>Mon, 04 May 2009 15:55:10 +0000</pubDate>
		<dc:creator>gloriajw</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://www.devchix.com/?p=270</guid>
		<description><![CDATA[Even though I am a Python developer, this made me happy:

http://railsbridge.org/
We&#8217;ve been fortunate to have an outstanding, welcoming Python community driving the tone and the quality of events from PyCon, down to the statewide and local user groups. We don&#8217;t yet have a need for such a bridge group, and I hope we never need [...]]]></description>
			<content:encoded><![CDATA[<p>Even though I am a Python developer, this made me happy:</p>
<p><a href="http://railsbridge.org/"><br />
http://railsbridge.org/</a></p>
<p>We&#8217;ve been fortunate to have an outstanding, welcoming Python community driving the tone and the quality of events from PyCon, down to the statewide and local user groups. We don&#8217;t yet have a need for such a bridge group, and I hope we never need one. But it&#8217;s great to see one form quickly where it&#8217;s needed, and to see familiar names associated with it. More power to you.</p>
<p>Gloria</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2009/05/04/railsbridge/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using YUI DataTable with Rails</title>
		<link>http://www.devchix.com/2009/02/07/using-yui-datatable-with-rails/</link>
		<comments>http://www.devchix.com/2009/02/07/using-yui-datatable-with-rails/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 23:11:19 +0000</pubDate>
		<dc:creator>sarah g</dc:creator>
		
		<category><![CDATA[Javascript/AJAX]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<category><![CDATA[dataTable]]></category>

		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.devchix.com/?p=199</guid>
		<description><![CDATA[I am currently working on an Rails app that integrates the YUI dataTable, and in going through the tutorials I noticed they are all assume a PHP back-end. I also saw a number of people asking how to get this to work with a Rails controller, so I thought I&#8217;d write up my experience in [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently working on an Rails app that integrates the <a href="http://developer.yahoo.com/yui/datatable/">YUI dataTable</a>, and in going through the tutorials I noticed they are all assume a PHP back-end. I also saw a number of people asking how to get this to work with a Rails controller, so I thought I&#8217;d write up my experience in the hopes that it helps someone else. For basic info about setting up the dataTable, refer to the YUI site, linked above. I&#8217;m also going to try to clarify a few things that I found a bit obscure. </p>
<p>To create a dataTable you have to define a few basic ingredients: </p>
<ol>
<li>A <a href="http://developer.yahoo.com/yui/datasource/">dataSource</a>. This defines where the info in the table comes from, and what format it is returned in. I&#8217;m using JSON. </li>
<li>A schema that you define. This is a part of the dataSource and is essentially a map to your data. The schema tells the table where to find the field values.</li>
<li>An array of column definitions. You supply the name and &#8220;key&#8221; of each column and any additional information, such as whether it is editable (and if so, which editor to use) and how to format the data inside the column if you don&#8217;t want to just spit it out directly. </li>
</ol>
<p>Let&#8217;s start with a dataSource. In this example, we&#8217;re making a table of tasks, so I want to hit my tasks controller to return the data. Standard Rails controller action.  In the code snippet below,  </p>
<ol>
<li> in line 1, I supply a URL (note that the url ends in .json, and in my controller I have a responds_to block which constructs my json response).</li>
<li>  In line 2, I&#8217;m telling the dataSource &#8212; hey, you&#8217;re gonna get some JSON.  </li>
<li>And line 3, is where we define the <span id="schema">responseSchema</span>, which has two critical parts: the <strong>resultsList</strong> and the <strong>fields</strong>.</li>
</ol>
<pre>
  var dataSource = new YAHOO.util.XHRDataSource("/projects/13/elements/21/tasks.json");
  dataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
  dataSource.responseSchema = {
   resultsList: "Resources.data",
   fields: [
      {key:"task.id"},
      {key:"task.status"},
      {key:"task.percent_complete"},
      {key:"task.description"},
      {key:"task.due_date", parser:date}
      ]
  }
</pre>
<p>Let me be clear since I got hung up on this a bit. You as the application developer are responsible for two things.  One, constructing your response &#8212; in other words, you can build your JSON response any way you want, with any keys, values and hierarchical structure that make sense (though it will help you to think it through and standardize it, <a href="http://yuiblog.com/blog/2008/10/27/datatable-260-part-two/">Satyam has some good info on that here</a>). And two, telling your dataSource how to navigate your response: i.e. &#8212; where do find what the data you&#8217;re looking for (the needle) in the response (the haystack of JSON)?  This is the schema, the map of your data.<br />
<span id="controller">Controller code that creates my custom JSON</span>:</p>
<pre>
# tasks_controller.rb
def index
 respond_to do |format|
      format.json{
         tasks = []
         @tasks.each do |task|
           task_container = {}
           task_container  = task
           task_container['editable_by_user'] = permission.edit? # some metadata I use
           task_container['deletable_by_user'] = permission.delete?
           task_container['resource_name'] = "task"
           tasks << task_container
        end
        data = {"Resources" => {"data" => tasks}}
        render :json => data.to_json
      }
  end
end
</pre>
<p>And just for fun, here&#8217;s a look at the JSON my controller gives me back when I hit this url &#8216;/projects/13/elements/21/tasks.json&#8217;.<br />
<span id="json">The JSON</span>:</p>
<pre>
{"Resources": {"data": [{"task": {"status": "not_started", "started_on": null, "updated_at": "2009-02-07T22
:03:18Z", "project_id": 13, "percent_complete": null, "high_priority": null, "element_id": 32, "deletable_by_user"
: true, "completed_on": null, "editable_by_user": true, "element_title": "looking good", "id": 50, "created_by_id"
: 7, "resource_name": "task", "description": "Pass the stimulus bill", "assignments": [], "due_date"
: "", "users": [], "resource_url": "/projects/13/elements/32/tasks/50", "due": null, "created_at": "2009-02-07T22
:03:18Z"}}, {"task": {"status": "not_started", "started_on": null, "updated_at": "2009-02-07T22:03:39Z"
, "project_id": 13, "percent_complete": null, "high_priority": null, "element_id": 32, "deletable_by_user"
: true, "completed_on": null, "editable_by_user": true, "element_title": "looking good", "id": 51, "created_by_id"
: 7, "resource_name": "task", "description": "Negotiate without pre-conditions", "assignments": [], "due_date"
: "", "users": [], "resource_url": "/projects/13/elements/32/tasks/51", "due": null, "created_at": "2009-02-07T22
:03:39Z"}}]}}</pre>
<p>So that&#8217;s it! I&#8217;ve defined this JSON array and built it, then returned it from the controller when I get a .json request. </p>
<p>Now that you&#8217;ve seen the response, take another look at the responseSchema (<a href="#schema">you created above</a>) and the two properties that you set:</p>
<ol>
<li>ResultsList. Notice it is set to &#8220;Resources.data&#8221;, which are the JSON keys I used. It uses dot-syntax to point to array of tasks in my json. </li>
<li>Fields.  Again using dot syntax, and having the ResultsList array to navigate through, it can pull the specific values it wants from the list; so &#8216;task.status&#8217;, &#8216;task.started_on&#8217;, etc., will retrieve those values from the response. </li>
</ol>
<p>Make sense? </p>
<p>You are now one step away from being able to see your table. So, create your column definitions, an array of data about each column in the table. This is also where you can specify formatting and editing information (not covered in this article). </p>
<pre>
var columnDefinitions = [
  {key:"task.status",formatter:"formatPriority", sortable:true},
  {key:"task.percent_complete", label:"Percent Complete", sortable:true},
  {key:"task.description", label:"Description"},
  {key:"task.due_date", label:"Due Date", editable:true,sortable: "true",formatter:YAHOO.widget.DataTable.formatDate, editor: new YAHOO.widget.DateCellEditor({resource:'task', updateParams:"task[due]"})}
  ];
</pre>
<p>Notice that each column definition has a key: this key must be accessible in your JSON, AND it must be defined as a field.  </p>
<p>And then you create your table. The first argument is the id of a div on the page to which the table will be attached, the last is an optional configuration hash (pagination, anyone?).  </p>
<pre>
var dataTable = new YAHOO.widget.DataTable("project_tasks", columnDefinitions, dataSource, optionalConfigurationHash);
</pre>
<p>I hope this is helpful to get you started with the YUI dataTable on Rails. I may do further posts on XHR editing of individual cells in a dataTable using Rails.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2009/02/07/using-yui-datatable-with-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to see exception_notification plugin work in development mode.</title>
		<link>http://www.devchix.com/2008/12/09/how-to-see-exception_notification-plugin-work-in-development-mode/</link>
		<comments>http://www.devchix.com/2008/12/09/how-to-see-exception_notification-plugin-work-in-development-mode/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 13:53:30 +0000</pubDate>
		<dc:creator>desi</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.devchix.com/?p=190</guid>
		<description><![CDATA[I use HopToad by the Thoughtbot Guys (I say guys because I know they don&#8217;t have any girls on the team *wink*) to handle exceptions from my rails apps these days but today I found myself in a situation where I needed to use the exception_notification plugin instead. I haven&#8217;t used the plugin for quite [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://www.hoptoadapp.com/welcome">HopToad</a> by the <a href="http://thoughtbot.com/">Thoughtbot Guys</a> (I say guys because I know they don&#8217;t have any girls on the team *wink*) to handle exceptions from my rails apps these days but today I found myself in a situation where I needed to use the <a href="http://github.com/rails/exception_notification/tree/master">exception_notification plugin</a> instead. I haven&#8217;t used the plugin for quite sometime so I wanted to make sure I had everything all setup correctly before pushing out to staging and production. I remembered that I had done this before in development but I couldn&#8217;t remember everything I needed to do so I, of course, asked uncle Google. After reading the readme and a little googling I figured out what I needed to do in order to see it work in development. It took me far longer than I wanted and I don&#8217;t want to go through that again in the future so I figured I would just write a quick blog post to remind me next time I want to do it.</p>
<p>So here goes:</p>
<p><strong>First get Exception notification all setup (this is all from the readme file)</strong></p>
<p><code>script/plugin install git://github.com/rails/exception_notification.git </code></p>
<p>then in application.rb put<br />
<code>include ExceptionNotifiable</code></p>
<p>then in environment.rb  put<br />
<code>ExceptionNotifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com)</code></p>
<p><strong>Once you have it setup you can do all the other stuff that lets you see it work in your development environment.</strong></p>
<p>put the following two lines in your application.rb file<br />
<code>alias :rescue_action_locally :rescue_action_in_public<br />
local_addresses.clear</code></p>
<p>then in your development.rb file change<br />
<code>config.action_controller.consider_all_requests_local = true</code><br />
to be<br />
<code>config.action_controller.consider_all_requests_local = false</code></p>
<p>Exception Notifier doesn&#8217;t send email notification on ActiveRecord::RecordNotFound and ActionController::UnknownAction errors. So you will need to create 500 error to see the notification going out in your log. You can just add an action to a controller that throws a divide by zero error, restart your server and hit that action and you should see the notification trigger in your development log.</p>
<p>Once you have seen it work make sure to undo everything in the second section.</p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2008/12/09/how-to-see-exception_notification-plugin-work-in-development-mode/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rails Summit Latin America</title>
		<link>http://www.devchix.com/2008/10/16/rails-summit-latin-america/</link>
		<comments>http://www.devchix.com/2008/10/16/rails-summit-latin-america/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 20:58:09 +0000</pubDate>
		<dc:creator>desi</dc:creator>
		
		<category><![CDATA[Events]]></category>

		<category><![CDATA[Introductions]]></category>

		<category><![CDATA[Presentation]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Reviews]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Thoughts]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.devchix.com/?p=183</guid>
		<description><![CDATA[I am currently in Sao Paulo, Brazil at Rails Summit Latin America and the experience has been great thus far.
Ladies at the conference there is information at the end of this writeup about how to join. If you don&#8217;t feel like reading everything in this writeup that is fine but please do read about joining. [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently in Sao Paulo, Brazil at <a href="http://www.locaweb.com.br/railssummit/default.asp?language=7">Rails Summit Latin America</a> and the experience has been great thus far.</p>
<p><b><i>Ladies at the conference there is information at the end of this writeup about how to join. If you don&#8217;t feel like reading everything in this writeup that is fine but please do read about joining.</i></b> </p>
<p>In contrast to many conferences I have been to recently I have been to just about every talk at this conference and I have thoroughly enjoyed them all. I say just about because there is a second track that is going on in another room but I haven&#8217;t been to those sessions. </p>
<p><b>The Organizers:</b><br />
<a href="http://www.akitaonrails.com/"> Fabio Akita and Gilberto Mautner Founder of <a href="http://www.locaweb.com.br/portal.html">locaweb </a> have done a great job with the conference and I would like to give them a special thanks. The lineup, venue and everything has been great. Obrigado!</p>
<p><b>Theme:</b><br />
I think most conferences, through the keynotes, some how seem to create a theme. The theme that I am picking up on at this conference is this: &#8220;Have No Fear&#8221; and &#8220;Just Do It&#8221;. No one actually said either of those two things but thats basically what I am taking away from most of the keynotes. They have all been especially encouraging for people to become involved. Contribute, create, and code. Give back to the community and get involved. Don&#8217;t be afraid .. put yourself out there and learn from the feedback you get.. learn from the experiences of creating.. do side projects.. basically be PASSIONATE.</p>
<p><b>The Talks:</b><br />
All the talks I have seen have been excellent. I give them an excellent rating because they have all had the qualities I look for in a talk.<br />
1. The content is good and interesting.<br />
2. The delivery of that content is entertaining or at least engaging.</p>
<p><b>Chad Fowler</b> - I really enjoyed Chad&#8217;s talk and as I sit here I am struggling to figure out a way to describe his talk and actually do it justice. He spoke about his background in music and how that has translated to his life as a developer. In addition, he spoke about being remarkable. He talked about many ways in which people are remarkable and many ways in which we ourselves can become remarkable people. He touched on many things and did so in such a way that I was able to stay engaged with him. There were pictures and video&#8217;s and graphs and fake numbers and.. anyway about the best I can say is that I personally really enjoyed his talk.</p>
<p><b>Dr. Nic Williams</b> - Dr. Nic&#8217;s presentation is a little easier to sum up but at the same time I can&#8217;t really do it justice. Dr. Nic is one of those speakers that if you ever have a chance to see him speak you should definitely take the opportunity. He is hilarious and has a good message. His talk was all about how to contribute back.. how to get involved.. how to participate. Make the future you proud of the you now.   <a href="http://drnicwilliams.com/2007/08/20/newgem-using-rubigen-for-generator-support/">Dr. Nic also talked about newgem</a></p>
<p><b>Chris Wanstrath</b> - Chris&#8217;s keynote started off being about the future of Ruby and RoR but in the end he took it back to the past and where we have come from. He went through a great deal of history on how we got here which I personally enjoyed especially when he pointed out the first ENAIC programmers were all women, unfortunately he was speaking quite fast so I think a lot of his talk was lost in translation. I think the primary thing Chris was trying to get across is to not be afraid. If you have an idea.. make time to get to it you never know where thats going to go. In the very least you gain experience and you gain knowledge. <a href="http://www.github.com">Chris has had many projects in the past but his current claim to fame is all about github.</a></p>
<p><b>Jay Fields</b> - Jay&#8217;s talk was about the immaturity of testing as a whole. While I agree with some of the things he said I also disagree with some of the things he said. I have had the luxury of getting to pair with Jay on projects before and its always interesting for me to see him speak because I have first hand experience with a lot of things he talks about. He described the problem of immaturity in testing as a whole first with the fact that we can&#8217;t even agree on common terminology. He then proceeded to talk about various tools and the pros and cons of each. He covered Selenium, Test:Unit, Rspec, Syntasis, and Expectations. The last two being the most immature of them all and bleeding edge. i.e. use at your own risk. He also answered a few questions about how to make your test suite fun faster and his response was basically that if you are willing to deal with the pain that goes along with it there are tools you can look into using such as null_db, unit_record, and ARBS. You can read about them on <a href="http://agilewebdevelopment.com/plugins/nulldb"> the null_db page on Agile Web Development site</a>. That page links out to the other plugins.  Jay also pointed out that all the things he was talking about are from his point of view. In other words its the context in which he works that causes him to have some of the testing beliefs he has.</p>
<p><b>David Chemlisky</b> - David&#8217;s first talk was about doing TDD and in my opinion he did an excellent job of demonstrating TDD. I have seen him give a talk similar in the past and of all the people I have heard try to describe TDD, David is one of the most skilled at it. He gave the talk from the point of view of a teacher which in my opinion is really the only way you can truly explain TDD. He went through the process step by step with us all to show us the way. :)</p>
<p>His second talk was more about Acceptance testing and story runner and the newest version of story runner which is being called cucumber. He demonstrated how it worked and made sure to give context around all the terminology such as user stories etc. Hopefully there will be some way of seeing this talk again maybe through a screen cast or something of that nature. I&#8217;ll be sure to ask him if he would be willing to do that. Or maybe there is one with cucumber? Not sure haven&#8217;t had a chance to look yet.<br />
Couple of links to stuff he talked about.<br />
<a href="http://github.com/aslakhellesoy/cucumber/wikis/home">Cucumber</a><br />
<a href="http://github.com/brynary/webrat/tree/master">webrat on github</a> and <a href="http://movesonrails.com/articles/2008/08/19/webrat-story-steps">a blog post on it here</a></p>
<p>On that last note I am actually interested to know if these talks are being recorded and if they will be available somewhere?  Anyone know the answer to that?</p>
<p><b>Obie Fernandez</b> - I haven&#8217;t actually seen Obie give his talk yet but I have seen the talk (insider information) so I am going to go ahead and give a recap.. I asked him to plug DevChix and wanted to have this write up already done before he did so.. ;-)  So Obie&#8217;s talk will be about the &#8220;Hashrocket Way&#8221;. He is basically giving up our secrets.. Like Dr. Nic said no secrets!  His main focus will be around how we work, the fact that we follow Agile Tenants and that we value fun, collaboration, and effectiveness. We achieve those things through certain practices such as pair programming, TDD, Story Carding, launch parties etc. <a href="http://blog.obiefernandez.com">Again you should check out his blog.</a></p>
<p><b>Ninh Bui and Hongli Lai a.k.a The Phusion Guys</b> - I woke up late so I didn&#8217;t catch all of the talk from the Phusion guys but the part that I did catch was hilariously funny and explained things like caching and database sharding. Additionally, they gave a demo of <a href="http://github.com/FooBarWidget/yuumius_comments/tree/master"> yuumis_comments..</a> and <a href="http://blog.phusion.nl/">here is also a link to their blog</a> </p>
<p>I call out all of these guys because they are some of the best speakers I have ever seen and I actually saw them speak at this particular event. </p>
<p><b>Phillippe Hanrigou</b> - Phillippe is going to be giving a talk on how to effectively do acceptance testing which I am looking forward to but I won&#8217;t be able to cover that here because I haven&#8217;t seen it and since I don&#8217;t have insider info on that one I&#8217;ll just have to wait like everyone else. I do know that he will be talking about one tool I hadn&#8217;t heard of before called <a href="http://deep-test.rubyforge.org/">Deep Test</a>. <a href="http://ph7spot.com">You should check Phillippe&#8217;s blog as well</a></p>
<p><b>Luis Lavena</b> - Luis will also be giving a talk about surviving with RoR and Ruby as a windows user.. again I think the talk is going to be awesome but its in the future so I can&#8217;t really talk about that yet. <a href="http://blog.mmediasys.com/">You should check out his blog!</a></p>
<p><b>The Venue:</b><br />
The venue is quite nice. The main auditorium is very well arranged and has plenty of room despite the fact that there are a lot of people here. There is a very large screen making it easy for everyone to see the slides as well as the speakers. The lighting on the actual speakers is a little weird but other than that the actual conference room is great. The audio is fantastic and the actual hang out area is quite nice as well (other than the lack of air conditioning but thats just me being a little whiny its not really that hot). One other really important point that I want to bring up is the translators. You can get a headset at the checkin area that will translate the talks from English to Spanish and Portuguese and from what I understand the translators have been doing a kick ass job so a special thanks to all those ladies in the booths translating for us. </p>
<p><b>The Community:</b><br />
I was very encouraged by the number of people at the conference, the number of people using github (vast majority) and the number of people doing Ruby and RoR development on a day to day basis. It is always an exciting moment for me when I realize it is gaining in support because how much I love the language. In addition, everyone has been extremely helpful and friendly. We meet <a href="http://www.karmacrash.com/">Tim Case</a> the first day and he was more than willing to take us under his wing and show us around. </p>
<p>One thing that was both encouraging and discouraging is the number of women at the conference. There were women, thats the good news, the bad news is that I think from a ratio point of view the number of women at the conference is on par with what I have experienced at Ruby and RoR conferences in the US. That is to say its pretty small. Usually at conferences since there are so few women I can manage to talk to most of them and but here I have been some what intimidated by the language barrier. One other thing to point out is that there were no women speakers but hey that isn&#8217;t really that uncommon. I am hoping that when Obie does his talk and plugs DevChix for us that many of those women who were at the conference that I didn&#8217;t get to meet will come to the site and join.</p>
<p><b>Ladies Please Read</b><br />
For those women who do happen to come to the site from Brazil and other countries. I would like to say that we have members world wide who can speak a number of different languages so please don&#8217;t let that discourage you from joining and participating. We would LOVE to have you all as part of the group. Also encourage other female developers you know.</p>
<p>If you are a women, a developer, interested in joining and/or contributing to DevChix, please contact Desi McAdam at info(-at-)devchix.com with your:</p>
<p>   1. Name<br />
   2. Email<br />
   3. Do you know any one from DevChix?<br />
   4. A short 2 sentence bio describing your development background/experience (or what you hope to learn) and a link to your blog if you happen to have one.</p>
<p>Obrigado! :) </p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2008/10/16/rails-summit-latin-america/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Multiple object forms, delegation, and has_one…</title>
		<link>http://www.devchix.com/2008/06/03/multiple-object-forms-delegation-and-has_one/</link>
		<comments>http://www.devchix.com/2008/06/03/multiple-object-forms-delegation-and-has_one/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 05:08:29 +0000</pubDate>
		<dc:creator>desi</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Thoughts]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.devchix.com/?p=162</guid>
		<description><![CDATA[I had an ah ha moment that maybe shouldn&#8217;t have been such an ah ha moment but it was so I figured I would share it.  Yeah so I am sure most of us have  had a situation where we needed to have multiple model forms. Most of the time now days I [...]]]></description>
			<content:encoded><![CDATA[<p>I had an ah ha moment that maybe shouldn&#8217;t have been such an ah ha moment but it was so I figured I would share it.  Yeah so I am sure most of us have  had a situation where we needed to have multiple model forms. Most of the time now days I use attribute_fu to solve this issue but attribute_fu doesn&#8217;t work with has_one associations. Today I had a situation where I had two fields that were required for a has_one association object. Long story short it came to me that if we just used the delegate method provided by rails that we could essentially act like the attributes we were setting were on the parent model. This meant we only needed to create one form with multiple fields even though some of those fields were actually on a different model. I then remembered that back when I was working with the guys over at ThoughtWorks that we used a Ruby Extension called Forwardable to be able to delegate multiple attributes on one object.</p>
<p>So instead of this:<br />
<code><br />
delegate :first_name, :to => :profile<br />
delegate :last_name, :to => :profile<br />
delegate :some_other_attribute, :to => :profile<br />
</code></p>
<p>side note: I&#8217;m not sure but I don&#8217;t believe delegate can take multiple attributes (I tried to look this up but for some reason couldn&#8217;t find the documentation for this method and didn&#8217;t have time to dig in the code) </p>
<p>You could do the following:</p>
<p>include the Ruby Extension Forwardable in the parent model class</p>
<p><code><br />
include Forwardable<br />
</code></p>
<p>and then add this line:<br />
<code><br />
def_delegators  :profile, :first_name, :last_name, :some_other_attribute<br />
</code></p>
<p>So yeah that was my little ah ha moment. I am sure there are even better ways than this but this was better than what we were looking at doing to begin with.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2008/06/03/multiple-object-forms-delegation-and-has_one/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rails Conf 2008</title>
		<link>http://www.devchix.com/2008/05/30/rails-conf-2008/</link>
		<comments>http://www.devchix.com/2008/05/30/rails-conf-2008/#comments</comments>
		<pubDate>Fri, 30 May 2008 18:55:18 +0000</pubDate>
		<dc:creator>desi</dc:creator>
		
		<category><![CDATA[Events]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.devchix.com/?p=161</guid>
		<description><![CDATA[Hello Ladies,
I am reporting from RailsConf 2008. The main focus of this post is logistics for the conference. I&#8217;ll be posting about the talks as soon as I get to attend one. I have been running around trying to take care of DevChix related stuff.
We were unable to get an official room for a BoF [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Ladies,<br />
I am reporting from RailsConf 2008. The main focus of this post is logistics for the conference. I&#8217;ll be posting about the talks as soon as I get to attend one. I have been running around trying to take care of DevChix related stuff.</p>
<p>We were unable to get an official room for a BoF but I have decided we will just take over some area of the convention center. Lets meet outside Exhibit Hall E at 7:30 on Saturday night. We can discuss whatever we want to. We are also planning appetizers and cocktails after the BoF. <a href="http://www.hashrocket.com">Hashrocket Inc</a>, the company I work for is sponsoring the evening. Thanks Hashrocket! </p>
<p>Please either come to the BoF for more information or find one of the ladies with a DevChix logo on their badges for more information.  I will also have stickers to give out (until they run out).</p>
<p>We would love to meet ALL the women developers at the conference so please come out and get to know us. </p>
<p>Cheers<br />
Desi</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2008/05/30/rails-conf-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Call Me! A quick how-to for getting dialable phone numbers in your Rails app.</title>
		<link>http://www.devchix.com/2008/01/22/call-me-a-quick-how-to-for-getting-dialable-phone-numbers-in-your-rails-app/</link>
		<comments>http://www.devchix.com/2008/01/22/call-me-a-quick-how-to-for-getting-dialable-phone-numbers-in-your-rails-app/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 17:08:11 +0000</pubDate>
		<dc:creator>desi</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Thoughts]]></category>

		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.devchix.com/2008/01/22/call-me-a-quick-how-to-for-getting-dialable-phone-numbers-in-your-rails-app/</guid>
		<description><![CDATA[This might be something everyone knows but just in case I figured I would post a quick how-to on getting a clickable phone number in your Rails app. This example is only for the iPhone user_agent but you can make it work for other types as well as long as you know the user_agent.
Place the [...]]]></description>
			<content:encoded><![CDATA[<p>This might be something everyone knows but just in case I figured I would post a quick how-to on getting a clickable phone number in your Rails app. This example is only for the iPhone user_agent but you can make it work for other types as well as long as you know the user_agent.</p>
<p>Place the following code snippet in your application.rb file </p>
<pre><code> session :mobile => true, :if => proc { |request| Utility.mobile?(request.user_agent) }

  class Utility

    def self.mobile?(user_agent)
      user_agent =~/(iPhone)/i
    end
  end
</code></pre>
<p>Then in your view or your presenter code put a check for the session variable and if it is set then display the clickable phone number with the tel protocol in the href like so</p>
<pre><code>
"tel:#{contact.phone}"
</code></pre>
<p>and if its not set then just do things normally. Make sure you have the check there because if you don&#8217;t then when someone clicks the link in the browser it will complain about not understanding the tel protocol.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2008/01/22/call-me-a-quick-how-to-for-getting-dialable-phone-numbers-in-your-rails-app/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Programming from the (under)ground up</title>
		<link>http://www.devchix.com/2008/01/05/programming-from-the-underground-up/</link>
		<comments>http://www.devchix.com/2008/01/05/programming-from-the-underground-up/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 01:25:04 +0000</pubDate>
		<dc:creator>lisa</dc:creator>
		
		<category><![CDATA[Apprenticeship]]></category>

		<category><![CDATA[Introductions]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://www.devchix.com/2008/01/05/programming-from-the-underground-up/</guid>
		<description><![CDATA[     Hello. Welcome to my first article.
     And my brand spankin new, made-from-scratch stab at programming. It&#8217;s going to be a bumpy ride: bumpy like fun-old-rollercoaster-bumpy not trainwreck-bumpy (universe willing).
     Please allow me to rattle off some quick background facts so you know [...]]]></description>
			<content:encoded><![CDATA[<p>     Hello. Welcome to my first article.</p>
<p>     And my brand spankin new, made-from-scratch stab at programming. It&#8217;s going to be a bumpy ride: bumpy like fun-old-rollercoaster-bumpy not trainwreck-bumpy (universe willing).</p>
<p>     Please allow me to rattle off some quick background facts so you know what planet I&#8217;m coming from. I&#8217;m a 26 year old retired bartender. I did that for more years than I care to say (ok fine, 8). I fancy myself an amateur artist; basically, I paint for therapy and fun. I&#8217;ve always liked things of a nerdy nature (i.e. writing very basic html in a webshell on angelfire when I was 13, Magic the Gathering, guys who majored in Astrophysics, etc). I consider myself very confident and intelligent, and it&#8217;s a shame that went to waste for so many years. That being said, years of bartending with no substantial plans for the future wore me out and made me feel quite desperate for awhile.</p>
<p>     Then something changed. I got beat down so much by the universe&#8217;s way of telling me to stop f&#8217;ing around, that I got fed up with being fed up. Well, Desi McAdam happens to be one of my favorite people on the planet and a very close friend, and she had always offered to teach me programming&#8230;intensively. She and my other longtime friend/ROR evangelist Obie Fernandez had always told me they thought I&#8217;d be a great programmer. I didn&#8217;t know what they were talking about. So I called up my dear Desi and said &#8220;I&#8217;ll do whatever it takes. Let&#8217;s do this thing.&#8221;</p>
<p>     I thought I was going to be learning in my off time while still bartending and getting tutored whenever Desi was in town. I knew this would take a very, very, very long time, but I felt ready for the challenge.</p>
<p>     As it turned out, she and Obie were down here in Florida on the beach working with this fabulous guy Mark Smith. I had met him some weeks before, and we all had a great time together. They wanted to bring an apprentice on to the small team, so voila! Here I am. I am now in full on training starting with nothing but my instinctual and intellectual abilities and no experience. I am extremely grateful for the opportunity I have, and I intend to give back to Desi and Obie by trying hard to be a bad ass programmer.</p>
<p>     Desi is putting alot of effort into being my personal, full-time tutor, and I think she rocks socks for it.</p>
<p>     So I&#8217;m offering up myself, my victories, and my many future foibles here for your musing and amusement.</p>
<p>     Cheers and enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2008/01/05/programming-from-the-underground-up/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Migrating from Test::Unit to RSpec</title>
		<link>http://www.devchix.com/2008/01/04/migrating-from-testunit-to-rspec/</link>
		<comments>http://www.devchix.com/2008/01/04/migrating-from-testunit-to-rspec/#comments</comments>
		<pubDate>Fri, 04 Jan 2008 17:08:06 +0000</pubDate>
		<dc:creator>jacqui</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Testing]]></category>

		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://www.devchix.com/2008/01/04/migrating-from-testunit-to-rspec/</guid>
		<description><![CDATA[At Streeteasy, nearly half of our tests are still written in Test::Unit, so it&#8217;s hard to see what our actual test coverage is using Rcov.
I read recently that RSpec got support for Test::Unit interoperability. Obviously now is the time to make the switch from Test::Unit to RSpec. You can do it without a mass exodus [...]]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://www.streeteasy.com/">Streeteasy</a>, nearly half of our tests are still written in <a href="http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/index.html">Test::Unit</a>, so it&#8217;s hard to see what our actual test coverage is using <a href="http://eigenclass.org/hiki.rb?rcov">Rcov</a>.</p>
<p>I read recently that <a href="http://www.rubyinside.com/rspec-11-released-now-supports-rails-20-674.html">RSpec got support for Test::Unit interoperability</a>. Obviously now is the time to make the switch from Test::Unit to RSpec. You can do it without a mass exodus from Test::Unit. Use your existing tests inside the RSpec test harness.</p>
<p>So here&#8217;s how I converted all out legacy tests to rspec.</p>
<h1>Step One: update RSpec</h1>
<p>This is fairly self-explanatory and written up <a href="http://rspec.info/upgrade.html">elsewhere</a>. However, in short, I updated both our rspec and rspec_on_rails plugins, remembering to rerun </p>
<p><code>$ ruby script/generate rspec</code></p>
<p>Make a back-up copy of the spec_helper if you&#8217;ve customized it. Compare it to the one generated for the new rspec version to see if there&#8217;s been any significant changes, and if so, merge them into your helper.</p>
<h1>Step Two: move your files from test/ to spec/</h1>
<p>This is what I did: I copied test/unit/* to spec/models/, renaming them appropriately:</p>
<p><code>
<pre>
  ## current_path is a hash where :tu =&gt; test::unit path and :s =&gt; spec path
  def make_tests_specs(current_path)
    current_path[:tu].each do |file|
      unless file == "." or file == ".."
        full_file = File.join(current_path[:tu].path, file)
        if File.directory? full_file
          spec_file = full_file.gsub(/test/, "spec")
          spec_file.gsub!(/unit/, "models")
          spec_file.gsub!(/functional/, "controllers")
          FileUtils.mkdir_p(spec_file) unless File.exists? spec_file
          make_tests_specs({:tu =&gt; Dir.new(full_file), :s =&gt; Dir.new(spec_file)})
        else
          new_spec = File.join(current_path[:s].path, file.gsub(/_test/, "_spec"))
          puts "converting TestCase #{full_file} to ExampleGroup #{new_spec}\n"
          File.copy(full_file, new_spec)
        end
      end
    end
  end
</pre>
<p></code></p>
<h1>Step Three: change your assertions</h1>
<p>While that would move all my tests over to the specs directory and rename them, I figured, why should I stop there? I realized I could probably do a lot of the Test::Unit to RSpec syntax conversions programmatically. Here are the regular expressions I used to do the substitutions - while these worked great for our codebase at StreetEasy, your mileage may vary, so be sure to use caution before running this against your code base (and hey, you do use source control, don&#8217;t you?):</p>
<p><code>
<pre>
if line =~ %r@require.*?test_helper@
  new_file.puts "require '#{RAILS_ROOT}/test/test_helper'"
  new_file.puts "require '#{RAILS_ROOT}/spec/spec_helper'"
elsif line =~ %r@class.*?TestCase@ and line !~ %r@Controller@
  new_file.puts "describe 'transitioning from TestCase to ExampleGroup' do"
elsif line =~ %r@class\s*(.*?)Test@
  new_file.puts "describe #{$1}, 'transitioning from TestCase to ExampleGroup' do"
  new_file.puts "integrate_views"
elsif line =~ %r@def setup@
  new_file.puts "before do"
elsif line =~ %r@def test_(.*?)\n@
  new_file.puts "it \"should #{$1.humanize.downcase}\" do"
elsif line =~ %r@assert_response :success@
  new_file.puts "response.should be_success"
elsif line =~ %r@assert_response :redirect@
  new_file.puts "response.should be_redirect"
elsif line =~ %r@assert_redirected_to (.*?)\n@
  new_file.puts "response.should redirect_to(#{$1})"
elsif line =~ %r@assert_equal (.*?),\s(.*?)\n@
  m1 = $1
  m2 = $2
  unless m1.nil? or m2.nil?
    unless m1.match(/nil/) or m2.match(/nil/)
      new_file.puts "#{m1}.should == #{m2}"
    end
  end
elsif line =~ %r@assert assigns\(:(.*?)\)$@
  new_file.puts "assigns[:#{$1}].should be_true"
else
  unless line =~ /^class.*?Controller.*?rescue_action.*?end$/i or line =~ /require '.*?_controller'/i or line =~ /^#/
    new_file.puts line
  end
end
</pre>
<p></code></p>
<p>The above block of code will convert any response (:success, :redirect, redirect_to), assigns, and equality assertions. It will change your method declarations to &#8220;it &#8217;should&#8230;&#8217; do/end&#8221; block syntax. It will require both the test_helper and spec_helper. It will integrate_views by default on your functional (controller) tests; you might want to go through those by hand later and separate out the front-end stuff into a set of <a href="http://errtheblog.com/posts/66-view-testing-20">view tests</a>, depending on <a href="http://tuples.us/2007/08/17/my-life-with-bdd-and-rspec/">how you</a> <a href="http://rubyforge.org/pipermail/rspec-users/2007-August/002769.html">feel about</a> <a href="http://rspec.info/documentation/rails/writing/views.html">them</a>. </p>
<p>You could definitely write more substitutions - there are more assertions in Test::Unit, of course. If your code base makes extensive use of other assertions you&#8217;ll probably want to add to the regexes above. In our case, however, I found the above satisfied converting the most straight-forward Test::Unit assertions, leaving me with the slightly more complicated examples to convert by hand, which brings me to the next step. </p>
<p>FYI, you can find a table of Test::Unit assertions and their RSpec equivalents <a href="http://rspec.info/documentation/test_unit.html">here on the RSpec documentation site</a>.</p>
<h1>Step Four: run rake:spec and see what happens</h1>
<p>You might as well see what situation any automated conversion process left you in. I had a few errors during this phase - mostly due to the fact that I forgot to move my fixtures, woops - but it didn&#8217;t take me very long to resolve them.</p>
<h1>Step Five: go through each sparkling new spec and convert any remaining Test::Unit-based assertions into RSpec syntax.</h1>
<p>The good news: you can take your time on this step since RSpec now plays nice with Test::Unit. I was in a particularly motivated and productive mood after finding myself with a big directory full of specs (and an amazingly empty test/ directory) so I just went through them all right then and there. It took me most of the afternoon, but when I left work that day I was able to see this, which is just awesome:</p>
<p><code><br />
$ rake spec<br />
........................................................................................................................................................................................................................................................................................................................................................................................................................................................</p>
<p>Finished in 70.023361 seconds</p>
<p>440 examples, 0 failures<br />
</code></p>
<p>As you can see from the amount of time it took all 440 examples to run, we could definitely benefit from a greater use of mocks and stubs in our controller tests. 70 seconds is a tad bit long. That&#8217;s next on the to do list - mock and stub wherever I can in our controller tests, followed by integration/big picture testing using Story Runner, and then, if there&#8217;s time*, refactor our specs to be better organized and efficient - I can think of several places where I had wished for nested examples, or could have used shared examples, had I been aware they existed at the time.</p>
<p>I&#8217;ll be writing up my experience with Story Runner in the next couple of weeks. Til then, though, best of luck in your specs!</p>
<p>* always a compromise when you&#8217;re trying to do things the right way and add business value simultaneously.</p>
<p>For more information Behavior Driven Development, check out <a href="http://dannorth.net/">Dan North</a>&#8217;s article, &#8220;<a href="http://dannorth.net/introducing-bdd">Introducing BDD</a>.&#8221;</p>
<p>You can find the documentation for RSpec at <a href="http://rspec.info/index.html">http://rspec.info</a>.</p>
<p>Many thanks to Joshua Sierles, Paul Marsh, and Josh Knowles for their time in reviewing this!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2008/01/04/migrating-from-testunit-to-rspec/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RubyEast Recap, Slides, and Other Thoughts</title>
		<link>http://www.devchix.com/2007/09/30/rubyeast-recap-slides-and-other-thoughts/</link>
		<comments>http://www.devchix.com/2007/09/30/rubyeast-recap-slides-and-other-thoughts/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 22:25:25 +0000</pubDate>
		<dc:creator>desi</dc:creator>
		
		<category><![CDATA[Apprenticeship]]></category>

		<category><![CDATA[Presentation]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Testing]]></category>

		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://www.devchix.com/2007/09/30/rubyeast-recap-slides-and-other-thoughts/</guid>
		<description><![CDATA[I spoke at RubyEast this past Friday and I think the presentation went pretty well. It was my first presentation in a speaker/audience type setting so I was very nervous. I have presented at Agile 2006 but it was a game (interactive) and was co-presented by several other people. This presentation was the first time [...]]]></description>
			<content:encoded><![CDATA[<p>I spoke at RubyEast this past Friday and I think the presentation went pretty well. It was my first presentation in a speaker/audience type setting so I was very nervous. I have presented at Agile 2006 but it was a game (interactive) and was co-presented by several other people. This presentation was the first time I stood in front of a room full of people and spoke and everything went very well. Like I said I was really nervous but as soon as I got started the nervousness went away. I think I am very lucky because I was able to present to a room full of very nice/cool people and that made the experience a great one. I want to actually thank the people who came to hear me present and who gave me great feedback and encouragement afterwards it really made my day.  If you are interested here are the slides for the presentation. <a href="http://www.devchix.com/wp-content/uploads/2007/09/atourofrailstesting-rspec.pdf">A Tour Of Rails Testing using RSpec</a></p>
<p>I didn&#8217;t get to see many of the sessions because I was busy preparing for my talk but I was able to catch <a href="http://www.jroller.com/obie/entry/obie_s_rubyeast_2007_presentations">Obie&#8217;s presentation - Advanced ActiveRecord</a> which was really good (and I am not just saying that because he is my boyfriend). I also caught the ending Keynote where Nap (I actually don&#8217;t know his real name) announced the Rails Rumble winners. There were several screencasts and it made me wish that Obie, Clay, Nick and I would have had time to get the video that was shot of us over the weekend edited and ready for prime time.  We had a blast doing the competition and while we didn&#8217;t win (we got honorable mention) we learned a lot and I think we all grew closer in those 48 hours. The teams that did win did a tremendous job on their apps and well deserved the loot. Take a look at the winners there really are some great apps. <a href="http://railsrumble.com/2007/9/28/and-the-envelope-please">Rails Rumble Winners</a></p>
<p>Friday evening a bunch of people got together after the conference and played several games of Werewolf which is a really fun game to play. I got to know a lot of people during that game and it was a great way to wind down. </p>
<p>Couple of other thoughts before I end the post. <a href="http://shesgeeky.org/">ShesGeeky (un)Conference</a> sounds like it is going to kick major ass so any of you ladies out there who can attend make sure you get registered. Additionally, ladies if you want to talk during the conference please contact the organizers. </p>
<p>GrrrlCamp seems to be getting a good footing. I was lucky enough to meet THE Gloria this past Friday and I look forward to being a part of GrrlCamp.</p>
<p>I have taken on an apprentice and she will soon be posting to the blog about her experiences. I am in the process of trying to see if creating an apprenticeship type program run by DevChix is possible because after speaking with Sonia (one of the women on DevChix) she helped me figure out that I would really like to have a program that fits the apprenticeship model rather than a mentoring program. Look for more to come on this in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devchix.com/2007/09/30/rubyeast-recap-slides-and-other-thoughts/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
