Ruby on rails RubyonRails:编辑表单而不保存新数据
我有一个允许用户创建新项目的页面。他们可以选择从链接到表列的下拉菜单中进行选择,以防他们正在查找的选项已经存在于数据库中,以及另一个可以输入新数据的选项,即当提交项目时,该字段的新数据将保存到数据库中供下一个人使用 这是“新建/编辑项目”视图的一部分:Ruby on rails RubyonRails:编辑表单而不保存新数据,ruby-on-rails,ruby,database,drop-down-menu,Ruby On Rails,Ruby,Database,Drop Down Menu,我有一个允许用户创建新项目的页面。他们可以选择从链接到表列的下拉菜单中进行选择,以防他们正在查找的选项已经存在于数据库中,以及另一个可以输入新数据的选项,即当提交项目时,该字段的新数据将保存到数据库中供下一个人使用 这是“新建/编辑项目”视图的一部分: <div class="client"> <%= label_tag :new_client, "Client" %><br/> <%= text_field_tag :new_client, nil,
<div class="client">
<%= label_tag :new_client, "Client" %><br/>
<%= text_field_tag :new_client, nil, :maxlength => 30 %>
Or
<%= f.select( :client, Project.all.map {|p| [p.client]}.uniq, :prompt => "Select a previous Client") %>
</div>
编辑视图:
<h1>Editing project</h1>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<%= stylesheet_link_tag "form" %>
<%= form_for(@project) do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@project.errors.count, "error") %> prohibited this project from being saved:</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<BODY LANG="en-GB" TEXT="#000000" DIR="LTR">
<P LANG="en-US" CLASS="western" ALIGN=RIGHT STYLE="margin-bottom: 0in">
<BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<div class ="padding">
</div>
<CENTER>
<TABLE WIDTH=624 CELLPADDING=2 CELLSPACING=0 >
<COL WIDTH=283>
<COL WIDTH=20>
<COL WIDTH=152>
<COL WIDTH=138>
<COL WIDTH=9>
<THEAD>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=29 BGCOLOR="#999999" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H1 LANG="en-US" CLASS="western"><FONT COLOR="#003366"><FONT SIZE=4>
<div id = "project_name">
<div class="project_name">
<%= f.label :project_name %> :
<%= f.text_field :project_name,:maxlength => 30 %>
</div>
</div>
</FONT></FONT></H1>
</TD>
</TR>
</THEAD>
<TBODY>
<TR>
<TD COLSPAN=2 WIDTH=307 HEIGHT=15 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western" ALIGN=LEFT>Database id:</H2>
</TD>
<TD COLSPAN=3 WIDTH=307 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western" ALIGN=LEFT>
<div id ="smallbox">
<div id = "status">
<div class="status">
<%= f.label :status %> :
<%#= f.select :status, [['Active'],['Completed']], {:include_blank => true} %>
<%= f.select :status, [['Active'],['Completed']] %>
</div></div>
</H2>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><B>
<div class="client">
<%= label_tag :new_client, "Client" %><br/>
<%= text_field_tag :new_client, nil,:maxlength => 30 %>
Or
<%= f.select( :client, Project.all.map {|p| [p.client]}.uniq, :prompt => "Select a previous Client") %>
</div>
</B>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=2 WIDTH=307 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><B>
<div class="business_div">
<%= label_tag :new_business_div, "Business Division" %><br/>
<%= text_field_tag :new_business_div, nil,:maxlength => 30%>
Or
<%= f.select( :business_div, Project.all.map {|p| [p.business_div]}.uniq, :prompt => "Select Business Division") %>
</div>
</B>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
<TD COLSPAN=3 WIDTH=307 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><B>
<div class="project_owner">
<%= label_tag :new_project_owner, "Project Owner" %><br/>
<%= text_field_tag :new_project_owner, nil,:maxlength => 30 %>
Or
<%= f.select( :project_owner, Project.all.map {|p| [p.project_owner]}.uniq, :prompt => "Select a previous Project Owner") %>
</div>
</B></P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
</TR>
<TR>
<TD WIDTH=283 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
<div class="start_date">
<%= f.label :start_date %> :
<%= f.text_field :start_date, :class => 'datepicker', :style => 'width: 80px;' %>
</div>
</P>
</TD>
<TD COLSPAN=2 WIDTH=176 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Entry Created by:<br> <%= @project.first_name %> <%= @project.last_name %>
<%= f.hidden_field :first_name, :value => @project.first_name %>
<%= f.hidden_field :last_name, :value => @project.last_name %>
</P>
</TD>
<TD COLSPAN=2 WIDTH=151 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Entry date: <br> <%= l DateTime.now.to_date %>
</P>
</TD>
</TR>
<TR>
<TD WIDTH=283 HEIGHT=13 VALIGN=TOP BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
<div class="end_date">
<%= f.label :end_date %> :
<%= f.text_field :end_date, :class => 'datepicker', :style => 'width: 80px;' %>
</div>
</P>
</TD>
<TD COLSPAN=2 WIDTH=176 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Last Edited by: <br> <%= @project.edited_first_name %> <%= @project.edited_last_name %></P>
<%= f.hidden_field :edited_first_name, :value => current_user.firstname %>
<%= f.hidden_field :edited_last_name, :value => current_user.lastname %>
</TD>
<TD COLSPAN=2 WIDTH=151 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Edited date: <br>
<% if !(@project.edited_date.blank?) %>
<%= l @project.edited_date %>
<% end %>
<%= f.hidden_field :edited_date, :value => DateTime.now.to_date %>
</P>
</TD>
</TR>
<TR>
<TD WIDTH=283 HEIGHT=13 VALIGN=TOP BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="tech">
<%= label_tag :new_tech, "Technologies Used :" %><br/>
<%= text_field_tag :new_tech, nil,:maxlength => 30 %>
Or
<%= f.select( :tech, Project.all.map {|p| [p.tech]}.uniq, :prompt => "Select a previous Technology") %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
<TD COLSPAN=2 WIDTH=176 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="role">
<%= label_tag :new_role, "Role" %><br/>
<%= text_field_tag :new_role, nil,:maxlength => 30%>
Or
<%= f.select( :role, Project.all.map {|p| [p.role]}.uniq, :prompt => "Select a previous role") %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
<TD COLSPAN=2 WIDTH=151 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="industry">
<%= label_tag :new_industry, "Industry:" %><br/>
<%= text_field_tag :new_industry, nil,:maxlength => 30%>
Or
<%= f.select( :industry, Project.all.map {|p| [p.industry]}.uniq, :prompt => "Select an industry") %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=15 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western">
Summary Of Assignment:
</H2>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<div class="summary">
<%= f.label :summary %><br />
<%= f.text_area :summary, :style => 'width: 500px;' 'height: 100px;' %>
</div>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=15 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western">Additional Informaton</H2>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="lessons_learned">
<%= f.label :lessons_learned %><br />
<%= f.text_area :lessons_learned, :style => 'width: 500px;' 'height: 100px;' %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD COLSPAN=5 WIDTH=618 HEIGHT=67 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
<div class="customer_benifits">
<%= f.label :customer_benifits %><br />
<%= f.text_area :customer_benifits,:style => 'width: 500px;' 'height: 100px;' %>
</div>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="financials">
<%= label_tag :financials, "Financial Responsibility:" %><br />
<%= f.select :financials, [['£0 - £99,999'],['£100,000 - £249,999'],['£250,000 - £499,999 '],['£500,000 - £999,999 '],['£1,000,000 +']], :prompt => "Select" %>
</div>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<div class="keywords">
Any other searchable keywords and tags?<br />
<%= f.text_field :keywords %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=14 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western"><A NAME="_GoBack"></A></H2>
</TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</BODY>
</HTML>
<div class="create_button">
<div class="actions">
<%= f.submit "Save Edit", :class => "button", :confirm => "Are you sure you want to save the edit?" %>
</div>
</div>
</div> <%#= small div %>
<% end %>
<%#= button_to 'Show', @project, :class => "button" %>
<%#= button_to "Back", projects_path , :class => "button", :method => "get" %>
编辑项目
禁止保存此项目:
:
30 %>
数据库id:
:
真}%>
30 %>
或
“选择以前的客户端”)%%>
30%>
或
“选择业务部门”)%%>
30 %>
或
“选择以前的项目所有者”)%%>
:
'日期选择器',:style=>'宽度:80px;'%>
创建人:
@project.first\u name%>
@project.last_name%>
参赛日期:
:
'日期选择器',:style=>'宽度:80px;'%>
最后编辑人:
当前_user.firstname%>
当前\u user.lastname%>
编辑日期:
DateTime.now.to_date%>
30 %>
或
“选择以前的技术”)%%>
30%>
或
“选择以前的角色”)%%>
30%>
或
“选择一个行业”)%%>
任务摘要:
'宽度:500px;'高度:100px;'%>
补充资料
'宽度:500px;'高度:100px;'%>
'宽度:500px;'高度:100px;'%>
“选择”%>
还有其他可搜索的关键字和标签吗?
<h1>Editing project</h1>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<%= stylesheet_link_tag "form" %>
<%= form_for(@project) do |f| %>
<% if @project.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@project.errors.count, "error") %> prohibited this project from being saved:</h2>
<ul>
<% @project.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<BODY LANG="en-GB" TEXT="#000000" DIR="LTR">
<P LANG="en-US" CLASS="western" ALIGN=RIGHT STYLE="margin-bottom: 0in">
<BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<div class ="padding">
</div>
<CENTER>
<TABLE WIDTH=624 CELLPADDING=2 CELLSPACING=0 >
<COL WIDTH=283>
<COL WIDTH=20>
<COL WIDTH=152>
<COL WIDTH=138>
<COL WIDTH=9>
<THEAD>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=29 BGCOLOR="#999999" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H1 LANG="en-US" CLASS="western"><FONT COLOR="#003366"><FONT SIZE=4>
<div id = "project_name">
<div class="project_name">
<%= f.label :project_name %> :
<%= f.text_field :project_name,:maxlength => 30 %>
</div>
</div>
</FONT></FONT></H1>
</TD>
</TR>
</THEAD>
<TBODY>
<TR>
<TD COLSPAN=2 WIDTH=307 HEIGHT=15 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western" ALIGN=LEFT>Database id:</H2>
</TD>
<TD COLSPAN=3 WIDTH=307 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western" ALIGN=LEFT>
<div id ="smallbox">
<div id = "status">
<div class="status">
<%= f.label :status %> :
<%#= f.select :status, [['Active'],['Completed']], {:include_blank => true} %>
<%= f.select :status, [['Active'],['Completed']] %>
</div></div>
</H2>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><B>
<div class="client">
<%= label_tag :new_client, "Client" %><br/>
<%= text_field_tag :new_client, nil,:maxlength => 30 %>
Or
<%= f.select( :client, Project.all.map {|p| [p.client]}.uniq, :prompt => "Select a previous Client") %>
</div>
</B>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=2 WIDTH=307 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><B>
<div class="business_div">
<%= label_tag :new_business_div, "Business Division" %><br/>
<%= text_field_tag :new_business_div, nil,:maxlength => 30%>
Or
<%= f.select( :business_div, Project.all.map {|p| [p.business_div]}.uniq, :prompt => "Select Business Division") %>
</div>
</B>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
<TD COLSPAN=3 WIDTH=307 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><B>
<div class="project_owner">
<%= label_tag :new_project_owner, "Project Owner" %><br/>
<%= text_field_tag :new_project_owner, nil,:maxlength => 30 %>
Or
<%= f.select( :project_owner, Project.all.map {|p| [p.project_owner]}.uniq, :prompt => "Select a previous Project Owner") %>
</div>
</B></P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
</TR>
<TR>
<TD WIDTH=283 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
<div class="start_date">
<%= f.label :start_date %> :
<%= f.text_field :start_date, :class => 'datepicker', :style => 'width: 80px;' %>
</div>
</P>
</TD>
<TD COLSPAN=2 WIDTH=176 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Entry Created by:<br> <%= @project.first_name %> <%= @project.last_name %>
<%= f.hidden_field :first_name, :value => @project.first_name %>
<%= f.hidden_field :last_name, :value => @project.last_name %>
</P>
</TD>
<TD COLSPAN=2 WIDTH=151 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Entry date: <br> <%= l DateTime.now.to_date %>
</P>
</TD>
</TR>
<TR>
<TD WIDTH=283 HEIGHT=13 VALIGN=TOP BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
<div class="end_date">
<%= f.label :end_date %> :
<%= f.text_field :end_date, :class => 'datepicker', :style => 'width: 80px;' %>
</div>
</P>
</TD>
<TD COLSPAN=2 WIDTH=176 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Last Edited by: <br> <%= @project.edited_first_name %> <%= @project.edited_last_name %></P>
<%= f.hidden_field :edited_first_name, :value => current_user.firstname %>
<%= f.hidden_field :edited_last_name, :value => current_user.lastname %>
</TD>
<TD COLSPAN=2 WIDTH=151 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
Edited date: <br>
<% if !(@project.edited_date.blank?) %>
<%= l @project.edited_date %>
<% end %>
<%= f.hidden_field :edited_date, :value => DateTime.now.to_date %>
</P>
</TD>
</TR>
<TR>
<TD WIDTH=283 HEIGHT=13 VALIGN=TOP BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="tech">
<%= label_tag :new_tech, "Technologies Used :" %><br/>
<%= text_field_tag :new_tech, nil,:maxlength => 30 %>
Or
<%= f.select( :tech, Project.all.map {|p| [p.tech]}.uniq, :prompt => "Select a previous Technology") %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
<TD COLSPAN=2 WIDTH=176 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="role">
<%= label_tag :new_role, "Role" %><br/>
<%= text_field_tag :new_role, nil,:maxlength => 30%>
Or
<%= f.select( :role, Project.all.map {|p| [p.role]}.uniq, :prompt => "Select a previous role") %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
<TD COLSPAN=2 WIDTH=151 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="industry">
<%= label_tag :new_industry, "Industry:" %><br/>
<%= text_field_tag :new_industry, nil,:maxlength => 30%>
Or
<%= f.select( :industry, Project.all.map {|p| [p.industry]}.uniq, :prompt => "Select an industry") %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<P LANG="en-US" CLASS="western"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=15 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western">
Summary Of Assignment:
</H2>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<div class="summary">
<%= f.label :summary %><br />
<%= f.text_area :summary, :style => 'width: 500px;' 'height: 100px;' %>
</div>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=15 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western">Additional Informaton</H2>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="lessons_learned">
<%= f.label :lessons_learned %><br />
<%= f.text_area :lessons_learned, :style => 'width: 500px;' 'height: 100px;' %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD COLSPAN=5 WIDTH=618 HEIGHT=67 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western">
<div class="customer_benifits">
<%= f.label :customer_benifits %><br />
<%= f.text_area :customer_benifits,:style => 'width: 500px;' 'height: 100px;' %>
</div>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=13 BGCOLOR="#ffffff" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in">
<div class="financials">
<%= label_tag :financials, "Financial Responsibility:" %><br />
<%= f.select :financials, [['£0 - £99,999'],['£100,000 - £249,999'],['£250,000 - £499,999 '],['£500,000 - £999,999 '],['£1,000,000 +']], :prompt => "Select" %>
</div>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
<div class="keywords">
Any other searchable keywords and tags?<br />
<%= f.text_field :keywords %>
</div>
</P>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 WIDTH=618 HEIGHT=14 BGCOLOR="#e6e6e6" STYLE="border: 1px solid #00000a; padding: 0.02in 0.06in">
<H2 LANG="en-US" CLASS="western"><A NAME="_GoBack"></A></H2>
</TD>
</TR>
</TBODY>
</TABLE>
</CENTER>
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0in"><BR>
</P>
</BODY>
</HTML>
<div class="create_button">
<div class="actions">
<%= f.submit "Save Edit", :class => "button", :confirm => "Are you sure you want to save the edit?" %>
</div>
</div>
</div> <%#= small div %>
<% end %>
<%#= button_to 'Show', @project, :class => "button" %>
<%#= button_to "Back", projects_path , :class => "button", :method => "get" %>
class Project < Activerecord::Base
#your code here
attr_accessor :new_client
before_save :assign_new_client
def assign_new_client
if @new_client
self.client = @new_client
@new_client = nil
end
end
end
f.text_field_tag