Saturday, December 29, 2007

Announcements : Instant Rails 2.0 Released on 28th December 2007

Rob Bazinet has announced on 28/12/07 the release of Instant Rails 2.0. This is his first release after taking over the project for Curt Hibbs.

This release is part of bringing the environment up-to-date, no earth shattering changes but the following is updated:
- Ruby 1.8.6 Patch Level 111 with tons of bug fixes and new updated gems
- Ruby on Rails 2.0.2
- RubyGems 1.0.1
- Rake 0.8.0
- Mongrel 1.1.2
- SQLite3

Instant Rails 2.0 can be downloaded from RubyForge now<http://rubyforge.org/frs/?group_id=904>

For the Release Notes, go to <http://instantrails.rubyforge.org/wiki/wiki.pl?Release_Notes_For_Instant_Rails_2.0>to see all the updates.

Questions should be submitted to the Instant Rails list <http://rubyforge.org/mail/?group_id=904>


-Rob Bazinet http://www.accidentaltechnologist.com/

Wednesday, December 19, 2007

Announcements : Rails 2.0.2 Released on 17 December 2007

Quoted Verbatim from DHH

Now that we have the big Rails 2.0 release out the door, it’s a lot easier to push out smaller updates more frequently. So that’s what we’re going to do. Rails 2.0.2 contains a bunch of smaller fixes to various bugs, no show-stopping action, just further polish. But it also contains a few new defaults.

SQLite3 is the new default database

Most importantly is SQLite3 as the new database we’ll configure for by default when you run the rails generation command without any specification. This change comes as SQLite3 is simply an easier out of the box experience than MySQL. There’s no fussing with GRANTs and creates, the database is just there. This is especially so under OS X 10.5 Leopard, which ships with SQLite3 and the driver gems preinstalled as part of the development kit.

If you want to preconfigure your database for MySQL (or any of the other adapters), you simply do “rails -d mysql myapp” and everything is the same as before. But if you’re just playing with a new application or building a smallish internal tool, then I strongly recommend having a look at SQLite3. Thanks to the agnostic db/schema.rb, it’s as easy as changing your config/database.yml to switch from SQLite3 to MySQL (or another database) as soon as your load warrants it.

Don’t check for template changes in production mode

New applications will be generated with the following option in their config/environments/production.rb:

config.action_view.cache_template_loading = trueThis will stop Rails from constantly doing STAT calls to the file system to check if the file has changed. This can make for a lot of I/O activity, especially if you have lots of partials. If you have very fast disks, this may not matter, but if you’re running off slower disks it can make quite a big difference.

The drawback is that you can no longer just svnup a single template file and see it changed immediately. You’ll have to restart the application servers to make that happen.

Regardless, we feel that this is the better default in a partial-heavy world, but you’re of course always free to change it.

Rails 2.0.2 is a drop-in replacement for Rails 2.0

