Tuesday, August 21, 2007

acts_as_attachment error : undefined method `find_or_initialize_by_thumbnail_and_parent

You will possibly be seeing this error when you use acts_as_attachment for thumbnailing.

undefined method `find_or_initialize_by_thumbnail_and_parent'

Basically acts_as_attachment is trying to use dynamic finders ( Good article on that is here ) to find and create new object if it is not found. Developers use acts_a_attachment ( instead of attachument_fu; successor of acts_a_attachment works only Rails 1.2 onwards) because it works with older version of Rails (1.1.6) and when you execute thumbnailing you get above message and the reason the dynamic method find_or_initialize_by_thumbnail_and_parent that internally calls find_or_initialize which is available in Edge rails onwards and Rails 1.1.6 does not have that. So kinda defeats the purpose of using acts_a_attachment for Rails 1.1.6.

In any case don't be disappointed and here is the fix ,so you can use everything as it is. Go to your vendors/plugins/acts_as_attachment/lib/technoweenie/acts_as_attachment/instance_methods.rb and look for method find_or_initialize_thumbnail , you need to patch this method to make it work with Rails 1.1.6 ( basically find and create new object seperately)

Replace following

def find_or_initialize_thumbnail(file_name_suffix)
respond_to?(:parent_id) ?
thumbnail_class.find_or_initialize_by_thumbnail_and_parent_id(file_name_suffix.to_s, id) :



        def find_or_initialize_thumbnail(file_name_suffix)
respond_to?(:parent_id) ?
(file_name_suffix.to_s, id) ||
:parent_id=>id) :
This should do the trick.

Friday, August 17, 2007

Facebook micro application success trend started

Angel community was watching when Facebook platform launched and they were expecting plenty of applications to launch under Facebook umbrella rapidly and eventually some one will cash in the success in terms of user base. 

I guess exactly same thing happened to Where I have been. Here is the news ( TripAdvisor buys Facebook app for $3 million). This again proves few simple things about consumer space

  • User base, User base, User base
  • Data is more valuable than Technology
Now the race is on and applications will be more aggressive to pan out, attract more and more people. Facebook proved its platform strength after all. 

Thursday, August 16, 2007

Our first Ajuby meetup

Even though we have been in quite a few silicon valley ruby meetups with low key Ajuby push by dropping one page Ajuby brochure on the front door, We had our first formal Ajuby meetup today. It went well . Not everyone showed up who RSVP'd for the meetup, there were handfull.

We started with little introduction of Ajuby on how it started, why kind of slides. Then we dived right into high level features of our last release 0.5 ( which I blogged in a seperate post last time). As we were passing thru slides, audience were curious and questions about vision, business model and eventually couple of guys were interested in looking at actual code. I eventually opened Textmate and started walking everyone thru the Ajuby code base. I guess people were curious to know how different Ajuby is from conventional Rails application. Answer was simple, Ajuby is an Rails application with additional directories custom to Ajuby.

Whole take from this exercise was wonderful, curious eyes with valid questions, Discussions will possibly take feedback to feature path, we are helping ourselves and others.

We have a long way to go in this process, lot to learn, lot to provide to the community because we have got from community so much all these years.