Sha256: 4c46f8784103e9835605f07b2ca57f580a00144df8efab4f7eae88a046e1bd33

Contents?: true

Size: 366 Bytes

Versions: 2

Compression:

Stored size: 366 Bytes

Contents

class ActiveRecord::Base
  def self.acts_as_asker
    has_many :questions, :as => :asker, :dependent => :destroy

    if respond_to? :attr_accessible # Rails 3.2 backwards compatibility
      attr_accessible :questions_attributes
    end
    accepts_nested_attributes_for :questions, :allow_destroy=>true, :reject_if=>lambda{|attrs| attrs['name'].blank? }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ask-0.5.4 lib/ask/acts_as_asker.rb
ask-0.5.3 lib/ask/acts_as_asker.rb