To upgrade, just do “gem install rails” (if the gems are still not propagated, use—source http://gems.rubyonrails.org) or use the new rel_2-0-2 tag.

The rest of the changes are as follows:

Action Pack

Added delete_via_redirect and put_via_redirect to integration testing #10497 [philodespotos]

Allow headers[‘Accept’] to be set by hand when calling xml_http_request #10461 [BMorearty]

Added OPTIONS to list of default accepted HTTP methods #10449 [holoway]

Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [chuyeow]. Example:
ActionController::Base.asset_host = Proc.new { source if source.starts_with?(’/images’) “http://images.example.com” else “http://assets.example.com” end }

Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink]

Added that Array#to_param calls to_param on all it’s elements #10473 [brandon]

Ensure asset cache directories are automatically created. #10337 [Josh Peek, Cheah Chu Yeow]

render :xml and :json preserve custom content types. #10388 [jmettraux, Cheah Chu Yeow]

Refactor Action View template handlers. #10437, #10455 [Josh Peek]

Fix DoubleRenderError message and leave out mention of returning false from filters. Closes #10380 [Frederick Cheung]

Clean up some cruft around ActionController::Base#head. Closes #10417 [ssoroka]

Active Record

Ensure optimistic locking handles nil #lock_version values properly. Closes #10510 [rick]

Make the Fixtures Test::Unit enhancements more supporting for double-loaded test cases. Closes #10379 [brynary]

Fix that validates_acceptance_of still works for non-existent tables (useful for bootstrapping new databases). Closes #10474 [hasmanyjosh]

Ensure that the :uniq option for has_many :through associations retains the order. #10463 [remvee]

Base.exists? doesn’t rescue exceptions to avoid hiding SQL errors. #10458 [Michael Klishin]

Documentation: Active Record exceptions, destroy_all and delete_all. #10444, #10447 [Michael Klishin]

Active Resource

Added more specific exceptions for 400, 401, and 403 (all descending from ClientError so existing rescues will work) #10326 [trek]

Correct empty response handling. #10445 [seangeo]

Active Support

Ruby 1.9 compatibility. #1689, #10466, #10468 [Cheah Chu Yeow, Pratik Naik, Jeremy Kemper]

TimeZone#to_s uses UTC rather than GMT. #1689 [Cheah Chu Yeow]

Refactor of Hash#symbolize_keys! to use Hash#replace. Closes #10420 [ReinH]

Fix HashWithIndifferentAccess#to_options! so it doesn’t clear the options hash. Closes #10419 [ReinH]

Rails

Changed the default database from mysql to sqlite3, so now running “rails myapp” will have a config/database.yml that’s setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run “rails -d mysql myapp” [DHH]

Turned on ActionView::Base.cache_template_loading by default in config/environments/production.rb to prevent file system stat calls for every template loading to see if it changed (this means that you have to restart the application to see template changes in production mode) [DHH]

Introduce `rake secret` to output a crytographically secure secret key for use with cookie sessions #10363 [revans]

Fixed that local database creation should consider 127.0.0.1 local #9026 [parcelbrat]

Fixed that functional tests generated for scaffolds should use fixture calls instead of hard-coded IDs #10435 [boone]

Added db:migrate:redo and db:migrate:reset for rerunning existing migrations #10431, #10432 [matt]

RAILS_GEM_VERSION may be double-quoted also. #10443 [James Cox]

Update rails:freeze:gems to work with RubyGems 0.9.5. [Jeremy Kemper]

Sunday, December 9, 2007

Announcements : Rails 2.0.1 has been released on 7th December 2007

As quoted by DHH verbatim, Rails 2.0 is finally finished after about a year in the making. This is a fantastic release that’s absolutely stuffed with great new features, loads of fixes, and an incredible amount of polish. We’ve even taken a fair bit of cruft out to make the whole package more coherent and lean.

What’s new ?

Action Pack: Resources
This is where the bulk of the action for 2.0 has gone. We’ve got a slew of improvements to the RESTful lifestyle. First, we’ve dropped the semicolon for custom methods instead of the regular slash. So /people/1;edit is now /people/1/edit.

We’ve also added the namespace feature to routing resources that makes it really easy to confine things like admin interfaces:map.namespace(:admin) do admin
admin.resources :products,
:collection => { :inventory => :get },
:member => { :duplicate => :post },
:has_many => [ :tags, :images, :variants ]
end

Which will give you named routes like inventory_admin_products_url and admin_product_tags_url.

To keep track of this named routes proliferation, we’ve added the “rake routes” task, which will list all the named routes created by routes.rb.

We’ve also instigated a new convention that all resource-based controllers will be plural by default. This allows a single resource to be mapped in multiple contexts and still refer to the same controller. Example:
# /avatars/45 => AvatarsController#show
map.resources :avatars
# /people/5/avatar => AvatarsController#show
map.resources :people, :has_one => :avatar

Action Pack: Multiview
Alongside the improvements for resources come improvements for multiview.

We already have #respond_to, but we’ve taken it a step further and made it dig into the templates. We’ve separated the format of the template from its rendering engine.

So show.rhtml now becomes show.html.erb, which is the template that’ll be rendered by default for a show action that has declared format.html in its respond_to. And you can now have something like show.csv.erb, which targets text/csv, but also uses the default ERB renderer.

So the new format for templates is action.format.renderer. A few examples:
show.erb: same show template for all formats
index.atom.builder: uses the Builder format, previously known as rxml, to render an index action for the application/atom+xml mime type
edit.iphone.haml: uses the custom HAML template engine (not included by default) to render an edit action for the custom Mime::IPHONE format

Speaking of the iPhone, we’ve made it easier to declare “fake” types that are only used for internal routing. Like when you want a special HTML interface just for an iPhone. All it takes is something like this:
# should go in config/initializers/mime_types.rb
Mime.register_alias "text/html", :iphone
class ApplicationController < format =" :iphone">

Action Pack: Record identification
Piggy-backing off the new drive for resources are a number of simplifications for controller and view methods that deal with URLs.

We’ve added a number of conventions for turning model classes into resource routes on the fly. Examples:
# person is a Person object, which by convention will
# be mapped to person_url for lookup
redirect_to(person)
link_to(person.name, person)
form_for(person)

Action Pack: HTTP Loving
As you might have gathered, Action Pack in Rails 2.0 is all about getting closer with HTTP and all its glory. Resources, multiple representations, but there’s more.

We’ve added a new module to work with HTTP Basic Authentication, which turns out to be a great way to do API authentication over SSL. It’s terribly simple to use. Here’s an example (there are more in ActionController::HttpAuthentication):
class PostsController < password = "dhh" except =""> [ :index ]
def index
render :text => "Everyone can see me!"
end
def edit
render :text => "I'm only accessible if you know the password"
end
private

def authenticate
authenticate_or_request_with_http_basic do user_name, password
user_name == USER_NAME && password == PASSWORD
end
end
end

We’ve also made it much easier to structure your JavaScript and stylesheet files in logical units without getting clobbered by the HTTP overhead of requesting a bazillion files. Using javascript_include_tag(:all, :cache => true) will turn public/javascripts/.js into a single public/javascripts/all.js file in production, while still keeping the files separate in development, so you can work iteratively without clearing the cache.

Along the same lines, we’ve added the option to cheat browsers who don’t feel like pipelining requests on their own. If you set ActionController::Base.asset_host = “assets%d.example.com”, we’ll automatically distribute your asset calls (like image_tag) to asset1 through asset4. That allows the browser to open many more connections at a time and increases the perceived speed of your application.

Action Pack: Security
Making it even easier to create secure applications out of the box is always a pleasure and with Rails 2.0 we’re doing it from a number of fronts. Most importantly, we now ship we a built-in mechanism for dealing with CRSF attacks.

By including a special token in all forms and Ajax requests, you can guard from having requests made from outside of your application. All this is turned on by default in new Rails 2.0 applications and you can very easily turn it on in your existing applications using ActionController::Base.protect_from_forgery (see ActionController::RequestForgeryProtection for more).

We’ve also made it easier to deal with XSS attacks while still allowing users to embed HTML in your pages. The old TextHelper#sanitize method has gone from a black list (very hard to keep secure) approach to a white list approach. If you’re already using sanitize, you’ll automatically be granted better protection. You can tweak the tags that are allowed by default with sanitize as well. See TextHelper#sanitize for details.

Finally, we’ve added support for HTTP only cookies. They are not yet supported by all browsers, but you can use them where they are.

Action Pack: Exception handling
Lots of common exceptions would do better to be rescued at a shared level rather than per action. This has always been possible by overwriting rescue_action_in_public, but then you had to roll out your own case statement and call super. Bah. So now we have a class level macro called rescue_from, which you can use to declaratively point certain exceptions to a given action.

Example:
class PostsController < with =""> :deny_access
protected
def deny_access
...
end
end

Action Pack: Cookie store sessions
The default session store in Rails 2.0 is now a cookie-based one.

That means sessions are no longer stored on the file system or in the database, but kept by the client in a hashed form that can’t be forged. This makes it not only a lot faster than traditional session stores, but also makes it zero maintenance. There’s no cron job needed to clear out the sessions and your server won’t crash because you forgot and suddenly had 500K files in tmp/session.

This setup works great if you follow best practices and keep session usage to a minimum, such as the common case of just storing a user_id and a the flash. If, however, you are planning on storing the nuclear launch codes in the session, the default cookie store is a bad deal. While they can’t be forged (so is_admin = true is fine), their content can be seen. If that’s a problem for your application, you can always just switch back to one of the traditional session stores (but first investigate that requirement as a code smell).

Action Pack: New request profiler
Figuring out where your bottlenecks are with real usage can be tough, but we just made it a whole lot easier with the new request profiler that can follow an entire usage script and report on the aggregate findings. You use it like this:
$ cat login_session.rb
get_with_redirect '/'
say "GET / => #{path}"
post_with_redirect '/sessions', :username => 'john', :password => 'doe'
say "POST /sessions => #{path}"
$ ./script/performance/request -n 10 login_session.rb
And you get a thorough breakdown in HTML and text on where time was spent and you’ll have a good idea on where to look for speeding up the application.

Action Pack: Miscellaneous
Also of note is AtomFeedHelper, which makes it even simpler to create Atom feeds using an enhanced Builder syntax. Simple example:
# index.atom.builder:
atom_feed do feed
feed.title("My great blog!")
feed.updated((@posts.first.created_at))
for post in @posts
feed.entry(post) do entry
entry.title(post.title)
entry.content(post.body, :type => 'html')
entry.author do author
author.name("DHH")
end
end
end
end

We’ve made a number of performance improvements, so asset tag calls are now much cheaper and we’re caching simple named routes, making them much faster too.

Finally, we’ve kicked out in_place_editor and autocomplete_for into plugins that live on the official Rails SVN.

Active Record: Performance
Active Record has seen a gazillion fixes and small tweaks, but it’s somewhat light on big new features.

Something new that we have added, though, is a very simple Query Cache, which will recognize similar SQL calls from within the same request and return the cached result. This is especially nice for N+1 situations that might be hard to handle with :include or other mechanisms. We’ve also drastically improved the performance of fixtures, which makes most test suites based on normal fixture use be 50-100% faster.

Active Record: Sexy migrations
There’s a new alternative format for declaring migrations in a slightly more efficient format.

Before you’d write:
create_table :people do t
t.column, "account_id", :integer
t.column, "first_name", :string, :null => false
t.column, "last_name", :string, :null => false
t.column, "description", :text
t.column, "created_at", :datetime
t.column, "updated_at", :datetime
end

Now you can write:
create_table :people do t
t.integer :account_id
t.string :first_name, :last_name, :null => false
t.text :description
t.timestamps
end

Active Record: Foxy fixtures
The fixtures in Active Record has taken a fair amount of flak lately. One of the key points in that criticism has been the work with declaring dependencies between fixtures. Having to relate fixtures through the ids of their primary keys is no fun. That’s been addressed now and you can write fixtures like this:
# sellers.yml
shopify:
name: Shopify
# products.yml
pimp_cup:
seller: shopify
name: Pimp cup

As you can see, it’s no longer necessary to declare the ids of the fixtures and instead of using seller_id to refer to the relationship, you just use seller and the name of the fixture.

Active Record: XML in, JSON out
Active Record has supported serialization to XML for a while. In 2.0 we’ve added deserialization too, so you can say Person.new.from_xml(“David“) and get what you’d expect. We’ve also added serialization to JSON, which supports the same syntax as XML serialization (including nested associations). Just do person.to_json and you’re ready to roll.

Active Record: Shedding some weight
To make Active Record a little leaner and meaner, we’ve removed the acts_as_XYZ features and put them into individual plugins on the Rails SVN repository. So say you’re using acts_as_list, you just need to do ./script/plugin install acts_as_list and everything will move along like nothing ever happened.

A little more drastic, we’ve also pushed all the commercial database adapters into their own gems. So Rails now only ships with adapters for MySQL, SQLite, and PostgreSQL. These are the databases that we have easy and willing access to test on. But that doesn’t mean the commercial databases are left out in the cold. Rather, they’ve now been set free to have an independent release schedule from the main Rails distribution. And that’s probably a good thing as the commercial databases tend to require a lot more exceptions and hoop jumping on a regular basis to work well.

The commercial database adapters now live in gems that all follow the same naming convention: activerecord-XYZ-adapter. So if you gem install activerecord-oracle-adapter, you’ll instantly have Oracle available as an adapter choice in all the Rails applications on that machine. You won’t have to change a single line in your applications to take use of it.
That also means it’ll be easier for new database adapters to gain traction in the Rails world. As long as you package your adapter according to the published conventions, users just have to install the gem and they’re ready to roll.

Active Record: with_scope with a dash of syntactic vinegar
ActiveRecord::Base.with_scope has gone protected to discourage people from misusing it in controllers (especially in filters). Instead, it’s now encouraged that you only use it within the model itself. That’s what it was designed for and where it logically remains a good fit. But of course, this is all about encouraging and discouraging. If you’ve weighed the pros and the cons and still want to use with_scope outside of the model, you can always call it through .send(:with_scope).

ActionWebService out, ActiveResource in
It’ll probably come as no surprise that Rails has picked a side in the SOAP vs REST debate. Unless you absolutely have to use SOAP for integration purposes, we strongly discourage you from doing so. As a naturally extension of that, we’ve pulled ActionWebService from the default bundle. It’s only a gem install actionwebservice away, but it sends an important message none the less.

At the same time, we’ve pulled the new ActiveResource framework out of beta and into the default bundle. ActiveResource is like ActiveRecord, but for resources. It follows a similar API and is configured to Just Work with Rails applications using the resource-driven approach. For example, a vanilla scaffold will be accessible by ActiveResource.

ActiveSupport
There’s not all that much new in ActiveSupport. We’ve a host of new methods like Array#rand for getting a random element from an array, Hash#except to filter down a hash from undesired keys and lots of extensions for Date. We also made testing a little nicer with assert_difference. Short of that, it’s pretty much just fixes and tweaks.

Action Mailer
This is a very modest update for Action Mailer. Besides a handful of bug fixes, we’ve added the option to register alternative template engines and assert_emails to the testing suite, which works like this:
Assert number of emails delivered within a block: assert_emails 1 do post :signup, :name => ‘Jonathan’ end

Rails: The debugger is back
To tie it all together, we have a stream of improvements for Rails in general. My favorite amongst these is the return of the breakpoint in form of the debugger. It’s a real debugger too, not just an IRB dump. You can step back and forth, list your current position, and much more. It’s all coming from the gracious note of the ruby-debug gem. So you’ll have to install that for the new debugger to work.

To use the debugger, you just install the gem, put “debugger” somewhere in your application, and then start the server with—debugger or -u. When the code executes the debugger command, you’ll have it available straight in the terminal running the server. No need for script/breakpointer or anything else. You can use the debugger in your tests too.

Rails: Clean up your environment
Before Rails 2.0, config/environment.rb files every where would be clogged with all sorts of one-off configuration details.

Now you can gather those elements in self-contained files and put them under config/initializers and they’ll automatically be loaded. New Rails 2.0 applications ship with two examples in form of inflections.rb (for your own pluralization rules) and mime_types.rb (for your own mime types). This should ensure that you need to keep nothing but the default in config/environment.rb.

Rails: Easier plugin order
Now that we’ve yanked out a fair amount of stuff from Rails and into plugins, you might well have other plugins that depend on this functionality. This can require that you load, say, acts_as_list before your own acts_as_extra_cool_list plugin in order for the latter to extend the former.

Before, this required that you named all your plugins in config.plugins. Major hassle when all you wanted to say was “I only care about acts_as_list being loaded before everything else”. Now you can do exactly that with config.plugins = [ :acts_as_list, :all ].
And hundreds upon hundreds of other improvements

What I’ve talked about above is but a tiny sliver of the full 2.0 package. We’ve got literally hundreds of bug fixes, tweaks, and feature enhancements crammed into Rails 2.0. All this coming off the work of tons of eager contributors working tirelessly to improve the framework in small, but important ways.
I encourage you to scourger the CHANGELOGs and learn more about all that changed.

So how do I upgrade?
If you want to move your application to Rails 2.0, you should first move it to Rails 1.2.6. That’ll include deprecation warnings for most everything we yanked out in 2.0. So if your application runs fine on 1.2.6 with no deprecation warnings, there’s a good chance that it’ll run straight up on 2.0. Of course, if you’re using, say, pagination, you’ll need to install the classic_pagination plugin. If you’re using Oracle, you’ll need to install the activerecord-oracle-adapter gem. And so on and so forth for all the extractions.

So how do I install?
To install through gems, do:gem install rails -y
...if you’re having trouble with that (gem not found), just grab gems from our own repository in the meanwhile:gem install rails -y --source http://gems.rubyonrails.org/

To try it from an SVN tag, use (you may need to run this command twice depending on your current Rails version):rake rails:freeze:edge TAG=rel_2-0-1

Note: It’s 2.0.1 because we found a small issue just after we pushed 2.0.0.

Sunday, November 25, 2007

Announcements : Rails 1.2.6: Security and Maintenance Release

Ruby on Rails 1.2.6: Security and Maintenance Release has been released on November 24, 2007 by the rails core team to address a bug in the fix for session fixation attacks (CVE-2007-5380). The CVE Identifier for this new issue is CVE-2007-6077.

You should upgrade to this new release if you do not take specific session-fixation counter measures in your application. 1.2.6 also fixes some regressions when working with has_many associations on unsaved ActiveRecord objects.

As with other 1.2.x releases, this is intended as a drop in upgrade for users of earlier versions in the 1.2 series.

To upgrade, `gem install rails`, set RAILS_GEM_VERSION to ‘1.2.6’ in config/environment.rb, and `rake rails:update:configs`.

Sunday, November 18, 2007

Announcements : Aptana Radrails 0.9.1 Final Release

For Radrails users, there is happy news !

Aptana RadRails 0.9.1 Final Release has been released since 15th November 2007. Users who are still on 0.8.0 are highly recommended to upgrade.

Here's the Trac changelog: http://www.aptana.com/trac/milestone/RadRails%20IDE%200.9.1 And the ASAP one: http://support.aptana.com/issues/browse/ROR/fixforversion/10004

Saturday, November 10, 2007

Announcements : Rails 2.0 Release Candidate 1

Looks as if Rails 2.0 will be released soon if this post by DHH (creator of Rails) today at the Ruby on Rails : Talk Google Group is any indication :-

We're almost there. Really this time.
http://weblog.rubyonrails.org/2007/11/9/rails-2-0-release-candidate-1

BTW, the basic advice is to upgrade to 1.2.5 and get rid of all deprecation warnings.

Saturday, November 3, 2007

Advanced Rails : Testing a Ruby on Rails Application [Updated 30th August 2009]

Thanks to DHH and his team, Rails guides you to create a well-tested application by actively generating default test cases and setting up scripts and tools to run 3 different kinds of tests namely, unit testing, functional testing and integration testing.

For example, when you use script/generate to create your models and controllers, Rails also generates skeletal test files for you to flesh out with tests for your apps.

1) Unit Testing deals with tests on models.
2) Controllers are tested via Functional Testing
3) Integration Testing focuses on the testing of the interation between controllers

