railsgsoc/actionform

Roadmap draft

Opened this issue · 2 comments

kirs commented

Me and @m-Peter discussed some plans about the future of activeform.

Composite resources

Imagine the case when in user signup form user can enter company name and the company will be automatically created:

class UserWithCompanyForm > ActiveForm::Base
  self.main_model = :user

  attributes :email, :password, :company_name, presence: true

  def save
    if @model.save
      Company.create(owner_id: @model.id, name: company_name)
      true
    else
      false
    end
  end
end

Instead of code above, we could provide some API.

Support other ORMs than ActiveRecord

Probably Mongoid and/or MongoMapper.

Guide about Form Objects on guides.rubyonrails.org

@kirs I will try to implement an API for the "Composite Resources", will start searching and working on it now, hope you also check your email, as I did send you an email 😄

kirs commented

@wazery sure, you're welcome! You can also open new issue to discuss possible composite resources DSL.