我想将Nesta CMS应用程序“安装”到Rails3应用程序上。这可能是因为Nesta是Sinatra应用程序,应该是可在机架上安装的图层,但是……您将如何做呢?您将从哪里开始?有人对此主题有经验吗?建议的文档?
blogs rack sinatra content-management-system ruby-on-rails-3
以下
我明白了 ArgumentError (Unknown region: "EU_Ireland")
更新:我实际上在上一版本中使用雾(不是aws-s3):
lsoave@ubuntu:~/rails/heroku/ennefoto$ egrep "fog|aws" Gemfile
# gem 'aws-s3', :require => 'aws/s3'
gem 'fog'
lsoave@ubuntu:~/rails/heroku/ennefoto$ egrep "fog|aws" Gemfile.lock
fog (0.8.2)
fog
lsoave@ubuntu:~/rails/heroku/ennefoto$
Run Code Online (Sandbox Code Playgroud)
...无论如何使用标准BUCKET(美国)它的工作原理.这似乎与'aws/s3'发生了同样的问题......
任何的想法 ?
有人知道区域语法是什么样的吗?我试过EU_Ireland,爱尔兰,欧洲爱尔兰......但这也是同样的错误.
ruby-on-rails heroku amazon-s3 content-management-system refinerycms
Twitter Bootstrap侧边栏的默认配置是左侧.我怎么能在右边移动它?
更新:似乎可以在下一个版本中使用:https://github.com/twitter/bootstrap/issues/333
我在Rails 3.1上嵌入了一对多模型的mongoid 到全文搜索.我最近在heroku上部署了一些非常简单易用的东西,而不必为附加组件付费.
目前所有的heroku全文搜索附加组件,似乎只是付费计划(开始时没有好处),请参阅Flying Sphinx和Websolr.
我需要建议一个好的解决方案(可以部署在heroku上的ruby gem)来开始,而不是最终扩展到其他云服务.
我有一个用户模型嵌入" 一对多 "的关注列表,如下所示:
class User
include Mongoid::Document
field :uid
field :name
field :user_hash
embeds_many :watchlists
end
class Watchlist
include Mongoid::Document
field :html_url
field :description
#field :name
field :fork_, :type => Boolean
field :forks, :type => Integer
field :watchers, :type => Integer
field :created_at, :type => DateTime
field :pushed_at, :type => DateTime
field :avatar_url
embedded_in :user
has_and_belongs_to_many :tags
end
Run Code Online (Sandbox Code Playgroud)
监视列表还应引用多对多 Tag模型,反之亦然:
class Tag
include Mongoid::Document
field :name, type: String
has_and_belongs_to_many :watchlists
end
Run Code Online (Sandbox Code Playgroud)
无论如何,这导致了一个错误,似乎不可能出现这种"混合"关系:
Mongoid::Errors::MixedRelations (Referencing a(n) Watchlist document from the …Run Code Online (Sandbox Code Playgroud) 我正在进行golang之旅并进行最后一次练习,以便将Web爬虫更改为并行爬行而不是重复爬行(http://tour.golang.org/#73).我所改变的只是爬行功能.
var used = make(map[string]bool)
func Crawl(url string, depth int, fetcher Fetcher) {
if depth <= 0 {
return
}
body, urls, err := fetcher.Fetch(url)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("\nfound: %s %q\n\n", url, body)
for _,u := range urls {
if used[u] == false {
used[u] = true
Crawl(u, depth-1, fetcher)
}
}
return
}
Run Code Online (Sandbox Code Playgroud)
为了使它并发,我在函数Crawl的调用之前添加了go命令,但是不是递归地调用Crawl函数,程序只找到" http://golang.org/ "页面而没有其他页面.
当我将go命令添加到函数Crawl的调用时,为什么程序不能正常工作?
我需要获取我的Github repo的README内容,然后我去了' Get the README'API V3,但它是编码base64:
{
"name": "README.rdoc",
"path": "README.rdoc",
"sha": "d21b593aedfa49030478ead89c4ac991268c75c0",
"size": 4939,
"url": "https://api.github.com/repos/lgs/paymill-on-rails/contents/README.rdoc?ref=master",
"html_url": "https://github.com/lgs/paymill-on-rails/blob/master/README.rdoc",
"git_url": "https://api.github.com/repos/lgs/paymill-on-rails/git/blobs/d21b593aedfa49030478ead89c4ac991268c75c0",
"type": "file",
"content": "PT0gUGF5bWlsbCBvbiBSYWlscyA0LjAuMCAKClBheW1pbGwgc3Vic2NyaXB0\naW9ucyBvbiBSYWlscyA0LjAuMCBhbmQgcnVieS0yLjAuMC1wMjQ3LCB7ZGVw\nbG95ZWQgb24gSGVyb2t1fVtodHRwczovL3BheW1pbGwtb24tcmFpbHMuaGVy\nb2t1YXBwLmNvbV0uIFRoaXMgaXMgYmFzZWQgb24ge01hcmMgQi4nc31baHR0
...
...,
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/lgs/paymill-on-rails/contents/README.rdoc?ref=master",
"git": "https://api.github.com/repos/lgs/paymill-on-rails/git/blobs/d21b593aedfa49030478ead89c4ac991268c75c0",
"html": "https://github.com/lgs/paymill-on-rails/blob/master/README.rdoc"
}
}
Run Code Online (Sandbox Code Playgroud)
以明文形式(不是base64编码)获取/转换"内容":"PT0gUGF5bWlsbCBv ..."的方法是什么?
更新(仅用于跟踪目的):
Linuxios所支持的解决方案也很好地在Ruby的Octokit API包装器中实现如下:
Octokit.contents 'lgs/paymill-on-rails', :path => 'README.rdoc', :accept => 'application/vnd.github.html'
Run Code Online (Sandbox Code Playgroud)
得到整个HTML和
Octokit.contents 'lgs/paymill-on-rails', :path => 'README.rdoc', :accept => 'application/vnd.github.V3.raw'
Run Code Online (Sandbox Code Playgroud)
如果你只想要干净的原始内容:
2.0.0p247 :001 > require 'octokit'
=> true
2.0.0p247 :002 > Octokit.contents 'lgs/paymill-on-rails', :path …Run Code Online (Sandbox Code Playgroud) 我将舒适的墨西哥沙发CMS与我的Rails 3.0.9应用程序集成在一起,omniauth 0.2.6.
博客方面的一切都很好.我可以登录cms-admin,使用管理控制台,发帖和注销(cms-admin有自己的身份验证系统,不同于我的应用程序...),而不是我可以浏览新帖子.
问题是我的应用程序的其余部分,使用omniauth对用户进行身份验证,当我注销/打开时,我收到以下错误:
Started GET "/auth/github" for 127.0.0.1 at 2011-07-25 21:04:46 +0200
Processing by CmsContentController#render_html as HTML
Parameters: {"cms_path"=>"auth/github"}
SQL (0.3ms) SELECT COUNT(*) FROM "cms_sites"
Cms::Site Load (0.3ms) SELECT "cms_sites".* FROM "cms_sites" LIMIT 1
Completed 500 Internal Server Error in 156ms
NoMethodError (undefined method `gsub!' for nil:NilClass):
Run Code Online (Sandbox Code Playgroud)
我的Gemfile.lock在这里:http://pastie.org/2270005
任何帮助将不胜感激.Luca G. Soave
ruby ruby-on-rails omniauth ruby-on-rails-3 comfortable-mexican-sofa
我的"用户"集合带有"关注列表"字段,其中也有许多内部字段,其中一个是"arrangeable_values"("关注列表"中的第二个字段).
我需要在"用户"集合中找到每个用户,在"关注列表"中找到每个"arrangeable_values".
我怎么能用mongodb shell做到这一点?
以下是数据模型的示例:
> db.users.findOne({'nickname': 'superj'})
{
"_id" : ObjectId("4f6c42f6018a590001000001"),
"nickname" : "superj",
"provider" : "github",
"user_hash" : null,
"watchlists" : [
{
"_id" : ObjectId("4f6c42f7018a590001000002"),
"arrangeable_values" : {
"description" : "My introduction presentation to node.js along with sample code at various stages of building a simple RESTful web service with journey, cradle, winston, optimist, and http-console.",
"tag" : "",
"html_url" : "https://github.com/indexzero/nodejs-intro"
},
"avatar_url" : "https://secure.gravatar.com/avatar/d43e8ea63b61e7669ded5b9d3c2e980f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png",
"created_at" : ISODate("2011-02-01T10:20:29Z"),
"description" : "My introduction presentation to node.js along …Run Code Online (Sandbox Code Playgroud) 当然,不仅有一种方法可以从左到右转换以下字符串,反之亦然
"content-management-systems" <=> "Content Management Systems"
Run Code Online (Sandbox Code Playgroud)
什么是红宝石的方式?
我有一个查询条件,它查找要匹配的元素数组(tags_array):
User.all_in('watchlists.tags_array' => tags_array)
Run Code Online (Sandbox Code Playgroud)
我想的标准是不区分大小写的,这意味着我希望它匹配%w[Ruby Web Framework]以及%w[RUBY WEB FRAMEWORK]或%w[ruby web framework]等等...
这可能是通过mongoid还是我必须使用外部过滤技巧?