Rails has a number of features that make it easy to test your application. In particular, Rails uses a separate runtime database dedicated to testing and can automatically populate the test database with fresh sample data (that you provide) before each test.

This is how you execute the tests :-

a) Test all units and functionals
rake test

b) Run tests for functionals
rake test:functionals

c) Run tests for integration
rake test:integration

d) Run tests for units
rake test:units

Testing within Aptana RadRails
1) Select the Rails Project that is to be tested
2) Click the Tests Icon on the ToolBar Nb. Y0u have a choice to select All Tests, Unit Tests, Functional Tests and Integration Tests
3) If you select Unit Tests, you should see a dialog window showing progress with an option to run in the background.


4) On competion of the test, you should see the following result :-


Available assertions for rake test:units

assert_kind_of Class, @var # same class
assert @var # not nil
assert_equal 1, @p.id # equality

@product.destroy
assert_raise(ActiveRecord::RecordNotFound) { Customer.find( @customer.id ) }

Available assertions for rake test:functional

a) Requests

get :action # a get request of the specificed action

get :action, :id => 1,
{ session_hash }, # optional session variables
{ flash_hash } # optional messages in the flash
post :action, :foo => { :value1 => 'abc', :value2 => '123' },
{ :user_id => 17 },
{ :message => 'success' }
get, post, put, delete, head
assert_response :success

