<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - How To Create Components]]></title>
		<link>http://railsforum.com/viewtopic.php?id=44422</link>
		<description><![CDATA[The most recent posts in How To Create Components.]]></description>
		<lastBuildDate>Fri, 01 Jul 2011 14:27:09 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: How To Create Components]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=141749#p141749</link>
			<description><![CDATA[<p>Any reason you wouldn&#039;t want to use ApplicationController?&nbsp; You can then call functions contained there from any of your application&#039;s controllers.&nbsp; Or, you could put it into a helper file and then include the helper file in the application controller...and that would also make the helper (and all of its contents) available to all controllers in your application.&nbsp; </p><p>Not sure if either of the above are the most railsey ways but it should get you to where you need to be and is certainly a better option than writing the same code in each of your controllers.</p>]]></description>
			<author><![CDATA[dummy@example.com (imacobrabuilder)]]></author>
			<pubDate>Fri, 01 Jul 2011 14:27:09 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=141749#p141749</guid>
		</item>
		<item>
			<title><![CDATA[Re: How To Create Components]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=141740#p141740</link>
			<description><![CDATA[<p>There are a couple of ways of doing this depending on how you feel<br />The simplest option is to crate a class and put the file in your projects libs folder then just use it as you would any other class</p><p>If you want to share this functionality with others including other apps you may want to use it in then make a gem which sounds far more complicated than it is<br />check out this railscast on how to make a gem <a href="http://railscasts.com/episodes/245-new-gem-with-bundler">http://railscasts.com/episodes/245-new-gem-with-bundler</a> it really is simple to do</p><p>using a module is another way and combining modules with classes is yet another way of namespacing the class so you don&#039;t get conflicts with names</p><p>Modules work much the same as a class. It&#039;s just a place holder to store methods that can then be included wherever you want it&#039;s kind of the equivalent of a java library and can not be created as a class. You can use a module to mix in class methods and instance methods into any other class just by including the file in whatever classes want that functionality. It&#039;s kinda like a neat work around for not having multiple inheritance</p>]]></description>
			<author><![CDATA[dummy@example.com (jamesw)]]></author>
			<pubDate>Fri, 01 Jul 2011 08:43:53 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=141740#p141740</guid>
		</item>
		<item>
			<title><![CDATA[How To Create Components]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=141463#p141463</link>
			<description><![CDATA[<p>Hey, </p><p>I have to say, that I am very new to RoR.</p><p>My question is, how and where to write scripts that can be used from all Controllers.</p><br /><p>For example, I just wrote a little action in a controller, that converts latitude and longtitude into tilepaths of openstreetmaps. My intention is to write my code the DRY way. So, how can I use this little script from all my other controllers? And where can I save it, if I don&#039;t want to have it in the Controllers folder?</p><br /><p>Cheers</p>]]></description>
			<author><![CDATA[dummy@example.com (anachronist)]]></author>
			<pubDate>Thu, 23 Jun 2011 18:55:20 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=141463#p141463</guid>
		</item>
	</channel>
</rss>
