All pastes #596820 Raw Edit

Stuff

public text v1 · immutable
#596820 ·published 2007-06-30 06:40 UTC
rendered paste body
<!--[form:registrar]-->
<fieldset>
	<ol>
		<li>
			<label for="registrar_registrar">Registrar</label>
			<%= text_field 'registrar', 'registrar'  %>
		</li>
		<li>
			<label for="address_address1">Address 1</label>
			<%= text_field 'address', 'address_line_1'  %>
		</li>
		<li>
			<label for="country">Country</label>
			<select name="address[country_id]">
			<% @countries.each do |country| %>
			<option value="<%= country.id %>"<%= ' selected' if country.id == @address.country_id %>>
			<%= country.country %>
			</option>
			<% end %>
			</select>
		</li>
	</ol>
</fieldset>
<!--[eoform:registrar]-->



  def new
    @registrar = Registrar.new
    @address = Address.new
    @countries = Country.find(:all)
  end

  def create
    @registrar = Registrar.new(params[:registrar])
    @registrar.created_by = session[:user_id]
    @address = @registrar.address.build(params[:address])
    if @registrar.save
      flash[:notice] = 'A Registrar was successfully created.'
      redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end