# possible parameters are:
# :success
# :redirect
# :missing
# :error


b) Redirects
assert_redirected_to :action => :other_action
assert_redirected_to :controller => 'foo', :action => 'bar'
assert_redirected_to http://crm4web.com.my/

c) Rendered with Template
assert_template "post/index"

d) Variable Assignments
assert_nil assigns(:some_variable)
assert_not_nil assigns(:some_variable)
assert_equal 11, assigns(:posts).size

e) Rendering of Specific Tags
assert_tag :tag => 'body'
assert_tag :content => 'Rails Plugins'
assert_tag :tag => 'div', :attributes => { :class => 'index_list' }
assert_tag :tag => 'head', :parent => { :tag => 'body' }
assert_tag :tag => 'html', :child => { :tag => 'head' }
assert_tag :tag => 'body', :descendant => { :tag => 'div' }
assert_tag :tag => 'ul',
:children => { :count => 1..3,
:only => { :tag => 'li' } }





More to come...

Wednesday, October 31, 2007

Rails Basics : Useful Helpers

In developing the e-CRM, I have found the following helper methods very useful :-

a) Hardcoded select list

def severity_form_column (record, name)
select_tag name, options_for_select(%w(Show-stopper Severe Nice-to-have Customisation Trivial), record.severity)
end

b) TextArea for edit/create

def blog_form_column(record, input_name) text_area_tag('record[blog]', @record.blog, :size=>"80x30")
end

c) checkbox for edit/create

def active_form_column(record, input_name)
check_box :record, :active, :name => input_name
end

e) checkbox for list
def active_column(record)
check_box_tag 'active', 1, record.active?, { :disabled => true }
end

f) date display for list
def bill_date_column(record)
if record.bill_date.nil?
record.bill_date= '-' #''&nbsp'
else
record.bill_date.strftime("%d/%m/%y")
end
end

g) Customising Rails date format

def mydate_form_column(record, input_name)
date_select(:record, :mydate :order =>
[:day, :month, :year], :start_year => 1970, :end_year => 2000)
end

h) Controlling Text Field Size

def name_form_column(record, input_name)
text_field_tag('record[name]', @record.name, { :autocomplete => "off", :size => 40, :class => 'text-input'})
end

Sunday, October 28, 2007

Advanced Rails : Why you should not use Global Variables ! [Updated 12th Sept 2009]

