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.
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.
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). The other option is the create the id parameter so that the direction is maintained but be sure that it is not created as a primary key. Full text search in Ruby on Rails 2 - MySQL. My previous post compared MySQL and ferret full text search engines.
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> or create index after the table exists. CREATE fulltext INDEX x_f_articles_body ON articles(body); Please note the MyISAM engine. And now, let’s insert some data INSERT INTO articles(title, body) SELECT "Databases and IT", "Todays world ... database... Query syntax Querying is simple.
SELECT * FROM articles WHERE match(title,body) against ("Databases"); or you can create query looking for all database related articles SELECT * FROM articles WHERE match(title,body) against ("Databases" WITH query expansion); See also the record ID=5. Rails:db:migrate:data-autopopulation. A Guide to The Rails Command Line. 1 Command Line Basics.
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.
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. 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.
Html.erb – The most common type of template used for HTML. Atom_feed do |feed| feed.title("My great blog! ") <%=h @article.name @% <%=h article.name %> <%= article.name % 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: 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: Ruby on Rails India, Ruby on Rails in India, 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. Each customer can have many orders. Without associations, the model declarations would look like this: Projects: Open Flash Chart II Plugin for Ruby on Rails - Graphs. Heroku Garden.