<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in Rails for Java Developers | Pragmatic Forums</title>
    <link>http://forums.pragprog.com/forums/41/posts</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <item>
      <title>Instant Rails version posted by Eric Kinsella @ Tue, 05 Feb 2008 22:16:48 -0000</title>
      <description>&lt;p&gt;Thanks for the 2.0 posts. Cheers!&lt;/p&gt;</description>
      <pubDate>Tue, 05 Feb 2008 22:16:48 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:41:223:2262</guid>
      <author>Eric Kinsella</author>
      <link>http://forums.pragprog.com/forums/41/topics/223</link>
    </item>
    <item>
      <title>Instant Rails version posted by Randy Gordon @ Tue, 29 Jan 2008 16:17:32 -0000</title>
      <description>&lt;p&gt;On page 26, there is a Ruby class definition. This make look a little weird to most Java programmers, but it is mostly a matter of notation&lt;/p&gt;


	&lt;p&gt;Lets go through it line by line.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;class Person &amp;lt; ActiveRecord::Base
  validates_presence_of :first_name, :last_name
end&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Ruby classes are similar to Java classes. the &amp;#8216;&amp;lt;&amp;#8221; is the equivalent of Java&amp;#8217;s extends keyword;  it says that Person subclasses the ActiveRecord::Base class.  Unlike Java, a Ruby subclass inherits every method of it&amp;#8217;s superclass (including initializers, the equivalent of Java constructors, &lt;span class="caps"&gt;YAY&lt;/span&gt;! That is probably the single biggest problem with Java programming.  On the other hand, instance variables are &lt;span class="caps"&gt;NOT&lt;/span&gt; inherited, which takes a bit of getting used to, but makes a lot of sense when you think about it. ).&lt;/p&gt;


	&lt;p&gt;So what the heck is ActiveRecord::Base? Well, ActiveRecord is a module, and here it is acting as a namespace; grouping various ActiveRecord related classes together. (Module can also  be used for multiple inheritance. All classes contained in a module can be included in another class) In this case, the Base class is defined in the \lib\active_record\base.rb file of the ActiveRecord module defined in the Rails gem.&lt;/p&gt;


	&lt;p&gt;validates_presence_of :first_name, :last_name is actually validates_presence_of( :first_name, :last_name), an overridden method of ActiveRecord::Base. Ruby currently allows programmers to leave off parenthesis, so most programmers do. However, for multiple parameters method calls like this one, the next major version of Ruby will require parenthesis. The colon in front of the parameter names indicates that these are symbols, not strings. Symbols differ from strings in that they are not meant to be manipulated.&lt;/p&gt;


	&lt;p&gt;Finally end is a key word used to end a block. In Java, blocks are delineated by {} pairs.&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jan 2008 16:17:32 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:41:223:2239</guid>
      <author>Randy Gordon</author>
      <link>http://forums.pragprog.com/forums/41/topics/223</link>
    </item>
    <item>
      <title>Instant Rails version posted by Randy Gordon @ Tue, 29 Jan 2008 14:34:19 -0000</title>
      <description>&lt;p&gt;Another thing. If you are a Java programmer, you are probably used to working in an Eclipse environment. There are a number of (really bad) Eclipse based &lt;span class="caps"&gt;IDE&lt;/span&gt;&amp;#8217;s out there. I would suggest using Eclipse For Rails. It puts all these commands as external tools, which means you can modify them for Rails 2 as needed. Other than that, it is easy to follow the book (just try to do that with, say, Aptana&amp;#8217;s RadRails plugin.)&lt;/p&gt;


	&lt;p&gt;You can download Eclipse for Rails at &lt;a href="http://www.napcs.com/products/rails/Eclipse/index.htm"&gt;http://www.napcs.com/products/rails/Eclipse/index.htm&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Personally, I don&amp;#8217;t even bother anymore. Unlike with Java, the &lt;span class="caps"&gt;IDE&lt;/span&gt;&amp;#8217;s are not powerful enough to be of real help. (I plan on writing an Eclipse plugin for Rails if I ever get time) I develop under Windows, and I keep the following Windows apps open&lt;/p&gt;


	&lt;p&gt;A command shell in the root directory of the Rails application (for executing rails commands)&lt;/p&gt;


	&lt;p&gt;MySQL Administrator (in case I need to modify or check the database)&lt;/p&gt;


	&lt;p&gt;PsPad editor (for editing files) You can download PSPad from &lt;a href="http://www.pspad.com/en/download.php"&gt;http://www.pspad.com/en/download.php&lt;/a&gt; It is an editor/notepad replacement that is fast and feature complete. Download the cab version, My Avast! virus scanner said the zip and installer versions had a virus.&lt;/p&gt;


	&lt;p&gt;A browser open to &lt;a href="http://www.gotapi.com"&gt;http://www.gotapi.com&lt;/a&gt; (in case I need to look up anything). Since I have a subscription to Safari ( I use &lt;a href="http://safari.oreilly.com/"&gt;http://safari.oreilly.com/&lt;/a&gt;), it allows me access to a large number of good Ruby and Rails books open in  my browser(The Rails Way is a great reference and The Ruby Pocket Reference is very handy &lt;a href="http://safari.oreilly.com/9780596514815"&gt;http://safari.oreilly.com/9780596514815&lt;/a&gt;)&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jan 2008 14:34:19 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:41:223:2234</guid>
      <author>Randy Gordon</author>
      <link>http://forums.pragprog.com/forums/41/topics/223</link>
    </item>
    <item>
      <title>Instant Rails version posted by Randy Gordon @ Tue, 29 Jan 2008 13:40:10 -0000</title>
      <description>&lt;p&gt;Not for Newbies. Especially ones that have shelled out money for a book whose target audience are newbies.&lt;/p&gt;


	&lt;p&gt;Here is the proper code for rails 2.02  for page 23 of Chapter 1 (I will add more replies as I go through the book.)&lt;/p&gt;


	&lt;p&gt;First of all, when you generate an application, if now defaults to sqllite. If you want mysql, you have to use the command:&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;rails {application_name} -d mysql&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;and then, when you want to generate a scaffold (a complete &lt;span class="caps"&gt;MVC&lt;/span&gt; set of files) you need to generate the model with it.&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;ruby script\generate scaffold {mode_name} {database_column_name}:{database_column_type}&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;For example, from Rails for Java Programmers, you can generate the People app in one line&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;ruby script\generate scaffold Person first_name:string last_name:string&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;Then you need to create the database (explained in the book) and then migrate the database schema into the latest version of the model (if you have a password on MySQL&amp;#8217;s root, be sure to add it to config\database.yml) &lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;rake db:migrate&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;and then just run&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;ruby script\server&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;to get a complete, if simplistic database backed web app.&lt;/p&gt;</description>
      <pubDate>Tue, 29 Jan 2008 13:40:10 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:41:223:2233</guid>
      <author>Randy Gordon</author>
      <link>http://forums.pragprog.com/forums/41/topics/223</link>
    </item>
    <item>
      <title>Instant Rails version posted by Eric Kinsella @ Thu, 17 Jan 2008 22:42:18 -0000</title>
      <description>&lt;p&gt;If your following along with the book and doing the examples, on Windows, choose Instant Rails 1.7. If you choose 2.0 you&amp;#8217;ll run into a few snags but debugging and researching a new language can be fun too, right?&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyforge.org/frs/?group_id=904"&gt;http://rubyforge.org/frs/?group_id=904&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Our book club is just hitting Chapter 4 at this point. So far so good.&lt;/p&gt;</description>
      <pubDate>Thu, 17 Jan 2008 22:42:18 -0000</pubDate>
      <guid isPermaLink="false">forums.pragprog.com:41:223:2184</guid>
      <author>Eric Kinsella</author>
      <link>http://forums.pragprog.com/forums/41/topics/223</link>
    </item>
  </channel>
</rss>