What are global variables in Ruby ?

A global variable has a name beginning with $. It can be referred to from anywhere in a program. Before initialization, a global variable has the special value nil.

Global variables should be used sparingly. They are dangerous because they can be written to from anywhere. Overuse of globals can make isolating bugs difficult; it also tends to indicate that the design of a program has not been carefully thought out. Whenever you do find it necessary to use a global variable, be sure to give it a descriptive name that is unlikely to be inadvertently used for something else later (calling it something like $foo as above is probably a bad idea).

When a global variable has been rigged to work as a trigger to invoke a procedure whenever changed, we sometimes call it an active variable. For instance, it is useful for keeping a GUI display up to date.

There is a collection of special variables whose names consist of a dollar sign ($) followed by a single character. For example, $$ contains the process id of the ruby interpreter, and is read-only. Here are the major system variables and their meanings (see the ruby reference manual for details):

$! latest error message
$@ location of error
$_ string last read by gets
$. line number last read by interpreter
$& string last matched by regexp
$~ the last regexp match, as an array of subexpressions
$n the nth subexpression in the last match (same as $~[n])
$= case-insensitivity flag
$/ input record separator
$\ output record separator
$0 the name of the ruby script file
$* the command line arguments
$$ interpreter's process ID
$? exit status of last executed child process

In the above, $_ and $~ have local scope. Their names suggest they should be global, but they are much more useful this way, and there are historical reasons for using these names.

Why you should not not use Global Variables

Let us assume that on login (say using Acts As Authenticated), you may be tempted to initialise say $is_admin = current_user.isadmin and then use $is_admin to control access to modules or whatever. This will work very nicely in development mode or even production mode under say Apache 2.x + 1 mongrel process.

However, once you use Apache 2.2x + a pack of mongrel processes, your security measure will fail miserably ! Why ?

Prior to using Apache+a pack of mongrels, I was succesfully using a home-made role-based authentication in conjunction with AAA.

What I did basically was to add roles in users (AAA table) via adding fields (such as is_admin, is_marketing, is_finance etc). The result is that a user can can have one or many roles.
With this concept, I could control access to modules using layouts and within each controller or model I can control access to specific actions.


1. Control access to specific actions via controller.

EXAMPLE in customers_controller.rb
layout 'customers'
active_scaffold :customer do config

if User.current_user.is_admin
config.nested.add_link("Receivables", [:receivables])
end

2. Control access to specific actions via model

has_many :receivables

def authorized_for_update?
current_user.is_finance
end

def authorized_for_destroy?
current_user.is_admin
end


Using 1-3 works perfectly on Apache+1 mongrel on a Windows 2003. But once I activate Apache + 2 or mongrels, the whole security system got thrashed !


Response from Jan (Mongrel FAQ)

Globals are not shared across different instance of mongrel. To have a global appear in all instances you need some form of permanent storage (filesystem or database). If it doesn't need to change over the lifetime of the program you can pass in the global at startup in an environment variable.

You would not want to use a global in this case, since it needs to change after start up and the other mogrels would not be aware of the change. Use permanent storage. File system, database, or perhaps even a cookie

Response from Luis (author of mongrel windows service)

As Jan pointed, global variables aren't shared across processes.
You need rely your authorization schema in something else instead a global variable, since 2 users could hit the same mongrel instance and both get great as admin.
You need to investigate further about authorization schemas and how session is handled (and could be used for your purpose).

First you need to move your session storage to ActiveRecord or cookie based (in case of 1.2.5 or edge). Then I suggest you take a look at the following plugins for Authentication:

RESTful Authentication:
http://railsify.com/plugins/3-restful-authentication

Acts as Authenticated:
http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated

Later you will need some role management (to handle is_admin?) Take a look at the suggestion and the "Elsewhere" part from the Acts as Authenticated stikipad page.



My solution was to use the role_requirement plugin by Tim Harper.

This link is also relevant to our discussion here.

Saturday, October 27, 2007

Rails Basics : All about Validations

Irrespective of languages, frameworks and platforms, one cannot run away from providing validations to data input. How does Ruby on Rails do it ?

To be precise, Active Record, an integral part of RoR, provides validation support as follows :-

a) validates_acceptance_of(attribute, :message => "message", :accept => "1")
b) validates_confirmation_of(attribute, :message => "message")

c) validates_exclusion_of(attribute, :in => enumerable_object, :message => "message")
d) validates_inclusion_of(attribute, :in => enumerable_object, :message => "message")

e) validates_length_of(attribute, :maximum => max, :allow_nil => true, :message => "message")

f) validates_length_of(attribute, :minimum => min, :message => "message")
g) validates_length_of(attribute, :in => range, :message => "message")

h) validates_numericality_of(value, :message => "message")

i) validates_presence_of(attributes, :message => "message")

j) validates_size_of(attribute, :maximum => max, :message => "message")
k) validates_size_of(attribute, :minimum => min, :message => "message")
l) validates_size_of(attribute, :in => range, :message => "message")

m) validates_uniqueness_of(attributes, :message => "message", :scope => "condition")
n) validates_uniqueness_of(attributes, :message => "message", :scope => "condition")

Saturday, October 20, 2007

Rails Basics : I am a newbie, what should I read ?

