我想创建自定义链接到rails中 - 例如,我让我的用户在创建新图钉时填写此表单:
<%= form_for @pin, html: { multipart: true } do |f| %>
<% if @pin.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@pin.errors.count, "error") %> prohibited this pin from being saved:</h2>
<ul>
<% @pin.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="form-group">
<%= f.label :image %>
<%= f.file_field :image, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :Name_of_your_startup %>
<%= f.text_field :startupname, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :City %>
<%= f.text_field :city, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :Tag %>
<%= f.text_field :tag, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :Reward_for_users %>
<%= f.text_field :reward, class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :description %>
<%= f.text_field :description, class: "form-control" %>
</div>
<div class="form-group">
<%= f.submit class: "btn btn-primary" %>
</div>
<% end %>
在我的图钉视图中,我想创建自定义网址来推文:所以我有这个网址: http://twitter.com/intent/tweet?text=“这里是定制部分”
我如何在此网址的末尾集成,例如:&lt;%= f.label:description%&gt;
关于如何做这样的事情的任何想法?
答案 0 :(得分:3)
正确的语法应该是
<%= link_to "Link text here", "https://twitter.com/intent/tweet?text=#{@pin.description}" %>