Re: [Rails] How would I model has_many and also mark one of the 'many' as special?

2013-01-17 Thread Emily S
class Person < ActiveRecord::Base attr_accessible :photo, :name has_many :photos, :as => :attachment, :dependent => :destroy # I would do this. This will save a portrait_id on a person object, which is the id of a photo. This is most efficient because if you put the "belongs_to" associ

[Rails] Re: STI, #update_attributes and validations.

2013-01-16 Thread Emily S
Why are you doing b = A.find("b-id") and not b = B.find("b-id") ? I think it would be better if you did b = B.find("b-id") c = b.becomes(C) try it in the console and verify that c.class is C then you should be able to do c.update_attributes(:attribute_x => 'present', :attribute_y => 'present')

Re: [Rails] update the index view ajax

2013-01-15 Thread Emily S
You might want to keep your eye out for Rails 4, in particular for what Aaron presents here: http://www.confreaks.com/videos/1291-rubyconf2012-real-time-salami -- start watching at 15:00, with a demo at 22:00 On Tuesday, January 15, 2013 3:38:21 AM UTC-5, Dheeraj Kumar wrote: > > You can run F