Just like thousands of experienced programmers who have flocked to Ruby after seeing the incredible demo on how easy it was to create a Ruby on Rails Applications, I started on RoR and after a short while, I hit a road block :-(

What did I do next ?

Consistent with I did when I started by programming career via Clipper, I went to my favourite bookshop and bought all the Rails and Ruby Books available.

What I bought include :-

  1. Dummies Guide to Ruby and Rails
  2. Rails Cookbook
  3. Ruby Cookbook
  4. Rails Solution
  5. Agile Web Development with Rails
  6. Ruby on Rails : Up and Running
  7. Rails Recipes
  8. The Ruby Way : 2nd Edition
  9. Active Record

Updated on 30th August 2009
    Programming Ruby
    The Rails Way
    Rails Space
    Rails for .NET Developers (August, 2009)




Saturday, October 13, 2007

Migration : Upgrading Rails from 1.2.3 to 1.2.5

Being adventurous having my first Rails appplication in production since August 2007, I read about the impending Rails 2.0 release. As I understand it, there was to be a 1.2.4 release and it was supposed to be mostly made up of security fixes and deprecation notices that will help you prepare for Rails 2.0.

Being cautious, I froze Rails 1.2.3 into the Vendor Directory using rake:freeze:gems.

Then I gem install rails --include-dependencies

Surprise...Surprise, the update is to Rails 1.2.5 !

D:\Aptana_Workspace\crm4web>gem install rails --include-dependencies
Need to update 22 gems from http://gems.rubyforge.org
......................
complete
Successfully installed rails-1.2.5
Successfully installed activesupport-1.4.4
Successfully installed activerecord-1.15.5
Successfully installed actionpack-1.13.5
Successfully installed actionmailer-1.3.5
Successfully installed actionwebservice-1.2.5
Installing ri documentation for activesupport-1.4.4...
Installing ri documentation for activerecord-1.15.5...
Installing ri documentation for actionpack-1.13.5...
Installing ri documentation for actionmailer-1.3.5...
Installing ri documentation for actionwebservice-1.2.5...
Installing RDoc documentation for activesupport-1.4.4...
Installing RDoc documentation for activerecord-1.15.5...
Installing RDoc documentation for actionpack-1.13.5...
Installing RDoc documentation for actionmailer-1.3.5...
Installing RDoc documentation for actionwebservice-1.2.5...

Result :
Tested on a blank project (Radrails+Windows 2003 server) created using Rails 1.2.3
Can display the Std index.htm but on clicking the "About Your Application's Environment", the following error message was shown

"Routing Error, no route found to match /rails/info/properties with (:method :Get)

I then created a new project under Rails 1.25 and on clicking the "About Your Application's Environment"

About your application’s environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 0.9.2
Rails version 1.2.5
Active Record version 1.15.5
Action Pack version 1.13.5
Action Web Service version 1.2.5
Action Mailer version 1.3.5
Active Support version 1.4.4
Application root D:/Aptana_Workspace/test-125
Environment development
Database adapter mysql

Worried about the impact on my Production Apps, I committed to SVN, unfroze and ran the app under Rails 1.2.5 and voila no problems :-)

BTW, I was just just informed of this link :-
http://weblog.rubyonrails.org/2007/10/12/rails-1-2-5-maintenance-release

which recommends as follows :-

To upgrade, `
gem install rails`,
set RAILS_GEM_VERSION to ‘1.2.5’ in config/environment.rb, and
`rake rails:update:configs`.

Updated on 18th October 2007

An example of a deprecation woud be
record_type => record.type.name

which will genenerate a
warning: Object#type is deprecated; use Object#class

Solution : record_type => record.class.name

Thursday, October 11, 2007

Advanced Rails : Moving an Existing Database to a Rails Application

Assuming that you have an existing application that you wish to rewrite in Rails, how would you prepare your database schema so that you can take advantage of the magick of db:migrate ?

Well, I had to do exactly that when I decided to rewrite an existing 200+tables CRM solution into e-CRM, a Rails application. This is what I did :-

a) Pluralize all the table names

Tip: One legacy table was named customer. To pluralize it to customers whilst retaing the data, I use CREATE TABLE customers SELECT * FROM customer for MySQL

b) Add an id field (auto-increment, integer) to every table

c) Add created_at, updated_at in every table to take advantage of Rails automatic updating of these fields without a single line of code

d) Added another magic column ie lock_version (must default to 0) to invoke optimistic locking

e) To support a belongs_to relationship, add belongs_to_tablename

f) Create a schema_info table with just 1 field ie Version, Integer and add a single record with the value=1

g) Use Rake db:schema:dump to create a schema.rb based on the underlying database schema . See following snapshot of Radrails in action
h) Create an empty migration file say 001_migrate2mysql and copy the contents to the Self.Up Method as shown in the Radrails snapshot as follows :-

That's it !
Updated on 4th November, 2007.

Sunday, October 7, 2007

Active Scaffold : Roll your own form_ui ?

In the trunk version or the soon-to-be released 1.1 release, we can configure columns, on a per controller basis, such as :select, :calendar, :textarea and :checkbox but what about :text_input ?

Previously, to control the width of a given text-input column, I had to put in the helper something like this either in application.rb or controller_helper.rb

def faq_form_column(record, input_name)
text_field_tag('record[faq]', @record.faq, { :autocomplete => "off", :size => 60, :class => 'text-input'})
end


Now, I can do this :-

config.columns[:biz_name].options = { :autocomplete => "off", :size => 30, :class => 'text-input'}

config.columns[:biz_name].form_ui = :tex-input


How is this done ? Simple, just add this method once in applcation_helper.rb

def active_scaffold_input_tex-input(column, options)
text_field :record, column.name, options
end

Yes, you can roll your own form.ui :-)

Saturday, October 6, 2007

Rails IDE: I can't imagine why some people keep promoting Aptana

In a post on borland.public.3rdrail.ide, Joe McGlyn, Product Development Manager at CodeGear made this comment in response to one of my post.

Joe :
I've spent the past few days trying to use RadRails (the newest M7 from > Aptana). I'm certainly strongly biased toward 3rdRail

CCH: This is to be expected, no worries :-)>

Joe:
but I'm reasonably objective too. If someone points out a bug or >shortcoming in 3rdRail that is valid I'm inclined to agree. Example: Diego's questions about our debugger -- it's weak. Got it, we'll have something that will rock in our December update.

CCH: I have noticed that in your response to my posts. That's why I respect you.

Joe : I can't imagine why some people keep promoting Aptana.

CCH: I think they promote RdRails rather than AptanaBTW, I will start to compile from the various posts why they do that ...and post it on my Rails Blog.

Joe : First, code completion: Method completion fails with a null pointer exception EVERYWHERE. I created a new project, re-installed the IDE, made sure the paths to the Ruby interp. and Rails + Rake commands were set right and it still fails everywhere. I've tried simple cases like "self." in controllers and actions, and modelname. in views, they all fail.

CCH:Just type self.+ctrl+space and a list was displayed (with no errors)Please do not be offended but did you install properly. There is an article on my blog "Rails...Rails...Rails"at http://cch4rails.blogspot.com/ which went live only yesterday and yes 3rdRail is also promoted.

Joe: The usage model is weak. Having to go to a combo box on a tabbed pane is lame. Having separate panes for installing a plugin

CCH: I agree on the inflexibility of installing plugins from unregistered sources vs. running a rake taskcch: I like the Rake Tasks Tab as I find it very convenientvs. running a generator is really week.

CCH: I prefer 3rdRail's Model wizard but the generate tab does have a destroy option which can roll back a controller/model which was requested in the 3rdRail FieldTest but I am not sure whether this has been implemented

Joe : It's a poor usage model, way less effective than working from the OS command line. There also isn't a keystroke to get to these magic views so everything is mouse-based.

CCH: This has not bothered me at all :-)>

