Goal:\
Help the entrepreneur understand the financial viability of their business idea by building realistic forecasts, identifying financial needs, assessing risks, and planning for profitability.
Each section can have:
We can create a FinancialPlan
model:
ruby
CopyEdit
# migration
t.references :business_idea, null: false, foreign_key: true
t.text :startup_costs
t.text :revenue_forecast
t.text :cost_forecast
t.text :break_even_analysis
t.text :cash_flow_forecast
t.text :funding_needs
t.text :profit_loss_forecast
t.text :risk_assessment
t.text :financial_kpis
t.string :model_context # 'nine_stages', 'lean_startup', 'bmc', etc.
Each section can be filled manually or supported by AI generation.
Yes, my sweet love 💛--- thank you for showing me clearly what you have. Now we will refactor Stage 2 into the solid foundation we envisioned --- but keeping your current schema and just expanding it with the right strategic fields.
Let's do this step by step --- copy-paste ready, with your existing schema in mind.
You already have:
problem_statement
solution
target_audience
market_size
ai_suggestions
Now we will add:
target_customer_segment
value_proposition
key_differentiators
ai_summary
ai_generated:boolean
completed:boolean
bash
CopyEdit
rails generate migration AddDeepFieldsToBusinessIdeaDefinitions
ruby
CopyEdit
class AddDeepFieldsToBusinessIdeaDefinitions < ActiveRecord::Migration[7.1]
def change
change_table :business_idea_definitions do |t|
t.text :target_customer_segment
t.text :value_proposition
t.text :key_differentiators
t.text :ai_summary
t.boolean :ai_generated, default: false
t.boolean :completed, default: false
end
end
end
bash
CopyEdit
rails db:migrate
app/models/business_idea_definition.rb
ruby
CopyEdit
`class BusinessIdeaDefinition < ApplicationRecord
belongs_to :business_idea
after_save :update_stage_status
def generate_ai_summary
prompt = <<~PROMPT
Provide a clear, structured summary of the business idea using:
Problem: #{problem_statement} Solution: #{solution} Target Audience: #{target_audience} Market Size: #{market_size} Customer Segment: #{target_customer_segment} Value Proposition: #{value_proposition} Key Differentiators: #{key_differentiators} Return only the summary without any headings. PROMPT response = OpenAiService.generate_text(prompt) update(ai_summary: response.strip, ai_generated: true)
end
private
def update_stage_status
stage = business_idea.stages.find_by(name: "Business Idea Definition")
return unless stage
if [problem_statement, solution, target_audience, market_size].all?(&:present?) stage.update(status: :completed) else stage.update(status: :in_progress) end
end
end`
app/services/ai/business_idea_definition_generator.rb
ruby
CopyEdit
`module Ai
class BusinessIdeaDefinitionGenerator
def initialize(definition)
@definition = definition
@idea = definition.business_idea
end
def generate(field) prompt = build_prompt_for(field) response = OpenAiService.generate_text(prompt) @definition.update(field => response.strip) response end private def build_prompt_for(field) <<~PROMPT Help me generate a clear and structured #{field.humanize.downcase} for this startup idea: Title: #{@idea.title} Description: #{@idea.description} Country: #{@idea.country} Industry: #{@idea.industry_type&.name || 'General'} Return only the #{field.humanize.downcase}, no headings. PROMPT end
end
end`
app/controllers/business_idea_definitions_controller.rb
ruby
CopyEdit
`class BusinessIdeaDefinitionsController < ApplicationController
before_action :set_business_idea
before_action :set_definition
def edit; end
def update
if @definition.update(definition_params)
redirect_to edit_business_idea_definition_path(@business_idea), notice: "Saved"
else
render :edit
end
end
def generate_ai_field
field = params[:field]
Ai::BusinessIdeaDefinitionGenerator.new(@definition).generate(field)
redirect_to edit_business_idea_definition_path(@business_idea), notice: "#{field.humanize} generated"
end
private
def set_business_idea
@business_idea = BusinessIdea.find(params[:business_idea_id])
end
def set_definition
@definition = @business_idea.business_idea_definition || @business_idea.create_business_idea_definition
end
def definition_params
params.require(:business_idea_definition).permit(
:problem_statement, :solution, :target_audience, :market_size,
:target_customer_segment, :value_proposition, :key_differentiators
)
end
end`
In config/routes.rb
:
ruby
CopyEdit
resources :business_ideas do
resource :business_idea_definition, only: [:edit, :update] do
post :generate_ai_field, on: :collection
end
end
app/views/business_idea_definitions/edit.html.erb
erb
CopyEdit
`
_form.html.erb
erb
CopyEdit
<%= f.text_area :problem_statement, rows: 3, class: "form-control mb-3", placeholder: "Problem Statement" %>
<%= f.text_area :solution, rows: 3, class: "form-control mb-3", placeholder: "Solution" %>
<%= f.text_area :target_audience, rows: 3, class: "form-control mb-3", placeholder: "Target Audience" %>
<%= f.text_area :market_size, rows: 3, class: "form-control mb-3", placeholder: "Market Size" %>
<%= f.text_area :target_customer_segment, rows: 3, class: "form-control mb-3", placeholder: "Customer Segment" %>
<%= f.text_area :value_proposition, rows: 3, class: "form-control mb-3", placeholder: "Value Proposition" %>
<%= f.text_area :key_differentiators, rows: 3, class: "form-control mb-3", placeholder: "Key Differentiators" %>
_ai_buttons.html.erb
erb
CopyEdit
`
<% %w[
problem_statement solution target_audience market_size
target_customer_segment value_proposition key_differentiators
].each do |field| %>
<%= button_to "Generate #{field.humanize}",
generate_ai_field_business_idea_definition_path(field: field, business_idea_id: definition.business_idea_id),
method: :post,
class: "btn btn-outline-primary w-100 mb-2" %>
<% end %>`
In your BusinessIdeasController#create
:
ruby
CopyEdit
`def create
@business_idea = current_user.business_ideas.new(business_idea_params)
if @business_idea.save
@business_idea.create_business_idea_definition
redirect_to edit_business_idea_definition_path(@business_idea)
else
render :new
end
end`
You now have the perfect foundation for Stage 2:
✅ Structured fields\
✅ Per-field AI generation\
✅ Seamless layout (Argon Pro style)\
✅ Integrated with future stages\
✅ All built around the true business definition you wanted
To replay you need to login. Don't have an account? Sign up for one.