I'm new to Rails development, and I'm trying to figure out how to use an older version of Rails with Apatana's RadRails IDE. I'm trying to help out a friend who has a site built on older version than the one that automatically gets downloaded by RadRails, and I'm pretty sure the two versions wouldn't be compatible (the site is using som...
Hi,
I've got a really simple rails question here but I can't seem to find the answer anywhere. I guess some of the problems stem from me following a tutorial for Rails 1.2 with Rails 2.1. Anyway..
I'm writing a blog system and I'm implementing the comments bit. I have comments displaying fine once I've created them using script/console...
Well this is incredibly frustrating. After being nagged by Rails that I need to install the C-based MySQL adaptor, I did so... and then discovered that it won't work with MySQL under version 6. Now 'gem uninstall mysql' results in 'unknown gem mysql'.
I just spent half an hour trying to get the thing to install in the first place (...
Suppose you have two models, User and City, joined by a third model CityPermission:
class CityPermission < ActiveRecord::Base
belongs_to :city
belongs_to :user
end
class City < ActiveRecord::Base
has_many :city_permissions
has_many :users, :through => :city_permissions
end
class User < ActiveRecord::Base
has_many :city_permi...
Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it comes to Ajax. Unfortunately, there are a few problems that I often see with the JavaScript that it generates.
Rails typically uses inline event handling.
<a onclick="somejavascript(); return false;" />
This is generally frowned upon, as it's mixing ...
Is there an easy way to have the form helpers set the tabindex parameter automatically when using form helpers in Rails?
Basically, I don't want to have to manually set the tab index on every form element when building forms (I keep forgetting to update them when I change things). The majority of the forms I write are basically a list ...
Currently, if I want to apply a method to a group of ActiveRecord objects, I have to structure the call like so:
messages = Message.find(:all)
csv = Message.to_csv(messages)
How can I define the method so it's structured like so?
messages = Message.find(:all)
csv = messages.to_csv
This is the current model code:
require 'fastercsv...
I have the following models.
# app/models/domain/domain_object.rb
class Domain::DomainObject < ActiveRecord::Base
has_many :links_from, :class_name => "Link", :as => :from, :dependent => :destroy
end
# app/models/link.rb
class Link < ActiveRecord::Base
belongs_to :from, :polymorphic => true
belongs_to :object_value, :polymorphic...
Ok, so I have a Rails app set up on DreamHost and I had it working a while ago and now it's broken. I don't know a lot about deployment environments or anything like that so please forgive my ignorance. Anyway, it looks like the app is crashing at this line in config/environment.rb:
require File.join(File.dirname(__FILE__), 'boot')
...
Some of the answers to a question I had about redirect_to made me think about some other questions.
Basically I'm writing a blog application using Rails 2.1. I've been trying to do most of it myself (as I know a bit of rails), but with reference to tutorials and references on the internet when I need it.
I managed to get a simple blog ...
I'm starting to look into the whole world of RJS and Prototype/jQuery in rails and am a little bit confused. There seems to be no clear line of where to use one or the other.
Say i wanted one of the "Active, Hot, Week" tabs like the ones here on SO. When pressing one of them i want to remove a css class (like "active-tab") from the one ...
I recently installed RailRoad gem to generate an .svg diagram of my app's models and controllers.
The rake task keeps breaking with a similar error:
1.8/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:263:in `load_missing_constant': uninitialized constant
I tried the rake task on 2 seperate apps and ...
I have a partial that renders a select box using the following method:
<%= collection_select 'type', 'id', @types, "id", "name",
{:prompt => true},
{:onchange =>
remote_function(
:loading => "Form.Element.disable('go_button')",
:url => '/sfc/criteria/services',
:with => "'ty...
Everyone is talking about TDD (BDD) in Rails (and not just Rails) development world today. It's easy to find plenty of good general information about it, there are quite a few tools you can use for this purpose and there are many (good) examples of how to use them.
Now, I'm already on the train. I like the idea (never did TDD before) a...
I got the acts_as_taggable_on_steroids plugin to work fine. The tag_cloud method in my view create and formats the cloud properly however the tags are listed in order of 'count desc'.
How to I present my tags in the cloud in alphabetical order?
...
Hi, I have a Rails application that in the erb code, I use a select box. What I would like to do is reload the page passing the sort parameter. My controller already handles it, but I don't know how to reload the page with the selected value from my select box. Here is my code:
<% @options = {:latest => 'lastest' , :alphabetical => 'alp...
I have a Rails app that sets a cookie and does a redirect to another server once the user is logged in. However, the cookie that the Rails app sets isn't seen by the server for some reason. I've tried setting http_only to false but I still can't even see the cookie unless the domain is the same as my Rails app. Here's the code I'm using ...
I am trying to debug an ActiveResource call that is not working.
What's the best way to view the HTTP response to the request ActiveResource is making?
...
I've got an application that needs quite a bit of data (1000s of records) to do appropriate testing. The only way I've found to get a decent set of testable, sensible data is to use a subset of my production DB. I've converted this to YAML fixtures in the normal `test/fixtures' location.
This works, but now I have a bunch of seemingly...
I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call logger.error $! to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire trace back of an exception using the default rails logger?
...