ruby-on-rails

Is it possible to use partials with the layout option inside of a controller?

When try I following code in a controller, the view renders without using the layout def xyz render :partial => 'platinum_home', :layout => 'platinum_layout' end But If I do the following inside the partial <% render(:layout => "platinum_layout") do %> blah blah blah <% end %> It works just fine, is the first example not ...

Date Select in Rails

Hello, I want to use an input field and beside the input field should be displayed an date select field in which the user can choose the date and this date will then be filled in the input field. Do you know an easy solution without using prototype? Thanks for your help, Matthias ...

ruby request.query_string

Hey ,Guys! I want to use the method request.query_string to send the key-value to the controller,how can i use in the sentences; =link_to 'excel' , reports_excel_path(:format => 'xls',:from => 'conversations') Thank you! ...

Apache rails beta site access solution

I'm building an ror site and have been asked by to put a temporary access restriction on it. All that's needed is a general access restriction to be used by beta users. The site is deployed on an apache server (on a mac) using passenger. I'm wondering what solutions there are? ...

Best mailing list solution for a conference and its 400 participants?

Update: I still haven't found any easy and good enough solution for mailinglists. We encourage an active community, signup should be dead simple and archives must be easily accessible. Dear community, what would you recommend for mailling lists? The conference is non-profit, named Smidig2010 (=Agile2010 in norwegian), will have about 4...

locale based sorting function in ruby

For my application(Ruby on Rails) i have country select box for the signup page. These countries are localized into different language. But i couldnt find a way to sort them, based on the language in which its localized. At present i have sorted it out based on english only. Is there a way to sort the country names based on the locale? i...

CSRF protection and cross site form access

Hi. I aw working on cross site authentication (some domains have got common authentication). So I want to send authentication data (login, password) to main domain from others. How should I use protect_from_forgery and how can I check if data received from valid domain? What I am thinking now is to turn off protect_from_forgery for se...

globalize2 - create_translation_table! and options for columns

Hi, could you tell me please - how to use method create_translation_table! of globalize2 with additional options such as :null => false, :default => "abc" ??? ...

How would I go about letting a user add and associate a comma separated list of categories while adding an entry?

I've been struggling for quite a while to get this feature working: I want my user to be able to select categories when uploading a photograph, but additionally be able to specify a comma-separated list of categories to create/find and associate with the photograph. I've had this working by using an attr_accessor :new_categories on the ...

has_and_belongs_to_many vs has_many through

Please explain the difference between has_and_belongs_to_many and has_many through relationship. When and where to use which one? ...

Thinking Sphinx, complex sorting - how can I combine extended sort with expr sort?

I want to sort by expression, then by some attribute ascending, then by another attribute ascending. Something like this: :order => "(a < some constant) desc, b asc, c asc". How to get it? Extended sorting refuses to work because of <. Expr fails because of commas. I have managed to produce sorting equivalent to :order => "(a < some co...

Wrong route generation using namespace

Hi people! I am building an administration space in my web application. To do this, I am using namespaces but even if the rake generated routes are ok, when i follow the root of my admin space I get an error: Routing Error No route matches "/guru" My routes.rb : Baies::Application.routes.draw do |map| resources :fights resources...

Using ActiveRecord caching library in Heroku

Hi all, I'm studying how to use caching in Heroku for my Rails app. HTTP cache powered by Varnish is superb and I'll use it in all pages without user info but I also want to use a kind of ActiveRecord caching with Memcached using "high livel" plugins such as cache_fu or cache-money...but it seems that Heroku supports only the memcached g...

Cucumber-rails on jruby installs gem into my apps root directory with bundler

Just installed cucumber 0.7.2 and cucumber-rails 0.3.1 with jruby-1.4.0 on OSX. When I run a bundle install, it places a cucumber-rails directory in my main app with all of the gem code/dependencies. First off, this is definitely not what I want and I'm not sure why this happens for cucumber-rails only. Second, if I delete this folde...

Heroku and i18n Problems

I'm having trouble getting i18n to work on heroku. I set: I18n.default_locale = :de in my environment.rb and the translation is in config/locales/de.yml works perfect on my local machines but not so on Heroku. On heroku everything is in english. I don't think I need a special gem like i18n gem, cause I don't have it on my local ma...

Extracting email addresses in an html block in ruby/rails

I am creating a parser that wards off against spamming and harvesting of emails from a block of text that comes from tinyMCE (so it may or may not have html tags in it) I've tried regexes and so far this has been successful: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i problem is, i need to ignore all email addresses with mailto hre...

How to use a nested form for multiple models in one form?

I'm struggling to come up with the proper way to design a form that will allow me to input data for two different models. The form is for an 'Incident', which has the following relationships: belongs_to :customer belongs_to :user has_one :incident_status has_many :incident_note...

rake db:migrate fails when trying to do inserts

I'm trying to get a database populate so I can begin working on a project. This project is already built and I'm being brought in to help with front-end work. Problem is I can't get rake db:migrate to do any inserts. Every time I run rake db:migrate I get this: == 20081220084043 CreateTimeDimension: migrating ========================...

increase cache period for Rails DB queries

Hi. Is it possible to increase the caching period of all Rails DB queries? In my case API calls can live with a bigger (mem)cache expiry time. -- M. ...

Capistrano error while deploying to slicehost

Hi, im trying to deploy an application in slicehost using capistrano. I can log in via SSH using the same credentials, however when I try to deploy it i get the following error: executing `deploy' executing `deploy:update' ** transaction: start executing `deploy:update_code' updating the cached checkout on all servers executing locally...