ruby-on-rails

What library should I use to connect an iPhone app to a Ruby on Rails server?

I'm starting a new iPhone project and I want to get started off on the right foot. It's going to be talking to a Ruby on Rails server for some basic CRUD operations. I'd like to avoid dealing with URLs, HTTP requests and responses, and such. Are there any libraries out there that make this easier? ...

Model inheritance, the Factory pattern, and self-parsing in Ruby-on-Rails

Hi all- I am working with a site that will be pulling down feeds from a lot of different sources, and then saving those streams into a common model, in this case a trait. An example of the code from within the FeedEntry class might be: feed = Feedzirra::Feed.fetch_and_parse(feed_url) add_entries(feed.entries) ... def self.add_entrie...

Rails avoid writing attribute of nested object to log

How can I prevent a certain parameter of a nested relationship in rails from entering the log file - I am writing LARGE files to a column in the db and don't want rails to write that to the log file.. I know of filter_parameter_logging but it doesn't seem to work for nested models - I may just be putting in the wrong spot? ...

Support for multiple domains/subdomains in Rails

I have a Rails app that has a similar setup to Tumblr, that is, you can have either: (1) Subdomain hosting (your-username.myapp.com) (2) Domain hosting (your-username.com) Both would forward to a personalized website for that user, created with my application. How can I accomplish this in Rails? I have been able to get (1) working wit...

How do I render a .builder template in ruby on rails?

I am really confused about how to utilize builder templates in ruby on rails. I have some simple controller code: class ProductsController < ApplicationController def index @products = Product.all respond_to do |format| format.html # index.html.erb format.xml # index.builder end end end but this does no...

Nested forms and automatic creation of parent, children

Guys, I was wondering if it was possible to create new parent, children in a has many relationship, using rails nested forms. Rails documentation clearly says that this works in a one to one relationship. Not sure if its the same in has many relationship. For example: If params = { :employee => { :name => "Tester", :ac...

Why did mislav-will_paginate start adding so much garbage to urls between rails 2.3.2 and 2.3.5?

I've used will_paginate in a number of projects now, but when I moved one of them to Rails 2.3.5, clicking on any of the pagination links (page number, next, prev, etc.,) went from getting nice URLs like this: http://foo.com/user/1/date/2005_01_31/phone/555-6161 to this: http://foo.com/?options[]=user&amp;options[]=date&amp;options[]...

rails: how to solve that difficult query within rails

Hi everybody, I have a query for my Rails environment, which I don't really know how to solve...: I have users and products where any user owns multiple products: users m:n products I solved that with a sales table. for any product a user owns there is a more specific table sales 1:1 individualspecifications I need to get a...

Ruby On Rails - Collection Select - MYSQL Database - Problem Displaying ampersand ("&")

I am having an annoying problem displaying the labels of a select box correctly where there is an ampersand contained within the label string. On a form being rendered with the form_for helper the collection_select reads data from a Mysql 5.075 database the text stored in the database is "Surabaya & Surrounding Areas" when rendered and ...

Removing or overriding an ActiveRecord validation added by a superclass or mixin

I'm using Clearance for authentication in my Rails application. The Clearance::User mixin adds a couple of validations to my User model, but there's one of these that I would like to remove or override. What is the best way of doing this? The validation in question is validates_uniqueness_of :email, :case_sensitive => false which in...

How to avoid updating update_at flag while updating associated model in active record?

My association to models as follows People model belongs_to :category has_one :account, :through => :category category model belongs_to :account has_many :bookings account model has_many :categories Level model accepts_nested_attributes :peoples I wrote @level.update_attributes(params[:level]) in Le...

Ruby geoip_city on Windows

Is there a way to get geoip_city, the Ruby gem, running on Windows? ...

Cache problems when updating an object from another model

I have a problem with making changes to an object from within another model as well as within the object's model. I have the following models: class Foo < ActiveRecord::Base has_many :bars def do_something self.value -= 1 # Complicated code doing other things to this Foo bars[0].do_other save! end end class Bar...

Rails 3.0 beta send_file issues

Have you any one try sending file to client_side send_file(url),send_file("#{Rails.root}/public/images/rails.png",:type => "image/png") it gives an error for any file which i am sending Proc:0xb74e606c@/home...../gems/actionpack-3.0.0.beta/lib/action_controller/metal/streaming.rb:95 as simple ...

rails build method for complex model with days of the week

I have a set of nested models for storing prices for individual rooms. Ie. Places Rooms Room_rates Each model has the necessary accepts_nested_attributes_for and has_many belongs_to association and I have a form and a build method which works perfectly for the initial creation. My question is how to make a smarter contro...

Can a Rake task on Heroku time out?

I'm using Heroku and would like to have a script (on another server) called via cron that periodically requests an action on my Heroku app. This action will in turn run some processing that may take 1 or 2 minutes to complete. I believe Heroku has 30 second request limit, I was thinking could call a Rake task from my controller action ...

Using activeResource without Rails

Hi i'm developing a rails application that expose some methods via activeResource. I want to access these resources through a simple remote ruby script. I want to know if it's possible use activeResource without Rails ...

rails vim syntax highlighting

Please excuse my naivety, I come from a world of Textmate but have decided to give vim rails a shot. I cannot get my syntax highlighting to work, I'm sure this is probably my setup but I am not vim savvy in knowing how to fix this. Commands like :Rfind etc. are working. Anyone care to give me some pointers? ...

What are your crowdsource translation management system recommendations?

I'm looking for a tool to help with crowdsourcing the translations for a web site. Some generous translators have volunteered to help so I want to provide them with a tool to use that will make their job as easy as possible. Ideally the tool/app will be free or have only a small charge. Ideally I'd like a translation system that makes ...

Database design for summarized data

I have a new table I'm going to add to a bunch of other summarized data, basically to take some of the load off by calculating weekly avgs. My question is whether I would be better off with one model over the other. One model with days of the week as a column with an additional column for price or another model as a series of fields ...