ruby-on-rails

How should I use https in Ruby on Rails

I'm developing an application in Rails (2.3.4) and there are some parts that need to run over a secure protocol, for example, the login form, the credit card form, etc. How can I do just these pages be https, and all other pages remain http? How can I test ssl in development environment? ...

Cucumber Table Diff and colspan

Hi guys, I love cucumber, and its table diff feature. But I, often use a td colspan to display the title of the table. And I can't seem to get the table diff to work when I use colspan. (Table diff expects a 2d array, and the colspan breaks it) Has anyone be able to get this to work. Thanks! Jonathan ...

Ruby charting library?

I need to display some charts/graphs based upon user inputs on my web aplication built using Ruby on Rails. Are there any charting libraries out there that I could use with ROR for displaying simple bar, line and pie graphs? ...

Rails RESTful Routes: override params[:id] or params[:model_id] defaults

Hello, I'm trying to understand how to change this rule directly on the map.resources: supposing I have a route: map.resource :user, :as => ':user', :shallow => true do |user| user.resources :docs, :shallow => true do |file| file.resources :specs end end so I would have RESTful routes like this: /:user/docs /docs/:i...

Get each value and position from a Text field to match ruby table_id

I have product that the product serial number equals product series, chip, model, manufacture, software, etc. Each of these has its own table with all the information I need in it. Each product serial number is 8 characters long. i.e. 1B43A672, 18GH8843. The second value determines how to map the serial number to which table. i.e. If ...

Adding Variables to AR Object

How can I add a variable to a set of objects returned by ActiveRecord? I've looked around and none of the methods I've seen seem to work. Thanks in advance! ...

Signup form using Braintree Transparent Redirect

Hi, I'm developing an application in Rails and want the user to be able to signup and provide their card details on one form. I'm using the Braintree API and their transparent redirect, which means that the form data is posted directly to Braintree. How can I store and later retrieve the non-payment related information provided by the ...

RoR: Basic foreign key question

I currently have a a simple lookup table. When I display an agency I would like to display the locality.name rather than the locality_id. The Locality.name is stored in the locality table. Just the id is stored in the agency table. Below shows the locality_id, I would like for it to show the locality_name instead. How do I do this? a...

functional test for Rails plugin, assert_template broken?

I'm writing a plugin that adds a class method to ActionController::Base, so in my functional test I am creating a simple controller to test against. The example below is totally stripped down to basically do nothing. The test succeeds all the way up to assert_template, which fails. require 'rubygems' require 'test/unit' require 'active_...

How do I get my OpenidController working in Ruby on Rails?

I'm getting this error: uninitialized constant OpenidsController I can't figure out why. I'm following this guide: http://www.danwebb.net/2007/2/27/the-no-shit-guide-to-supporting-openid-in-your-applications I used the following command to generate the controller: script/generate controller Openid new create complete And I hav...

Is there a big performance hit with using file_store for storing the cache as opposed to mem_cache_store?

I don't think I'm at the point where I need to go through and get memcached setup for my Rails app, but I would like to do some simple caching on a few things. Is using file_store for as the config.cache_store setting sufficient enough? Or will having to access files for data over and over kill the benefit of caching in the first place ...

expecting tASSOC in a Rails file

I'm sure I've done something stupid here, but I just can't see it. I call the breadcrumb method in the application view. app/helpers/breadcrumbs_helper.rb says: module BreadcrumbsHelper def breadcrumb @crumb_list = [] drominay_crumb_builder project_crumb_builder content_tag(:div, :id => "breadcrumbs", @crumb_list.ma...

Where did the div class=fieldWithError go?

I have the following simple form: <% form_for(@weight) do |f| %> <%= f.error_messages %> <%= f.label :weight %>: <%= f.text_field :weight, :size => 5 %> kg. <%= f.submit "Add weight" %> <%= f.error_message_on :weight %> <% end %> which displays a form of only one field: weight. Normally it renders like this: <form action="...

Total for Current Users Tags

I'm working on a RoR application that deals with users creating entries. These entries have a price, a boolean which signifies the entry as either an income or an expense, and via the acts_as_taggable_on plugin, tags. Users act_as_taggers, so I'm able to apply ownership to tags. I'm trying to find the users tag that has the highest sum ...

How can I make sure the Sphinx daemon runs?

I'm working on setting up a production server using CentOS 5.3, Apache, and Phusion Passenger (mod_rails). I have an app that uses the Sphinx search engine and the Thinking Sphinx gem. According to the Thinking Sphinx docs... If you actually want to search against the indexed data, then you’ll need Sphinx’s searchd daemon to be ...

Why does a rails app on heroku serve assets via all.css and locally via individual files

I'm a rails newbie, I've been trying to figure out what is going on with the stylesheets_link_tag on heroku. If I use = stylesheet_link_tag "style", :cache => true heroku uses "all.css" and does not pick up the stylesheet, but if I use = stylesheet_link_tag "style", :cache => false it serves the stylesheet using its name "style.c...

Regular expressions in a sql database

I have a database table with a column where every entry is a regular expression. For example, the rows in my table look like this: table: email_address_templates email_address: /*.google.com/ email_address: /*.reddit.com/ email_address: /*.ac.uk/ I want to be able to search through this table, and find if a particular string matches...

validates_presence_of causes after_initialize to be called with a weird self

I've had this model which was working fine: class Weight < ActiveRecord::Base belongs_to :user validates_presence_of :weight, :measured_on attr_accessible :weight, :measured_on def after_initialize self.measured_on ||= Date.today end end I added it this line validates_uniqueness_of :measured_on, :scope => :user_id an...

Facebook File Upload Using Ajax

Hi All Is it possible to upload file in facebook fbml (not iframe) using Ajax ? not a complicated one but just use simple input type="file" tag wrap in a form and post the from using facebook builtin ajax. If can, then how to accept it in server ? I'm using rails facebooker as my backend and paperclip plugin as my file upload system. T...

send email localhost

I'm developing rails on localhost and wondering what is the simplest way, in terms of workflow, of building email functionality in. So I figure: Get mail working on localhost. Then when I deploy on a production server just change the smtp settings. Is this a reasonable approach? Can you actually send email from localhost? Know of an...