DeLynn Berry

Posts tagged rails

0 notes

ZiYa Plugin

I’m about two weeks late getting this announcement out, but I wanted to point everyone to a new Rails plug-in that I have been working on with Fernand Galiana. It’s name is ZiYa (after the Turkish impressionist painter Nazmi Ziya Güran), and its purpose is to make using the XML/SWF Charts library a snap with your Rails project.

Here’s how to get a sample bar chart in your current Rails project:

Step 1.

Install the ZiYa plug-in:

[ruby] script/plugin install svn://rubyforge.org/var/svn/liquidrail/plugins/ziya/trunk

Step 2

Include the ZiYa module into a controller that will be responsible for generating the chart:

class ChartsController < ApplicationController
include Ziya
end

Step 3

Create the action that will be used to generate the XML document for the chart. Please note, this action will be used by a new or existing action, it will not be the same action that your users load in their browser.

def posts_chart
chart = Ziya::Charts::Bar.new
render :text => chart
end

Step 4

In the view template for the client facing action, use ZiYa’s gen_chart helper method to embed your chart into the view:

<%= gen_chart(“posts_chart”, :url_for(:controller => “charts”, :action => “posts_chart”), “#ffffff”, 400, 300) %>

Step 5

Refresh your browser to see the default bar chart.

To make getting up to speed on all the capabilities of this plug-in and the XML/SWF Library we have put together a great support site. We have generated documentation, a bunch of sample charts, an introductory video and a really great training application that allows you to play with the YML chart styling capabilities. You can also checkout the project page over on RubyForge. There’s also a Google Group that we’ve created specifically for ZiYa discussion. Please post any questions or comments that you have regarding the plug-in there.

So, download the plug-in and get charting your data. This is a must have feature for an application that needs to impress their managers!

Filed under plugins rails ziya

0 notes

Rails CHM Documentation - Version 1.2.0 RC1

Since the first release candidate of Rails 1.2.0 was announced yesterday, I decided to update the CHM documentation to match this latest release. You can find the updated file via my CHM Documentation Project Page, or just download the file directly from here.

Please note that ActiveResource was pulled from 1.2.0 as of revision 5554, so its documentation is not included in the above file. If you are running off of trunk and want/need the ActiveResource documentation, then you should download my latest trunk CHM file from here.

Filed under chm documentation rails

0 notes

Rails CHM Documentation - Version 1.1.6

It’s been a long time coming, but I just posted an update to my Rails CHM Documentation file. This update has the documentation for the 1.1.6 release of Rails. This version also has a much more organized Contents section that has a folder group for each gem, which will hopefully lead to easier browsing of the entire file. You can download this release from this url.

If after downloading the file you find that you can’t view pages in the document, Windows Security is probably to blame (complaining about the file originating from another computer). To fix this problem, simply right-click on the downloaded file, select Properties and click the Unblock button at the bottom of the window.

Also, if you’re one of the hip kids using Rails trunk, keep an eye out for a pre-release of the 1.2 documentation later this week. With all the new items in Rails trunk (ActionService, simply restful, etc) I’ve found myself needing to scan the source files from time to time (interesting, but time consuming).

Filed under chm documentation rails

0 notes

Project RIDE-ME

So a couple of days ago, after seeing a post over at Softies on Rails, I downloaded and installed RIDE-ME. RIDE-ME is the latest entry into the Rails IDE space, following the likes of RadRails, Locomotive, and (in some aspects) Sapphire In Steel.

RIDE-ME looks and functions a lot like Visual Studio (which I know might not appeal to everyone), but unlike VS, it’s very light weight, has great syntax highlighting support, and is fast (which are all must haves for me when it comes to editors). After playing around with the application for a while, I wasn’t quite set to leave my current editor, but I was very excited about its future. I decided to keep my eye on the project’s weblog and continue to re-evaluate the application as features were added.

What happened next is still a bit of a blur, but the other day Michael posted that he had a new build that included initial support for editing code snippets, and asked for people interested in testing it to leave a comment. Little did I know that my interest in this new feature (and my comments with regard to implementation) would lead to me becoming a contributor, but it did! Thanks to my big commenting mouth, I’ve been given the task of implementing the code snippet support for RIDE-ME. Now, I haven’t worked with C# in a long time, so I was initially a little worried that I might actually slow the project down a bit while I knock off the rust, or, even worse, totally screw something up. Thankfully, Michael has done an excellent job in organizing the code base, so I should be able to hop in and make things happen without causing too many problems. ;-)

So, keep an eye out on the RIDE-ME Blog for updates from me as well as the others involved. The planned features, when finished, will most certainly make this the must-use IDE to use for Rails development on Windows.

Filed under code projects rails rideme

0 notes

DeRailed Presentation

I’ll be doing a presentation next Monday at the monthly DeRailed meetup. The topic of my presentation will be AJAX and RJS support in Rails.

Justin Mecham will also be giving a presentation on Rails deployment using Capistrano (which I’m extremely interested in since I haven’t gotten the chance to use it yet).

Last month there were about 20 people who attended. It’s a pretty diverse group, with Rails skills ranging from beginner to advanced (along with PHP and Java developers). If you are looking to meet great people who are interested in web development, this is an excellent place to find them. So, if you are near the downtown Tattered Cover on Monday around 6:30, stop by and say hello.

Filed under appearances derailed life presentations rails

0 notes

Rails CHM Documentation - Version 1.1.2

I was able to get around to updating the Rails CHM Documentation this morning. It’s taken me a bit longer than I would have liked to get this out, so I apologize. There really is a good reason for the long wait!

I had previous made some modifications to the RDOC CHM generator file to get the previous version working the way I liked, and while upgrading Ruby to 1.8.4, I accidentally overwrote the file (oops). Because of this, I had to go back and make the modifications again, and I really hadn’t been motivated to do this since I was busy with other projects. This morning, I sat down and decided to get the file out. I made backup copies of these files this time, so this shouldn’t happen again.

For those wondering, I am still planning on getting an article out detailing exactly what I do to generate this CHM file (including the RAKE task). Until that happens though, you’ll just have to live with the file I’ve got. :-)

