ruby-on-rails

Temporal data with Rails / Active Record

I'm looking for ideas/information about managing temporal data with Active Record (Rails). One example would be the emplyoment history (working 100% in january, but only 80% from february up to now). This proably would be easy to tackle with a traditional 'has-many :eployment_parts'. But there's another case where the user can plan somet...

Model from existing table in Rails 2

Hi! I have a database with tables. I want to create a model in my Rails app from existing table. As i know, such functionality is available, and is done as follows: script/generate scaffold model_name --skip-migration Of course, i defined my database in database.yml file. Scaffold generated for me a model with controller and views. My...

Bulk Actions on Rails Restful Resources

I am trying to implement a bulk update feature in a Rails app, the model I want to update is a restful resource. I need to display a table where each row is a single resource and has a check box. The user can check as many boxes as they like and then chose an action to perform on all of the selected resources, eg delete, change status et...

Adding sample data to database using rake for a rails engine

Hi, I am trying out Rails engines by creating a classifieds engine where users can view/post/reply to classifieds. The main application contains code for user authentication and profiles while there is an engine which I have created which will deal with the classifieds functionality. Now I want to add some sample data to the datab...

Recommendation on development framework for a browser based online product catalogue?

I have to develop a online product catalog which will eventually developed into a simple online ordering system, I have never developed a web application before. Please recommend an application framework which might be a good choice for this kind of apps. Is Ruby on Rails a good choice? Thanks. ...

How to support backwards compatibility with the changes to the Accept header handling in Rails 2.3.4

In Rails 2.3.4, the way Accept headers are handled has changed: http://github.com/rails/rails/commit/1310231c15742bf7d99e2f143d88b383c32782d3 We won't Accept it The way in which Rails handles incoming Accept headers has been updated. This was primarily due to the fact that web browsers do not always seem to know what they want ...

Invalid date notation: nil! Adyen Rails Gem Error

Hi, I'm looking to integrate my rails application with the payment provider Adyen, I've installed the Adyen Gem and put the code in to make a basic form, but I'm getting an error: Adyen Gem: http://github.com/wvanbergen/adyen Invalid date notation: nil! /Users/chris/.gem/ruby/1.8/gems/adyen-0.1.5/lib/adyen/formatter.rb:10:in ...

Why do so many Ruby on Rails apps have missing trailing slashes?

Why do so many Ruby on Rails apps have missing trailing slashes in their URLs? One example is http://basecamphq.com/tour. AFAIK this goes against Web standards. Is it something to do with the way RoR is set up? ...

script/console output in a tabular fashion like railscast

In railscast when Ryan uses script/console he gets the output in a nicely formatted tabular fashion. Does anyone know what gem does that magic for you? ...

Rake stats and Cucumber

Hello, I'm using Cucumber with RSpec in a Rails project. When I use the "rake stats" task, I get the following : +----------------------+-------+-------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+-------+-------+---------+---------+-----+-------+...

Does Rails 2.3.4 by default hinder exceptions related to gems in development mode?

I have an app that I run in three different environments, so sometimes when I pull it from github, I'll get the default rails "Oops, there was a problem with the server" page instead of the stack trace page. This seems to only happen when there's a problem related to a gem. I remember maybe 6 months or a year ago when developing, if I h...

Best approach for an internationalised payment gateway implementation

I'm looking to integrate a payment gateway into a Ruby on Rails applicaton. Although i have already implemented one before im struggling to see how i can implement one which will cater for different countries. For example, if it was only a UK based app i could use a UK vendor (e.g CardStream), if it was only a US app i could use a US ve...

Bulk User Creation in Rails - good use of delayed_job?

In the administration panel for my rails application I want to give the administrator the ability to create several users at one time (in the hundreds range). Would this be a good use for delayed_job? ...

Is there some sort of Master Page functionality in Ruby on Rails?

I've been a .Net developer for the past seven years or so, and been working with ASP.Net for the last couple of years. I'm now using Ruby on Rails for some projects, and I'm wanting to know if there is something in Ruby on Rails that lets you do master page type stuff? Basically, I want a way to provide a consistent look and feel for th...

What is the best file upload/attachment plugin rails?

What are the pros and cons between PaperClip and Attachment_fu ? Are there any other plugins that would you recommend ? Is possible to support multiple file uploads and progress feedback on upload using these plugins and Passenger + Apache ...

Updating a 2-dimensional form

Hey guys. I'm new-ish to rails development and have hit a bit of a wall. The application I'm working on is a scheduling solution that requires updating a join model, but not in a simple 1:1 sort of way. The app is laid out as follows: class Route < ActiveRecord::Base has_many :markers, :foreign_key => 'source_id' has_many :schedu...

How to output text in rthml without <%=variable%>

I've been looking around for a solution to this question for the last couple of days. It's a simple annoyance, but I hate not knowing how to do things... Environment: Ruby, Rails, rhtml The Problem: When I iterate a collection in rhtml I would like to reduce the number of <% %> and <%= %> tags I use. The following seems bloated: Exa...

Single resource and multiple resources

I have a model Whitelabel and a User has_many :whitelables I have a custom method current_whitelabel (like authlogic or restful_auth for current_user) I want my users to manage their whitelabels (ie: edit_whitelabels_path(id)). But I don't want to send the whitelabel ID in params when it refers to the current_whitelabel. So my idea ...

Correct coding convention for embedded code on web page templates.

I had come experience with PHP a time ago and now I'm learning to use Ruby on Rails. But one simple question bothered me in both these languages, so I think I can cross-post it to both tags. As you know, one of the concepts there is that one can embed PHP or Ruby code into web page template. Then these statements are executed and resu...

Auditing and model lifecycle management for instances and their associations?

I am trying to write an application to track legal case requests. The main model is Case, which has_many Subjects, Keywords, Notes, and Evidences (which, in turn, has_many CustodyLogs). Since the application is legal-related, there are some requirements that are out of the ordinary: CRUD operations must be logged, including what the ...