ruby-on-rails

ASP.NET MVC Version of Ruby on Rails "link_to_unless_current"

I want to include a link in my SiteMaster (using Html.ActionLink) UNLESS the view that I am linking to is the current view. For example, there is no sense displaying a "Register" link when the user is already seeing the "Register" view. In Ruby on Rails, I use the "link_to_unless_current" method to do this. How do I duplicate this beh...

How to create a finder condition that operates on the associated model

Assuming rails app has the following models song, play, radio_station: song has_many plays play has_many radio_stations radio_station has attribute "call_sign" I want to create one find for Song that would return for me the all songs where the last play (of the song) was played by a radio station of "WKRP" I could do found = [] Song....

Rails domain-based caching

Rails caches (file cache) per default domain-based, but is there a way to disable this? My rails app can be reached via multiple domains and the content is all the same. I just don't want to have multiple cache files. (I know memcache is better, this is not part of the question) ...

Feature differentiation: Rails / Django

Are there any important features in Rails or Django which do not exist in the other framework? Is there anything important missing - for an enterprise web app - in either one? This question is not intended to be argumentative - I am trying to make an informed technology decison for an upcoming project. Two of the concerns I ha...

Which has more job openings for programmers - Rails or Django?

Based on this trend chart from indeed.com, Rails vs Django job openings my impression is that Rails currently has more openings but that Django is gaining popularity. Does anyone have personal experience in the job market or additional data to support this idea? ...

What advantage does a Mac (computer) give to a Rails developer?

I'm trying to understand why so much Rails development happens on Macs? Or is this just a myth? Is there any hard evidence to back this up? ...

Cache-Money: Only use in Production?

I use the cache-money gem for transparent usage of Memcached. Using the supplied config file it is enabled on all modes (development, test, production). Is there a way to only activate cache-money in production mode? It's not immediately clear how to do this, and it's a total pain dealing with caching in development mode. ...

Is it fair to accuse Rails of "magic"?

When I first started looking into Rails and Django I was steered away from Rails by Django developers who felt that Rails was a black box which uses an excess of "magic" (leaky abstractions). Upon exploring Rails further I wonder whether this is an uninformed assumption based on not knowing how to achieve customization in Rails without t...

NoMethodError when trying to invoke helper method from Rails controller

I'm getting a NoMethodError when trying to access a method defined in one of my helper modules from one of my controller classes. My Rails application uses the helper class method with the :all symbol as shown below: class ApplicationController < ActionController::Base helper :all . . end My understanding is that this should mak...

Is this a reasonable approach for HTTP BASIC authentication with an API key?

I have just begun adding a REST API on a rails app, and since I only wanted to expose a couple controller/actions, I added a method to ApplicationController: def http_basic_authentication if request.format == Mime::XML authenticate_or_request_with_http_basic do |username, api_key| self.current_user = User.find(:first...

How to create a secure credit card gateway using paypal / ruby on rails / active merchant.

I am creating a store using Active Merchant and PayPal sandbox right now. It seems to be working fine, but I don't think it is even remotely secure. I don't really know too much about HTTPS and how to implement secure connections. I am currently passing the credit card and billing information in the session (probably not the smartest i...

Ruby On Rails: ActiveResource and file uploads.

Does anyone have experience with ActiveResource and file uploads? I have an Adobe Air desktop application which communicates with my Rails driven website's web services. I'd like to post files to the server but I'm not entirely sure if I could do this with ActiveResource. Also, I'm having some concerns since I've read somewhere that AR ...

Custom eCommerce Site - ASP.Net or PHP?

I currently have a very functional customised online ordering website written from scratch in ASP. This was built approx 4 years ago, and works exceptionally well. I need to build a similar one for another company. Do I simply upgrade and get a like product developed in ASP.Net 2.0, or do I need to do some homework on other options such...

How much should I charge for Rails programming?

I have been asked to quote an hourly rate for freelance programming for a Rails project. Although it would be my first paid project on Rails, I know the technology well from personal projects and have a decade of professional programming experience. This would be my first freelance project ever, so I have no idea how to find out what the...

A/B testing and stats solutions

I've been looking for a good testing framework for months, not finding anything, so I've just been building my own. This is what I want to do: - track arbitrary behaviors (e.g. # of photos viewed, # of comments posted) - track correlation between arbitrary variables and those behaviors (e.g, how do different versions of this prompt af...

What is the best rails example app?

What is the best available non-trivial example app for rails with uptodate source, test suite and adherence to best practices? [I am looking for an example of a full fledged application - with complex data models and advanced views that is worth looking at to see "how it is done" by others] ...

Is there a way to validate a specific attribute on an ActiveRecord without instantiating an object first?

For example, if I have a user model and I need to validate login only (which can happen when validating a form via ajax), it would be great if I use the same model validations defined in the User model without actually instantiating a User instance. So in the controller I'd be able to write code like User.valid_attribute?(:login, "logi...

Routing to new action (Rails)

Hi, I have an action in my PostsController named 'tagged', which I want to return all posts tagged with whatever term. In my routes.rb I have the following (at the top): map.connect 'posts/tagged/:tag', { :controller => 'posts', :action => 'tagged', :tag => /[a-z\-]+/ } Yet navigating to posts/tagged/yes returns a RecordNotFound err...

Acts_as_ferret use single index

Hi all, I have started to use acts_as_ferret to add text searching to an application. In my example app (another blog!) I have defined and index in my article as follows: acts_as_ferret :fields => [:title, :body] I'd like an option to search on a single field e.g. get me all article where the title contains "rails", rather than all a...

Rails Authorization error

I'm currenty trying to integrate the rails-authorization plugin into a rails application. I've followed through the installation and setup steps but each time I try to use the permit "role" or permit? "role" functions, I get an error thrown up along the lines of 'const missing, User#RolesUser' which doesn't appear to have any use ...