So, another weird and frustrating thing happened to me while i was running my app's tests using rspec.
I got 1 failing spec showing the following error:
Spec::Mocks::MockExpectationError in 'FeedsController#get_recent_feeds gets the recent feeds for live deals'
#[Feed:0x3fa7ffc8de1c @name="Feed_1001"] received :all with unexpected arguments
expected: ({:include=>:feedable, :order=>"updated_at desc, feedable_type desc"})
got: ({:include=>:feedable, :order=>"updated_at desc, feedable_type desc"})
Showing posts with label Rails. Show all posts
Showing posts with label Rails. Show all posts
Tuesday, February 12, 2013
Monday, January 14, 2013
The not so famous before_remove/before_add & after_remove/after_add callbacks.
Well, this is another rails feature and a quite nice one which is not documented properly.
While using has_many :through associations, we can use before_remove, before_add, after_remove, after_add callbacks.
While using has_many :through associations, we can use before_remove, before_add, after_remove, after_add callbacks.
Thursday, December 20, 2012
Rails 2.3 after_create callback doesn't rollback even if returned false
So, this is another mind-boggling thing i came across yesterday. I am working on rails 2.3.11
So i had some after_create callbacks on my app's Order model.
The problem i faced was even when the callbacks would fail, the order was still created and the changes would't ROLLBACK!!
So i had some after_create callbacks on my app's Order model.
The problem i faced was even when the callbacks would fail, the order was still created and the changes would't ROLLBACK!!
Thursday, November 1, 2012
Unable to install gems when using gem version 1.8.24 on windows
So, i just upgraded my ruby to 1.9.3, and installed the latest gem version 1.8.4.
After installing DevKit and everything i tried to install rails on my system. I wrote
gem install rails
and after a second got this error
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SocketError: getaddrinfo: No such host is known. (http://rubygems.org/latest_specs.4.8.gz)
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: Possible alternatives: rails
Labels:
1.8.24,
gem,
gem-1.8.24,
gems,
getaddrinfo,
latest_specs,
proxy,
Rails,
socketerror
Thursday, October 11, 2012
Get value of an attribute before being type-casted by rails
There are times when we might need the value of an attribute before rails type-casting it.
Suppose obj is the object and attrib is the attribute whose value we need before ActiveRecord type-casted it, there's a method we can use to get the value of that attribute it was before being type-casted, which works as follows:
Suppose obj is the object and attrib is the attribute whose value we need before ActiveRecord type-casted it, there's a method we can use to get the value of that attribute it was before being type-casted, which works as follows:
Friday, October 5, 2012
Get non-https urls for images while using when storing images on Amazon S3, using Paperclip and Fog.
What you can do is, the hash where you specify the options for paperclip, how it connects to the S3 server, ie something like this
Subscribe to:
Posts (Atom)