Feeds:
Posts
Comments

Archive for the ‘Ruby on Rails’ Category

Use; set_table_name :name_of_the_table in your model (E.g) class myTable < ActiveRecord::Base set_table_name :media end

Read Full Post »

Create a controller with the name ‘sitemap’ (or) with the name you desire….. (E.g) ruby script/generate controller sitemap (or) You can manually create one [app/controllers/sitemap_controller.rb] When you view the ‘controller file’ which you created just now, it would look like; class SitemapController < ApplicationController end Once it’s done, we need to add the functionality to [...]

Read Full Post »

Rails comes with a script/runner script that can be used to run the code in your Rails app. There’re many ways to organize your code to let this runner script execute it, but one obvious way is to write the code as a model’s action. Here are quick steps for doing this: 1. Insert the [...]

Read Full Post »

use; require ‘rubygems’ gem ‘dbi’ before the line; require “dbi”

Read Full Post »

Try using; require ‘rubygems’ in the firt line. That should fix your problem.

Read Full Post »

Rails Freeze

To Freeze to your installed version of rails: rake rails:freeze:gems Freeze to edge rails (latest version, probably not a good idea as rails has had some radical changes lately.  If you want to do RESTful, then go for it). rake rails:freeze:edge Freeze to a specific version, eg 1.2.3: rake rails:freeze:edge TAG=rel_1-2-3

Read Full Post »

Make it ‘cache_store‘ insted of ‘fragment_cache_store’ It should look something like, ActionController::Base.cache_store = :file_store, “../my_cache”

Read Full Post »

template_path has been not only deprecated but is now gone. Try changing it to view_paths

Read Full Post »

In some cases, you may want to have multiple foreign keys map to a single model. The following example explains how the “user_id” and “favorite_id” in a single table(Favourites) map to the User Model(table). class Favourite < ActiveRecord::Base belongs_to :user belongs_to :favourite_user, :class_name => “User”, :foreign_key => “favourite_id” end Now you can play around without [...]

Read Full Post »

Try, request.env[:REQUEST_URI] instead. That should fix your problem.

Read Full Post »

« Newer Posts - Older Posts »