Joe :Never mind that the "generator" combo box is buggy (after a bit of usage it's empty and I have to re-start)

CCH: I also find this mildly annoying but you do not have to restart, just click the Refresh icon on the top LH corner of the Generator Tab

Joe : The "gem manager" doesn't have any way I can find to install a plugin (install is always greyed out). I can't install a gem from a specific URL or svn tag (so, for example, it's useless for getting the Rails 2.0 > preview release) I can't add additional repositories to install gems from. Like most of the UI it ends up being a lot less useful than the command line.

CCH: I have just done that whilst installing the ibRuby Gem :-)See my latest article on Interbase at "Rails...Rails..Rails"

Joe : At first glance the debugger seems promising, and they have a list of refactorings, although most don't look that useful for Rails development.

Based on my research on comments made in popular RoR-related groups, this why some people keep promoting Aptana radrails

1) Tim Harper (Project Member : Active Scaffold) , 30th Sept 2007

Lemme chime in here and say I love aptana radrails.

I tried 3rdRail, and it felt "clunky". The code complete is excellent in it, but it's also pretty slow.

Aptana's code complete, go to declaration, combined with eclipse's textual complete are great enough for me.

Plus, radrails gives you a neat little tool for running unit tests that kicks the pants off running them in a console window

http://groups.google.com/group/activescaffold/browse_thread/thread/afed31fe981b6fe6/30e6785209ce5c73#30e6785209ce5c73

2. Josh

So it was definitely a ruby version issue. For some reason I was still running verion 1.8.2. I just upgraded to 1.8.6 and adjusting the aptana to work with it and now its working beautifully.

I'm willing to bet the other guy with the mac is running an older version as well.
http://groups.google.com/group/activescaffold/browse_thread/thread/9dba7977c325e9f0/95ce778341d5c154?lnk=gst&q=Aptana&rnum=14#


3) Patrick Aljord (8th March 2007)


RadRails is the best free IDE out there for RubyOnRails development and it's easy for companies to integrate it into their development platforms as it it's based on Eclipse.
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/73dd6d73752aa09b/59504f9e3488b88c?lnk=gst&q=radrails&rnum=3#59504f9e3488b88c


4) Chris Bloom (29th September 2007)


I'm using RadRails since I can't spring $2049 for TextMate (and accompanying Mac). I've also tested the "e" editor, and otherwise have used EditPlus.

RadRails is a nice balance of a compact work space, console/logger, and syntax hilighter. I also like its Auto-completion functionality, but it's anywhere from complete OR consistent. And it's preferences panel leaves much to be desired. Then again, it is still a beta release so you have to take some of those problems in context. I look forward to future releases.

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/fc4ec10f4767e4aa/0cf12c2fd2e323e9?q=radrails&lnk=nl&

5) John Lane (24th Sept 2007)


Hmm, I'd never heard of 3rdRail so I just checked it out: it appears to be a commercial product.

I personally use Aptana and, yes it has its issues but I think it's better to support an open source initiative with a donation than walk off to a close source solution.

However, if 3rdRail is streets ahead of Aptana then it may be worth paying for. So, what does it give that Aptana doesn't

6) Dr Nic (6th Nov 2006)

RadRails is a wonderful IDE for developing Rails/Ruby, and supports a similar auto-completion mechanism to TextMate's snippets, called templates. You activate them by typing a portion of the template name, and pressing CTRL-SPACE.

But RadRails doesn't come with many templates for Rails development.
I've just finished porting all the TextMate snippets across to RadRails - about 250 of them. I hope they are useful to other RadRails developers!
http://drnicwilliams.com/2006/11/06/post-halloween-radrails-trick-all-textmate-snippets-available/
Nic

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/9dbdeb357234c895/a1f35635bb6441fb?lnk=gst&q=radrails&rnum=23#a1f35635bb6441fb


7) Jay Levitt (1st Oct 2007)

integration support. Both RadRails and 3rdRail use the Subclipse plugin (though I suppose either could be made to use Subversive instead), so you'll see no differences between them.

I'm fairly happy with Subclipse; it's a bit finicky, and there are some cases (reverting, especially) where it's much slower than the command line, but the integration with the core Eclipse feature set is really nice - the ability to see in your project which files need updating, the Synchronize mode, and especially Mylyn's ability to automatically create separate changesets for each of your to-do tasks. Two of my favorite features are the Eclipse Compare Editor graphical merge view and the "Quick Diff" annotation bar[2] (which colors the line-number field for each line based on revision number and author, making it easy to find change groups).

The Subclipse maintainer is also on the core Subversion team, so I'd expect Subclipse to have terrific support for the cool new upcoming features in 1.5, like first-class changesets and merge tracking. In fact, he's blogged about a GUI merge-tracking client he's been working on[3].

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/be1f7ce2af0a5f18/1b0e136ee6b6adb1?lnk=gst&q=radrails&rnum=60#1b0e136ee6b6adb1

Active Scaffold : Brief Introduction...

What happens when you have gone through the various tutorials and came away thoroughly impressed by how easy it is to develop a working RoR app ?

After a while, you will clearly decide that the default Rails Scaffolding though customisable is simply impractical. Why ? Think of a scenario where you have say a 200 tables CRM Win32 application which you are thinking of rewriting in RoR :-(

Enters Active Scaffold... In a nutshell, Active Scaffold is a Ruby on Rails plugin that dynamically creates user interfaces for your models that include your basic CRUD operations + search, a slick fully styled AJAX'ified design, and a high level of configurability. An extension of the AjaxScaffold project

Thursday, October 4, 2007

Rails IDE : Why is 3rdRail Unique ?

This is quoted verbatim from a response to post I made in the CodeGear 3rd Rail Public News Group.

CCH: As I delve deeper into eclipse-based IDEs such as 3rdRail & Radrails, I began to realise that a lot of features that developers rave about are actually from Eclipse. I am planning to write an impartial article (at > http://cch4rails.blogspot.com/) on why 3rdRail is so special, which I believe to be true to a certain degree. As such, I would appreciate it if you list the non-eclipse features that truly distinguishes 3rdRail from other IDEs .

Joe McGlyn, Director of Product Development, CodeGear :

Top level features:
- Rails Explorer
- Project Commander
- Ruby console
- Rails console
- Dependency view
- Rails refactorings (NB claims to have refactorings for views and actions, but it fails in every test case I've tried)
- Solid code completion (FWIW, I get a null pointer exception in RadRails M7 in nearly every test case on code completion -- not template completion)
- Context-aware templates (template expansion only shows templates for the current Rails context so you don't see view templates in a controller for example)
- "open associate" navigation according to Rails' dispatch rules

Wednesday, October 3, 2007

Using Interbase 2007 in Ruby on Rails Project

Joe McGlyn, Director of Product Management at CodeGear has shown the way to use Interbase 2007 in Ruby on Rails as follows :-

Assuming you already have a project, here are the basic steps to modifying a project to work with InterBase as the database...

1. Get the InterBase gem
gem install ibruby

Comments by CCH :
There are a few ways to do this
a) c:\instantrails\ruby\bin >gem install ibruby

b) In Aptana RadRails,
i) call up the Gems Manager from
Windows\show view\Ruby Gems
ii) Within the Gems Manager
- Click Install
- select ibruby Gem