Here’s the url: http://delynnberry.com/pages/rails-chm-documentation.

Filed under chm documentation projects rails

0 notes

Acts As Dropdown Plugin

I saw a post on Monday morning written by courtney over at http://habtm.com called “Handy Select Functions”. I had recently begun building this type of functionality into some of the models in my current application, but when I saw this, I immediately thought “Wow, that’s much better!”

After adding these methods to a library file and trying it out in my application, I began wondering if the implementation might not be even better if the whole thing were in a plugin. Within a few hours acts_as_dropdown was born, allowing you to create dropdowns very easily by just doing the following in your model:

class State < ActiveRecord::Base
acts_as_dropdown
end

and then using the to_dropdown method in the view along with the select form helper:

<%= select(“person”, “state_id”, State.to_dropdown) %>

<select name=”person[state_id]”>
<option value=”1”>Alabama</option>
<option value=”2”>Alaska</option>
<option value=”3”>Arizona</option>

</select>

Feel free to check out all the nitty gritty information on the acts_as_dropdown product page, or by checking out the plugin from my SVN repository at http://www.delynnberry.com/svn/code/rails/plugins/acts_as_dropdown/.

So, check it out in your own project and let me know what you think!

Filed under acts_as_dropdown plugins projects rails

0 notes

Rails CHM Documentation - Version 1.0

Update - The latest version of the CHM documentation for Rails version 1.1.2 has been released and can be found here.

Back in August there was a Rails developer who released a CHM version of the Rails 0.13.0 documentation for those that have to develop on the Windows platform. I have been using that help file for the past few months even though there are several alternate ways of getting at the Rails documentation. For some reason, I always found myself using the CHM because of the index and quick search capabilities that it provides.

However, over the past couple of weeks I found myself no longer using the CHM file, but the Rails API website instead. The reason for this was simple: Rails moved to version 1.0 a couple of months ago and introduced several new features that the CHM file just didn’t cover.

