splitting up data for input (multiple controllers one model?

hi,

I have a model detailing companies and i would like to split up the data
entry into different views.

for instance company profile, contact etc.

so they can create a company then edit the various field using different
views. I assumed the best way to do this is create a controller for
each view?

I have tried this with profile but i get no joy, it won't update the
records attributes but throws no errors, it does populate the fields
with existing data in the edit view so edit action is correct.

here's my code

have tried error_messages_for to :profile or :company but i get no
errors

#views/profiles/edit.html.erb
<%= error_messages_for :profile %>

<% form_for :profile do |f| %>

<p><label for="profile">Profile</label><br/>
<%= f.text_area :profile, :cols =>"80", :rows => "20" %></p>

<p><%= f.submit 'Update' %></p>
<% end %>

class ProfilesController < ApplicationController
  before_filter :login_required

  # GET /profiless/1/edit
  def edit
    @profile = Company.find(@current_company.id)
  end

  # PUT /profiles/1
  # PUT /profiles/1.xml
  def update
    @profile = Company.find(params[:id])

    respond_to do |format|
      if @profile.update_attributes(params[:company])
        flash[:notice] = 'profile was successfully updated.'
        format.html { redirect_to(@profile) }
        format.xml { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml { render :xml => @profile.errors, :status =>
:unprocessable_entity }
      end
    end
  end

cheers
Nathan

      if @profile.update_attributes(params[:company])

ps this line should read :profile not :company. still doesn't work
though :slight_smile:

here's my code

have tried error_messages_for to :profile or :company but i get no
errors

#views/profiles/edit.html.erb
<%= error_messages_for :profile %>

<% form_for :profile do |f| %>

<p><label for="profile">Profile</label><br/>
<%= f.text_area :profile, :cols =>"80", :rows => "20" %></p>

This implies the data will be in params[:profile]

     if @profile.update_attributes(params[:company])

but here you're using params[:company]

Fred

here's my code

have tried error_messages_for to :profile or :company but i get no
errors

#views/profiles/edit.html.erb
<%= error_messages_for :profile %>

<% form_for :profile do |f| %>

<p><label for="profile">Profile</label><br/>
<%= f.text_area :profile, :cols =>"80", :rows => "20" %></p>

This implies the data will be in params[:profile]

    if @profile.update_attributes(params[:company])

but here you're using params[:company]

Oops, hadn't read your second mail :slight_smile:

Sorry