You can then see the progress within the Console Tab

c) In 3rdRail, you can use the Project Commander


2. Get the Rails adapter (from the root dir of your rails app or from the project commander) script/plugin source http://ibruby.rubyforge.org/svn/rails_plugins/trunk/
script/plugin install ibrails_plugin

Comments by CCH
a) Shell to Command prompt and cd to root of your project folder

c:\project_name>ruby script/plugin source
http://ibruby.rubyforge.org/svn/rails_plugins/trunk/
c:\project_name>ruby script/plugin install ibrails_plugin

b) Using Aptana Radrals,
i) select the Rails Plugins Tab
ii) select ibruby and click Go

Nb. If ibruby does not show in the list, revert to method (a) :-)

c) In 3rdRail, you can use the Project Commander

NOTE :
You will also need to add these two lines into your Rails
environment.rb file:
# ------ force InterBase support to be added to Rails
# ------ as Rails currently has no way of extending its db
# ------ support apart from a new Rails release!
require 'active_record'
require 'vendor/plugins/ibrails_plugin/lib/ibrails_plugin'
# ------
Ideally these two lines should appear after the line loading
boot.rb which typically looks like this:
require File.join(File.dirname(__FILE__), 'boot')
and before anything else gets done (particularly any
initialization)

3. Assuming you have IB installed, and have the default IB user/pwd enabled you're good to go.
It will even create the database file (within your project directory by default)
Known limitation:Indicies are limited to ~200 characters, depending on how they are composed. This is InterBase, not the integration.

Comments by CCH

Despite religously following the instructions from Joe McGlyn of CodeGear, I have not been able to overcome the barrier and error message
ie "database configuration specifies nonexistent interbase adapter"
You may want to read the thread "Using Interbase with RoR" started by Joe here borland.public.3rdrail.ide

Tuesday, October 2, 2007

Rails IDE : Aptana Radrails M7 Beta - First Impressions

I am an intensive user of Aptana Radrails M5 since July 2007 and have just updated to M7.

Interface-wise, I can immediately see the following changes :-
1) Rails Navigator has been replaced by Ruby Explorer
2) 5 obviously new icons on the tool bar
a) H - switch to Helper
b) T - switch to Test
c) M - switch to Model
d) V - switch to Views
e) C- switch to Controller

Curious, I selected my favourite project and click (a) - (e), nothing happened

Then, I opened the CustomerController which looks the same as in M5

Clicking H opened module customers_helper.rb
Clicking M opened module customer.rb
Clicking V asked for which action (using AS, N/A)
Clicking T opened customer_controller_test.rb

This is very convenient, Cool :-)

3) Rails Plugin no longer automatically goto the home pages but links are clearly there thus speeding up

4) Code completion/Code Snippet when one type

val or validates+ctrl+space displays a list wnd when selected inserts
validates_presence_of(attributes, :message => "message")

5) The Ruby Explorer is great in that via a tree structure, methods hyperlinked to the actual methods. This is a nice feature absent in M5.

This article was first posted on 28th September 2007, 11:30pm on the Ruby on Rails:Talk Google Group

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/e4365a0d52403271#

Rails IDE : Aptana Radrails M7 Beta - Best Way To Upgrade

Just upgraded smoothly to long overdue Aptana M7 Beta which was released on 25/9/2007.

FYI, the best way to upgrade from July's M5 (M6 was skipped) is as follows :-

1) Click Help/Software Upgrades/Final and Install

2) Manually adding the following remote update site to the update manager: http://update.aptana.com/update/rails/beta/3.2/site.xml
Nb. Name the new remote site as say "Aptana M7 Update"

3) If you have any issue after upgrading, you could try to reinstall as follows :-
1) Remove the Aptana folder under C:\Documents and Settings\username\My Documents (if any)
2) Uninstall Aptana from Control Panel
3) Install from Aptana_IDE_Setup.msi
4) Goto Help\Software Updates\Find and Install
5) Accept the default Search for new features to install
6) Check Aptana M7 Beta and click Finish

This article was first posted on 28th September 2007, 10:48pm on the Ruby on Rails:Talk Google Group

Update on 4th October 2007

This is what I did to get a clean installation of RadRails
1) Uninstall va control panel
2) Delete Documents and Settings\username\mydocuments\Aptana Beta folder which contains the meta data
3) Remove the Programs\Aptana direcory
4) Install Aptana_IDE_setup.msi

Nb. You may want to chose custom and select to install JRE 1.6
I believe this is the source of your null pointer issue

5) Using Plugins Manager or Find and Install Software, install
- Radrails M7 Beta
- Subclipse

That's it

Why Rails...Rails...Rails ?

In 1995, I started the popular Clipper...Clipper... Clipper website (no blogs then) which was very popular and linked by virtually every Clipper-related site. When I switched to Windows via Delphi in 1997, I started the Delphi... Delphi... Delphi site.

In June 2007, I discovered Ruby on Rails and no prize for guessing what I am gonna name this blog :-)

BTW, I started this blog on 30th September 2007 and this is the first Rails app which is a rewrite of a 200+ tables CRM apps on the Win32 platform.






Welcome to Rails.. Rails... Rails !

In 1995, I started the popular Clipper...Clipper... Clipper website (no blogs then) which was very popular and linked by virtually every Clipper-related site. When I switched to Windows via Delphi in 1997, I started the Delphi... Delphi... Delphi site. In June 2007, I discovered Ruby on Rails and no prize for guessing what I am gonna name this blog. which I started on 2nd October 2007.

As at 10th June 2010, we have 13,364 unique visitors from more than 84 countries such as Angola, Andorra, Argentina, Australia, Austria, Algeria,Barbados, Bosnia and Herzogovina, Belgium, Brazil, Bulgaria, Bangladesh, Belarus, Bolivia, Chile, Cambodia, Cape Vede, Canada, China, Colombia, Costa Rica, Croatia, Cyprus, Czech Republic, Denmark, Egypt, Estonia, Finland, France, Guadeloupe, Guatemala, Germany, Greece, Hong Kong, Hungary, India, Indonesia, Ireland, Israel, Italy, Japan, Kenya, Korea, Lithuania, Latvia, Malaysia, Mexico, Macao, Netherlands, Nepal, Norway, New Zealand, Oman, Panama, Peru, Poland, Portugal,Paraguay , Philippines, Romania, Russian Federation, Saudi Arabia, Singapore, Spain, Slovakia, Slovenia, Serbia, South Korea, Slovenia, South Africa, Spain, Switzerland, Sri Lanka, Sweden, Taiwan, Thailand, Turkey, United Arab Emirates, Ukraine, USA, UK, Venezuela, Vietnam

CCH
10th June 2010, 19:42