ruby-on-rails

Output text with hyperlinks

If you have text coming from a database such as: "New Apple TV Offers 8 GB of Internal Storage, 256 MB RAM http://t.co/fQ7rquF" Is there a helper method that takes that text and wraps the web address as a anchor tag? ...

My class constants are nil in the 'test' environment

In a class called 'Quality' I have the following constants defined: class Quality < ActiveRecord::Base [validations excluded in this example] NEW = Quality.find_by_name("New") LGT = Quality.find_by_name("Light use") MED = Quality.find_by_name("Medium use") HVY = Quality.find_by_name("Heavy use") SCR = Quality.find_by_name(...

how can i add fb_multi_friend_selector, Facebooker2

Hi i want to add to my app multi-friend-selector. I found a method in helpers: fb_multi_friend_selector. Am i supposed to do just: <%= fb_multi_friend_selector("Test message") %> Because it is not working for me. My user is authenticated in my app. I can see all of my fb friends names(with current_facebook_user.friends)...etc. S...

JSpec vs Jasmine vs QUnit for javascript and jQuery testing in Rails

I am looking for a unit testing framework to use with javascript that integrates well with Rails 3.0 Anyone with experience with above frameworks can share their experience? ** UPDATE: JSpec is now discontinued as per their Github repository: http://github.com/visionmedia/jspec so this leaves Jasmine and QUnit ...

Does anybody have a Ruby on rails plugin test_helper.rb to share ??

I'm thinking to something better than what you can find on the railsguides : - something which initialize a plugin specific minimalistic rails 3 app, not to launch the main project the plugin belongs to - something which handles fixtures caching as AR tests does thanks in advance ! ...

IE tries to save Ajax response as file

Using Rails RJS with jQuery, I have a link with an event binding on click that does ajax call with GET and returning dataType: script (with RJS providing the response). Works the first time in Explorer, but after that, when you click the link, it tries to save the response as a file.... Any ideas how to get around this? Only a problem...

[rails3] comments not saving post_id

Im running into a small (newbie) problem. I've got 2 models: question & reviews. Reviews schema: question_id, user_id, rating, comments On the 'show' view, i've integrated the following form (formtastic): - semantic_form_for @question.reviews.build do |f| = f.error_messages = f.input :rating = f.input :comments = f...

Vim or Emacs for Rails development... any advantages?

Getting ready to try out vim or emacs for rails development. Does one of these support rails development any better than the other? This is on windows if that matters. Edit I'm not looking for reasons why or why not to use vim or emacs and I don't want opinions on which is a better editor. I mainly just want to know if one or the ot...

Rails: Is the Problem compatibility of Project 1.8.7 to 1.9.2 or Mongrel/Thin

I followed a starter tutorial for Rails 2 and created a project with Ruby 1.8.7 and it works with it. Unfortunatly, the project doesn't work as expected with Ruby 1.9.2 and gives errors. I'm not sure if Mongrel/webrick is the problem which seems not to work flawless with Ruby 1.9.2 or is it a problem with my code which doesn't suite 1.9....

How does StackOverflow implement its revision history?

If I were to implement a system identical to the StackOverflow question revision history using Ruby on Rails, what would I need to do in order to achieve that? I am creating a site that acts like a wiki where user contributed content can be updated by other people. I need to be able to track the history of these changes, but I am not fam...

How to Monkey Patch in Ruby on Rails?

Lets use a real world example. I want to monkey patch WillPaginate::LinkRenderer.to_html method. So far I have tried: Created a file in folder: lib/monkeys/will_paginate_nohtml.rb Added in config/environments.rb: require 'monkeys/will_paginate_nohtml' at the end of the file Inside that file, this was my code: e module Monkeys::W...

Change Rails controller name

Let's say I have a controller and model called Car/Cars in Rails. Then I wanna change it to Vehicle/Vehicles. How to I achieve that? ...

MissingTranslationData - How do you set the TranslationData?

When posting from the has_calendar plugin, there is a request for the TranslationData. I'm not sure what this is, or how to set it (or where to set it). Here's the error it's spitting out. translation missing: en, date, formats, day_of_week Is there somewhere I need to set the locale for the calendar? The plugin doesn't give any inst...

Why doesn't @event.users.size work?

Trying to get to total number of users for a given event and I'm thinking what I've got should work, but I get the following: Could not find the source association(s) :squads_users in model Squad. Try 'has_many :users, :through => :squads, :source => '. Is it one of :team, :event, :event_division, :users, :point_adjustments, :checkpoi...

update_all through an association

I am trying to use update_all through an association, and i am getting mysql errors, anyone know why please? class Basket < ActiveRecord::Base has_many :basket_items has_many :articles, :through => :basket_items def activate_articles articles.update_all :active => true end end class BasketItem < ActiveRecord::Base belong...

Rails app to relay email to exchang 2007

We have developer who using rails to develop intranet for us using rails. This intranet will able to trigger email and email will relay throguh our in house exchange. Currently developer have issue at sending mail portion. They use: address = smtp.ourdomain.com user_name = sis (Windows Active Directory) password = password domain = ...

Rails 3 my custom BufferedLogger

I would like to define a custom logger for my Rails 3 app, in a way that it does not replace the original logger (I still make use of its information). I assumed that I could define in a lib a class that inherited BufferedLogger as I've seen on some blogs. Then I would instantiate a variable to represent my logger, on the end of my appl...

Can I add file size to Builder XML output

I'm working on a ruby on rails app that generates a large XML document using a builder template, but I've hit a bit of a stumbling point. The XML output must have a field that contains the file size in bytes. I think that I'll basically need to use the value that would populate the "Content-Length" header in the http response, but updat...

How to break rails models into modules?

Possible Duplicate: Model Using Modules in Rails Application I have a User model that is getting really fat and I want to break it up into submodules that correspond to the different interactions such as a user's interaction with friendships, interaction with events, interaction with weapons, etc. etc. What's the best way to g...

where to put custom install, e.g. rails g myapp:install

I've seen people use this to install apps: rails g someapp:install This is a custom generation correct? Where is the code to :install usually put or have to be put? ...