好的,所以我正在努力使用我想用来发布推文到我的Twitter帐户的表单。 我正在使用gem'omniauth-twitter'和gem'twitter'。通过轨道中的表单发布推文
我的表单并未将其内容发送到位于products_controller.rb中的Twitter.update(),我找不到原因。
下面是从我index.html.erb
<%= form_tag do %>
<fieldset>
<legend>140 char limit</legend>
<div>
<label for="mytweet">mytweet:</label>
<%= text_field_tag :my_tweet, params[:my_tweet] %>
</div>
<div>
<%= submit_tag "tweet" %>
</div>
</fieldset>
<% end %>
代码我到目前为止...
从我products_controller.rb
def tweetfunc
if param[:tweet] != nil then
Twitter.update(param[:tweet])
else
#TODO display an error message
end
末
内我的routes.rb
controller :products do
post 'tweet' => :tweetfunc
end
....任何想法?
有什么问题? – 2012-01-14 03:34:20
我的表单不会将它的内容发送到位于products_controller.rb中的Twitter.update(),我无法弄清楚原因。 – thefonso 2012-01-14 13:16:27