<?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>42 &#187; web programming</title>
	<atom:link href="http://www.42.mach7x.com/tag/web-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.42.mach7x.com</link>
	<description>Thoughts and tips about programming with Ruby on Rails</description>
	<lastBuildDate>Thu, 09 Sep 2010 09:28:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>File column plugin with ActiveScaffold upload branch</title>
		<link>http://www.42.mach7x.com/2007/10/17/file-column-plugin-with-activescaffold-upload-branch/</link>
		<comments>http://www.42.mach7x.com/2007/10/17/file-column-plugin-with-activescaffold-upload-branch/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 15:29:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web programming]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=4</guid>
		<description><![CDATA[When using the file_column plugin in the active_scaffold upload branch, the documentation in the file_column doesn&#8217;t make it clear what we have to change to make it work. In the example below the model is number and the file_column is intro. 1. In models/number.rb add: file_column :intro 2. in controllers/numbers_controller.rb, make sure we have: config.create.multipart [...]]]></description>
			<content:encoded><![CDATA[<p>When using the file_column plugin in the active_scaffold upload branch, the documentation in the file_column doesn&#8217;t make it clear what we have to change to make it work.</p>
<p>In the example below the model is number and the file_column is intro.</p>
<p>1. In models/number.rb add:</p>
<pre class="code">file_column :intro</pre>
<p>2. in controllers/numbers_controller.rb, make sure we have:</p>
<pre class="code">config.create.multipart = true
config.update.multipart = true</pre>
<p>3. in helpers/numbers_helper.rb add:</p>
<pre class="code">def intro_form_column(record, input name)
  file_column_field 'record', :intro
end

def intro_column(record)
  record.intro ? link_to(File.basename(record.intro),
    url_for_file_column(record,'intro'), :popup =&gt; true) : "-"
end</pre>
<p>4. in views/numbers/_intro_form_column.rhtml add:</p>
<pre class="code"><label>  File to upload</label>
  &lt;%= file_column_field  'record', 'intro' %&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2007/10/17/file-column-plugin-with-activescaffold-upload-branch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get a random record in Ruby on Rails &#8211; MySQL</title>
		<link>http://www.42.mach7x.com/2007/10/17/hello-world/</link>
		<comments>http://www.42.mach7x.com/2007/10/17/hello-world/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 14:22:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[web programming]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=1</guid>
		<description><![CDATA[To get a random record from MySQL in Ruby on Rails use: User.find(:all, rder =&#62; 'rand()')]]></description>
			<content:encoded><![CDATA[<p>To get a random record from MySQL in Ruby on Rails use:</p>
<pre class="code">User.find(:all, <img src='http://www.42.mach7x.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> rder =&gt; 'rand()')</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2007/10/17/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
