Imagine a model structure as follows:
models/cross_sell_promotion.rb
class CrossSellPromotion < Promotion
has_and_belongs_to_many :afflicted_products, :join_table => :promotion_afflicted_products, :foreign_key => 'promotion_id', :association_foreign_key => 'product_id', :class_name => 'Product'
has_and_belongs_to_...
Hi... most of my apps have a lot to do with web services and often due to the third party site, I get timeout issues.
This is the error that I get:
execution expired
/usr/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill'
How do I rescue this kind of error in a rails app?
...
Hey Guys,
I am currently having issues uploading files to amazon S3 while using paperclip. It uploads half the files, and then chokes, with the error: IOError (closed stream) I have no idea what's causing this, any help would be really appreciated.
Here's the stack trace:
/opt/local/lib/ruby/gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/conne...
Hello,
I have the following hash table:
COUNTRIES = {
'France' => 'FR',
'German' => 'GE',
'United Kingdom' => 'UK'
}
I have it in my model and use it in my views so the countries are displayed as a select box. Now I have one view where I want all those values plus one more value "Europe" => 'EU' to be shown.
Meaning I wou...
Hi,
I am currently working on a rails application in which the user upload a video file on the server, after what I send it to S3 where it's encoded by another service.
The thing is that before uploading it to S3 I need to know the quality of this file, the resolution, the bitrate, ...
I saw that the rvideo gem can do that but I'd lik...
I'm trying to make a named route 'have_many' other named routes here. But the way I'm doing it's not working.
Here is my problem:
I've several game platforms that I want to access by /:platform_name/. This is working:
map.platform ':platform_name',
:controller => :platforms,
:action => :index,
...
I followed all the steps given in this blog. When i am trying to point my browser to the "/login" I get the following exception
undefined method `set_facebook_session' for #<SessionsController:0x15b0618>
I tried searching in lot of forums but couldn't find the solution. Even if i comment out the use of set_facebook_session i get the f...
In ruby, if muliple HTTP request comes for single action/method then how ruby handles each and every request?
I don't know exactly, I heard that java uses multi thread concept. Is ruby uses the same or anything else? If it uses to create process for every request then this thing eat the cpu process.
...
I'm learning to use vlad the deployer and I've got a question.
Since I'm still learning I don't know what is pertinent to the question and what isn't, so please bear with me if I'm a little verbose.
I've got 2 environments for a new application (test and production) besides my development machine.
I've figured out this way to do the i...
Hi folks,
I have a simple many-to-many E-R described as below:
Model order.rb:
class Order < ActiveRecord::Base
has_many :cronologies
has_many :statuses, :through => :cronologies
end
Model cronology.rb:
class Cronology < ActiveRecord::Base
belongs_to :order
belongs_to :status
validates_uniqueness_of :order_id, :scope => :...
Hi,
I'm trying to replace different parts of a html code using a single regexp.
For exemple i have this text :
option_!!NID!! [somme_text][5] some_text_option 5_option_some_text
using this regexp:
content.replace(/(!!NID!!)|\[(\d)\]|(\d)_option/g, 1))
I expect to get :
option_1 [somme_text][1] some_text_option 1_option_some_text
...
Hello, I've started this question http://stackoverflow.com/questions/2370882/named-route-with-nested-resources, and it lead me to this new one.
I've a named route defined in my routes:
map.game ':platform_name/:game_name',
:controller => :games,
:action => :index,
:platform_name => /pc|...
Ok so I'm trying to get Refinerycms working with Heroku, and I'm new at all of this. I've set up an amazon s3 account and added keys and ids to the amazon_s3.yml files.
When launched on Heroku at gart.heroku.com I get the following error:
App failed to start
/disk1/home/slugs/141557_e8490b3_d5eb/mnt/vendor/plugins/attachment_fu/lib/t...
Hi,
I'd like to move some small app databases to a cloud hosting provider. Basically, I'd like to not have to manage databases myself. I've been looking at Amazon RDS and MongoHQ, which are great, but are bit expensive.
Are there any other alternatives other than setting up my own VPS?
Thanks.
Jim-
...
Hi,
I recently had a look at the awesome Blue Ridge Javascript testing framework to test javascript on my rails app. But i was wondering if anyone knew how to test the javascript view files in rails?
The Blue Ridge framework(as far as i could understand) lets you test only the javascript files. But I wanted to test my "js.erb" files w...
Hi Everyone,
I'm currently building a web application in Rails. I'm using Authlogic to handle normal authentication. I'm using facebooker to handle facebook connect on the external site and to authenticate users within the facebook canvas application.
I'm having trouble building simple, coherent current_user functionality. Currently I ...
Hi, I'm working with mechanize and having problems with inheritance when testing in a rails environment, using script/console.
When I write like this:
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
agent.get 'http://www.google.com'
Everything works fine. But when I try to create a subclass of WWW::Mechanize like ...
Hi all,
I am developing a web app (using rails) that I will be launching within a week. I've "jumped the gun" and started working on the iPhone app for the site (I'm new to iPhone development). Using the peepcode iPhone screencasts and the expense/budget demo app from clarkware I've been able to get things going (using ObjectiveResource...
Rails has no way of creating foreign keys in migrations (there are plugins to do this, however). There are also plenty of cascading options so you can get cascading deletes, for example.
With all of these options built in, is it worth creating foreign keys in the database? Is this something Rails developers normally avoid or what? You'd...
I'm new to the twitter API http://apiwiki.twitter.com/Twitter-API-Documentation and I would like to incentivize users on my website to follow me, or re-tweet me by giving them extra privileges on my site if they do. In order to do this, I need some type of confirmation after they have followed me, or retweeted, etc. Is this possible, or ...