我有一个以下格式的字符串:
TEXT####TEXT####SPECIALTEXT
我需要得到SPECIALTEXT,基本上是在第二次出现之后####.我做不到.谢谢
我被卡住了.我有以下模型:个人资料,用户,工作.
用户有一个配置文件,配置文件有很多工作.
class Profile < ActiveRecord::Base
belongs_to :user
has_many :jobs
attr_accessible :user_id, :first_name, :last_name, :headline,:jobs_attributes
accepts_nested_attributes_for :jobs, allow_destroy: true
end
class User < ActiveRecord::Base
has_one :profile
attr_accessible :username,:email, :password,:profile_attributes
accepts_nested_attributes_for :profile, allow_destroy: true
end
class Job < ActiveRecord::Base
belongs_to :profile
belongs_to :country
attr_accessible :company, :country_id, :end_date, :job_title, :profile_id, :start_date
end
Run Code Online (Sandbox Code Playgroud)
现在,我希望用户能够编辑他的个人资料并将作业添加到他的个人资料中.为此,我使用了以下代码:
<%= f.fields_for :jobs do |j| %>
<%= j.label :job_title, "Job Title" %>
<%= j.text_field :job_title %>
<%= j.label :company, "Company" %>
<%= j.text_field :company %>
............................
<% end %> …Run Code Online (Sandbox Code Playgroud)