Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Emp Model
- class Emp < Profile
- has_one :emp_attributes_set
- has_many :text_buckets
- has_many :multimedia_buckets
- has_many :news_buckets
- has_many :rss_buckets
- def before_create
- emp_attributes_set = EmpAttributesSet.new
- end
- end
- ## Edit View
- <% if @profile.class==Emp %>
- <a href="profile-buckets.html"><h5>Buckets</h5></a>
- <a href="/emp_attributes_sets/edit/<%= @profile.emp_attributes_set.id %>"><h5>Edit Style</h5></a>
- <% end %>
- ## Profiles Controller
- def create
- @profile = Profile.new(params[:profile])
- @profile.type = params[:profile][:type]
- @profile.company_address = Address.new(params[:company_address])
- @profile.company_contact = Contact.new(params[:company_contact])
- @profile.agency_address = Address.new(params[:agency_address])
- @profile.agency_contact = Contact.new(params[:agency_contact])
- @profile.processing_contact = Contact.new(params[:processing_contact])
- @profile.membership_contact1 = Contact.new(params[:membership_contact1])
- @profile.membership_contact2 = Contact.new(params[:membership_contact2])
- @profile.billing_contact = Contact.new(params[:billing_contact])
- respond_to do |format|
- if @profile.save
- flash[:notice] = 'Profile was successfully created.'
- format.html { redirect_to(:action => "index") }
- format.xml { render :xml => @profile, :status => :created, :location => @profile }
- else
- format.html { render :action => "new" }
- format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }
- end
- end
- end
- ## Error
- Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
- Extracted source (around line #10):
- 7: <%= debug @profile.class==Emp %>
- 8: <% if @profile.class==Emp %>
- 9: <a href="profile-buckets.html"><h5>Buckets</h5></a>
- 10: <a href="/emp_attributes_sets/edit/<%= @profile.emp_attributes_set.id %>"><h5>Edit Style</h5></a>
- 11: <% end %>
- 12: <span class="clearfix"></span>
- 13: </p>
Add Comment
Please, Sign In to add comment