background preloader

Rails

Facebook Twitter

Sphinx

Activerecord. Installing Rails on CentOS 5 « catapult-creative.com. Run Fat Boy .net » Blog Archive » Rails Migrations - Command Lin. I absolutely loves Rails 2.0 and the command line conveniences it provides for the RESTful scaffolding and models.

Run Fat Boy .net » Blog Archive » Rails Migrations - Command Lin

Here’s a couple of tricks to generate a migration to quickly to add/remove columns from an existing table. Assume you already have a table called ‘Users’. Checkbox list in Ruby on Rails using HABTM. Checkboxes are one of those things that look easy and should be easy, but they aren't always easy.

Checkbox list in Ruby on Rails using HABTM

I needed a solution that could create a checkbox list of languages that a user speaks. So I don't forget here's how to do it: The migrations are important. You have to be sure to exclude the id parameter when you create languages_users or you will get ' Mysql::Error: #23000Duplicate entry' due to the fact that ActiveRecord will try to store a value in the id field that indicates which model created the entry (User.languages << vs Langauges.users). Full text search in Ruby on Rails 2 - MySQL. My previous post compared MySQL and ferret full text search engines.

Full text search in Ruby on Rails 2 - MySQL

For our project, the ferret was the winner. Nevertheless, I will try to show the beauty and simplicity of using MySQL indexes. Create table and indices First of all it is necessary to create table and the corresponding index. CREATE TABLE articles( id integer NOT NULL PRIMARY KEY AUTO_INCREMENT, title varchar(20), body varchar(100), fulltext(title, body)) engine = MyISAM;<BR> Rails:db:migrate:data-autopopulation. A Guide to The Rails Command Line. 1 Command Line Basics There are a few commands that are absolutely critical to your everyday usage of Rails.

A Guide to The Rails Command Line

In the order of how much you'll probably use them are: rails consolerails serverrakerails generaterails dbconsolerails new app_name All commands can run with -h or --help to list more information. Alex Young: Rapid Rails Part 1: Command Line Mastery. Rapid Rails is a series of articles containing succinct tips to increase your productivity when working with Ruby on Rails.

Alex Young: Rapid Rails Part 1: Command Line Mastery

This is the first part, and shows you how to make the most of the command–line tools that come with Rails. Quickly generate migrations The Rails generator script (found inside an application’s directory at script/generate) allows you to quickly create templates for anything you need within Rails. As well as models and controllers, you can also use it to write entire migrations: script/generate migration AddIPAddressToUsers ip_address:string The field definition is specified as field_name:type, and you can type in as many as you need for each migration. Script/generate migration This cuts down the hassle of changing database schemas around, and should be the nail in the coffin for lazy database schema manipulation with GUI tools. Get more generators What was I doing last week? Rake notes rake notes:fixme rake notes:optimize rake notes:todo More Rake house–keeping tools.

Ruby on Rails - Rails Migrations Cheatsheet - Dizzy. How to Setup a Rails application in cPanel « Blagador! – marvspa. Ruby on Rails 101. ActionView is the module in the ActionPack library that deals with rendering a response to the client.

Ruby on Rails 101

The controller decides which template and/or partial and layout to use in the response Templates use helper methods to format text, generate links, forms, and JavaScript. Ruby on Rails « Gregory Doran. While working on a CRM system in Ruby on Rails 2.2 I needed to find a way to email one of the users a weekly report. The report would be generated from the PDF templates already integrated with the front-end using the RTex plug-in for Rails.

The solution was to include the following in an ActionMailer model to render the view away from the controller and attach the result to an email. Firstly, create an instance of the ActionView::Base class: 1.av = ActionView::Base.new(Rails::Configuration.new.view_path) The next step is to call render which will return the output of the template. 2.latex = av.render(:file => "app/views/people/index.pdf.rtex", Adding a method to built-in class in rails app. Rails Framework Documentation. Using a database to populate an Open Flash Chart graph. 25 Jul Just got Archie Smuts comment asking how to populate a Open Flash Chart graph using results from a database. Just for reference, the code that follows represents this graph: Examples for version 2 are here.

Using the new version of Open Flash Chart, here is an example for you to follow: Start a rails app and install the plugin per these instructions.The results table that I am working with has these rows:Create a controller, mine is test_it:Create a view, mine is index.html.erb for the test_it controller: Ruby on Rails India, Ruby on Rails in India, About:- Using open flash chart you can represent your data in the form of different type of graphs. Install Files:- A Guide to Active Record Associations. 1 Why Associations? Why do we need associations between models? Because they make common operations simpler and easier in your code. For example, consider a simple Rails application that includes a model for customers and a model for orders. Projects: Open Flash Chart II Plugin for Ruby on Rails - Graphs. Sample Use Download the sample OFC2 project.rails testing_ofc_2cd testing_ofc_2script/plugin install the above line did not work for you, you can also use http -script/plugin install controller test_itAdd the following to the test_it_controller.rb in RAILS_ROOT/app/controllers:Add the following to index.html.erb in RAILS_ROOT/app/views/test_it/: Copy swfobject.js from the plugin's assets/ directory (will make this happen at install time later) to your RAILS_ROOT/public/javascripts directoryCopy open-flash-chart.swf from the plugin's assets/ director to your RAILS_ROOT/public/ directoryscript/server Browse to me know how it goes, thanks.

Projects: Open Flash Chart II Plugin for Ruby on Rails - Graphs

Sample Graphs View Source Code View Source Code. Heroku Garden.