我有一个: has_and_belongs_to_many :friends, :join_table => "friends_peoples".
要添加我做的朋友:@people.followers << @friend创建关系和新人员个人资料.
现在我想删除关系,而不是个人资料.
我尝试了@people.friends.delete(guilty.id)但删除了个人资料而不是关系.
任何的想法?
我很惊讶Rails的创造者没有想到这一点,如果有人可以提供帮助,那就太好了.
我们怎样才能改变这个:
<%= link_to "My Title", :controller => "products" %>
Run Code Online (Sandbox Code Playgroud)
这个自动:
<%= link_to "My Title", :controller => "products", :title => "My Title" #basically a copy of the text %>
Run Code Online (Sandbox Code Playgroud)
我认为它可以帮助SEO很多.
非常感谢!
亚历克斯
我有一个非常奇怪的错误.在我的代码中我有<%= time_ago_in_words(game.created_at) %>
它在本地和我的登台服务器上工作,但不在我的生产服务器上:
示例:http://hockey-community.com/games/show/45
我得到" in {{count}} days."
奇怪的是,如果返回的数字是1,它可以工作.(例如:)1 hour ago or 1 day ago.
任何想法都会非常有帮助.THKS
OS X 10.9附带ruby 2.0.0p195,但我需要安装Ruby 1.8.7.我一直遇到错误.我有Xcode5-DP安装,我相信也安装了命令行工具.
在终端:
sudo rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10/x86_64/ruby-1.8.7-p371.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date.
Installing Ruby from source to: /Users/alextoul/.rvm/rubies/ruby-1.8.7-p371, this may take a while depending on your cpu(s)...
ruby-1.8.7-p371 - #downloading ruby-1.8.7-p371, this may take a while depending …Run Code Online (Sandbox Code Playgroud) 我在类似Facebook的社交网络上工作,需要从Instagram链接中提取mp4.
对于照片很简单: url_shared =" http://instagram.com/p/a69ygTTHKq/ "photo_to_embed = url_shared +"?size = t"
你知道类似的东西找到与mp4的直接链接吗?我尝试使用他们的API并将扩展名从".jpg"更改为".mp4",但由于它不能一直工作而失败.
例如:http:
//api.instagram.com/oembed?url = http://instagram.com/p/bCgbJ2pgCi/返回
{
provider_url: "http://instagram.com/",
media_id: "487094313204187298_9762431",
title: "So did you download our "Hockey Community" app yet? If you like hockey even just a bit you should do it now!!'",
url: "http://distilleryimage2.ak.instagram.com/d79af376deb011e2922a22000a1fdc29_7.jpg",
author_name: "hockeycommunity",
height: 612,
width: 612,
version: "1.0",
author_url: "http://instagram.com/hockeycommunity",
author_id: 9762431,
type: "photo",
provider_name: "Instagram"
}
data.url =" http://distilleryimage2.ak.instagram.com/d79af376deb011e2922a22000a1fdc29_ 7.jpg ",视频链接实际上是" http://distilleryimage2.ak.instagram.com/d79af376deb011e2922a22000a1fdc29_ 101.mp4 "
只有文件名的末尾发生变化,但无法弄清楚规则是什么......
资源:
我正在寻找一个我们可以在循环中使用的函数来执行此操作:
<% for rink in @rinks_in_region %>
<%= rink.city #Show Only if city (n-1) != n %>
<%= link_to_rink(rink.name+" Ice Rink",rink) %>
<br>
<% end -%>
Run Code Online (Sandbox Code Playgroud)
基本上只有当它与前一个城市不同时才显示该城市.
合理?谢谢你的帮助!
Alextoul