app/models/app.rb
# Copy app attributes from another app.
Copy app attributes from another app.
Copy app attributes from another app .
def copy_attributes_from(app_id)
    if copy_app = App.where(:_id => app_id).first
      (copy_app.fields.keys - %w(_id name created_at updated_at)).each do |k|
        self.send("#{k}=", copy_app.send(k))
      end
      %w(watchers issue_tracker).each do |relation|
        if obj = copy_app.send(relation)
          self.send("#{relation}=", obj.is_a?(Array) ? obj.map(&:clone) : obj.clone)
        end
      end
    end
  end
def copy_attributes_from ( app_id ) if copy_app = App . where ( :_id => app_id ) . first ( copy_app . fields . keys - %w( _id name created_at updated_at ) ) . each do | k | self . send ( "#{k}=" , copy_app . send ( k ) ) end %w( watchers issue_tracker ) . each do | relation | if obj = copy_app . send ( relation ) self . send ( "#{relation}=" , obj . is_a? ( Array ) ? obj . map ( & :clone ) : obj . clone ) end end end end
Copy app attributes from another app.
Copy app attributes from another app .
# Copy fields # Clone the embedded objects that can be changed via apps/edit (ignore errs & deploys, etc.)
app_id
<not_specific>