ruby-on-rails

Maintaining page breaks

In my Rails app, I have a lot of data that is declared as text in the migration file. But when I print these attributes/fields out in the view, all the line breaks are lost and I get one large chunk of text. How do I maintain the line breaks? ...

Testing controller with rspec, factorygirl and restful authentication

Hi there. I'm still new to rails and testing with rspec, so hopefully you can help me. I have a controller which requires login. I use the restful authentication function of rails. To create things in tests I'm using the factory framework factorygirl. Ok the problem is the following: I want to test a controller (authentication requ...

What are the coolest Ruby on Rails features, why choose it?

Before I asked this question I had a look through the search results for 'Ruby on Rails' here on SO. Couldn't find much, but the following (found on this page) amused me Personally, I started using .html, moved onto php, tried ruby (hated it), discovered Python / DJango.. and have been happy ever since. Now here's the deal. I have ...

CMS type app for creating HTML emails?

For a new SaaS app that I'm working on, I want the end user to be able to create "promotions" which they can send to their customers; they will be able to do this via direct (snail) mail, e-mail, or SMS text message. Typically these promotions will be HTML email messages with lots of pretty graphics and whatnot. I don't expect my use...

How do you write a functional / controller test to check for content added via an AJAX call?

Test def test_generateCashFlowStmt get :getDateRangeForCashFlowStmt xhr :post, :generate_cash_flow_stmt, {:fromDate => {:year=>"2009", :month => "3", :day=>"1"}, :toDate => {:year=>"2009", :month => "3", :day=>"31"} } table = [ .... ] assert_equal table, formatCashFlowStatementAsTable( assigns(...

Torn Between learning PHP [insert framework here] and Ruby on Rails

Here's my situation: I'm an ASP.NET Developer first and foremost. That's not going to change anytime soon. I have built my small business on it. With that being said, I'm looking to add other technologies to my arsenal. Not just for learning purposes, but to one day be able to offer clients an alternative solution. For this reason, ...

Is it Me or Are Rails and Django Difficult to Install on Windows?

I tried getting these frameworks working on Windows Vista for a couple of days but to no avail. Every single time I thought I had them working I would get some random error involving the PostgreSQL or MySQL setup, or the paths were screwed up or some other command line error "not recognized as an internal or external command" (or somet...

Mega dropdown lists

I want to make a megadrop down like the one used in Rails gudes site (http://guides.rubyonrails.org/) or the ones used in BaseCamp.CAn they be done using the Rails form helpers?? ...

Authlogic and acts_as_authentic problem

We am using authlogic for my user authentication.It works on other machines but i am getting the error Extracted source (around line #20): 7: <%= link_to "Home", "/", :title => 'Home', :class => 'header-logo' %> 18: 19: 20: <span style="padding-left:850px;"> <% if current_user %> 21: <%= link_to "My Accoun...

Asscociate action to on_change for form.select in Rails???

the following is my dropdown to select chat rooms: <% form_for :chat_room do |form| %> <%= form.select(:title, @chat_rooms.collect! {|x| x.title},{:include_blank =>'select a chat room'}) %> <% end %> My routes are: ActionController::Routing::Routes.draw do |map| map.resource :account, :controller => "users" map...

Validating a finite state machine (using AASM) on Rails.

I'm using AASM by Rubyist to build a 4-step wizard for an AR object. According to the state of the object, there are different validations that need to be done. What is the smartest way to validate an object according to it's state on a certain transition? ...

Message Queues in Ruby on Rails

What message queues are people using for their Rails apps and what was the driving force behind the decision to choose it. Does the latest Twitter publicity over their in house queue Starling falling down affect any existing design decisions. I am working on an app that will need a message queue to process some background tasks, I haven...

Connecting to SQL Server with ActiveRecord

Have you ever had to connect to SQL Server with ActiveRecord? Is this possible? Can anyone provide some starting points? ...

Time Zone Weirdness in Rails

This is a really weird Rails problem - I have googled to see if this is related to a known bug, but haven't found anything - would be gratfeul for useful links as well as solutions. I can boil the problem down to this: If I start up my Rails App, and execute the following Rails code via an HTTP request. Time.zone = 'Europe/London' log...

ActiveRecord conditions Error

Hi, I have this: SectionHistory.find(:all, :conditions => ["id=? and (name!=? or code!=?)", sec.id, sec.name, sec.code]) And I get the error "The character "!" following "and (name!=? or code" is not valid" if my condition string is just "id=? and (name!=?)" it's OK We're using DB2. Any suggestions on this? Thanks ...

Whats the best method of creating "walled gardens" for multiple clients inside your database?

I'm setting up a SaaS style website wherein I will have multiple clients all managing their workflows and data on the same site -- and thus the same database. I'm not even sure if there is a word for this concept, but is there any established way of auto-segregating the data so that any ActiveRecord calls to the database are filtered/re...

Testing Ruby Gems under Rails

I'm creating some gems that can be used within Rails controllers and views. I'd like to be able to test the gems independently. But I've not been able to figure out how to create an instance of Rails inside the gem to test that the gem will work inside a Rails app. I strongly prefer to use RSpec, but could probably adapt a Test::Unit so...

Is there an analogue to Rails partials in VB .NET?

I'm new to VB .NET, and if possible, I'd like something like Rails partials - bits of HTML template that can be referenced in a page's script, possibly within a loop. I know there might not be anything like that. ...

Best Way of Having End User Specify Sort Order in Rails

I am looking for a suggestion on the best way of having an end user from a Rails application's view files set the sort order of a result set returned by a model's "find" method. In other words I would like a user to be able to choose their sort order from a selection list. Initially, I thought I could just put the string that I would p...

how do I make the URL's in Ruby on Rails SEO friendly knowing a @vendor.name?

My application is in RoR I have an action/view called showsummary where the ID has been passed into the URL, and the controller has used that to instantiate @vendor where @vendor.name is the name of a company. I would like the URL to be, rather than showsummary/1/ to have /vendor-name in the URL instead. How do I do that? ...