I remember seeing a Wiki article that explained how to generate the CHM manually, so yesterday morning I set out to do just that with the Rails 1.0 source. Unfortunately, I ran into several problems (just like others have). What I thought was going to be a simple little RDoc task, ended becoming a debuging task that took most of the day to get everything just right.

Download the file from here!

In the next couple of days, I plan on releasing a RAKEFILE that will allow one to easily create the CHM file from the Rails source. I also will be making the CHM file available for any future version of Rails as soon after the release as possible so as to avoid the black-out type situation that we had during the past seven months.

So, let me know if you have any suggestions or have problems with the file and enjoy!

Filed under chm documentation projects rails

0 notes

Userstamp Plugin

I was recently creating a new Rails application for work, and needed to track who was creating and updating certain objects. I remember seeing a post on the Rails Wiki a while ago entitled “Extending ActiveRecord Example”, so this is where I started when looking to implement my needed functionality. After reading that article I started thinking that instead of creating a library and including it into every model that needed this functionality, it would be neat if there was a plugin available that took care of this for you. After looking at the Plugins Wiki page, I was suprised to see that no one had yet created a plugin.

Using the ActiveRecord::Timestamp module as reference, I set out creating the plugin myself. After about thirty minutes of hacking around, I had a fully working plugin. I’ve been using this plugin in my application for the last few weeks and after seeing this post to the mailing list, I decided it might be good for me to release the plugin to the world. During the last couple of days, I’ve spent time adding a full battery of tests and RDoc comments to the code.

So, without further ado, I’m pleased to announce the Userstamp Plugin.

Filed under plugins projects rails userstamp

0 notes

Rails Ticket #3506

This morning I uploaded a Patch for the Rails AssetTagHelper. This patch adds a bit of functionality that I had been looking for with regard to the javascript_include_tag and the stylesheet_link_tag. For those of you interested in the contents of the ticket, click here, or view the extended section of this post by clicking on the button below.

Next up, I plan on releasing my plugin that assists in adding versioning for stylesheets and javascripts automatically ala Justin French.

This patch makes adjustments and additions to the javascript_include_tag and stylesheet_link_tag methods of Asset Tag Helper.

javascript_include_tag

This method has been altered to now handle additional scripts to be included when using the :defaults functionality. Instead of having to make two calls to javascript_include_tag (one for the defaults and one for the scripts you would like to use), you now only have to make one.

For example:

javascript_include_tag(:defaults, “my_scripts”)

results in:

<script src=”/javascripts/prototype.js” type=”text/javascript”></script>
<script src=”/javascripts/effects.js” type=”text/javascript”></script>
<script src=”/javascripts/dragdrop.js” type=”text/javascript”></script>
<script src=”/javascripts/controls.js” type=”text/javascript”></script>
<script src=”/javascripts/my_scripts.js” type=”text/javascript”></script>

The :defaults symbol can also exist at any point in the array of scripts (which will alter where the defaults are output in the markup).

So:

javascript_include_tag(“my_scripts”, :defaults)

produces:

<script src=”/javascripts/my_scripts.js” type=”text/javascript”></script>
<script src=”/javascripts/prototype.js” type=”text/javascript”></script>
<script src=”/javascripts/effects.js” type=”text/javascript”></script>
<script src=”/javascripts/dragdrop.js” type=”text/javascript”></script>
<script src=”/javascripts/controls.js” type=”text/javascript”></script>

This is valuable if you need to have a script load prior to the inclusion of the Prototype and Scriptaculous Javascript libraries.

stylesheet_link_tag

The :defaults functionality has been added to the stylesheet_link_tag method. Right now there are no defaults in the STYLESHEET_DEFAULT_SOURCES array, but the functionality exists for adding to the array using register_stylesheet_include_default. I figured since Javascripts had this functionality, Stylesheets should too. This will allow plugins the ability to add Stylesheets as needed.

The stylesheet_link_tag method also looks to see if a RAILS_ROOT/public/stylesheets/application.css file exists and automatically adds it to the list of included CSS files when the :defaults symbol is passed (just like the javascript_include_tag method).

Filed under patches rails