小编use*_*621的帖子

Facebook应用程序 - 通过omniauth登录 - OAuthException 191

我面临的问题是:

  "error": {
      "message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
      "type": "OAuthException",
      "code": 191
   }
Run Code Online (Sandbox Code Playgroud)

我成立了我的应用程序所需的密钥和标记,在Facebook的开发中心我设置Site URL:http://127.0.0.1:3001和我收到上述错误.此外,我试图建立App Namespace:http://127.0.0.1:3001,但我得到不好的地址格式错误.当我试着填写他App Domain:并设置有我的本地主机,再为格式错误的错误...

使用localhost的fabebook应用程序的正确配置是什么?

facebook ruby-on-rails facebook-graph-api omniauth

15
推荐指数
2
解决办法
2万
查看次数

Rails 3.2 + MySQL:错误:字段'created_at'没有默认值:INSERT INTO

我创建了一个新的迁移,其中提到了

...
t.timestamps
Run Code Online (Sandbox Code Playgroud)

在创建的表中添加了这两列

...
| created_at  | datetime   | NO (Null)  |     | NULL (Default)   |                
| updated_at  | datetime   | NO (Null)  |     | NULL (Default)   |
...
Run Code Online (Sandbox Code Playgroud)

当我想创建一个新项目时,我总是收到错误消息

Mysql2::Error: Field 'created_at' doesn't have a default value: INSERT INTO `table_name` (`first_col`, `second_col`) VALUES ('a', 'b')
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?我把这个miniapp发送给我的一个朋友,他能够成功运行它 - >记录是在数据库中创建的.

我错过了什么?

ruby mysql timestamp ruby-on-rails insert-into

15
推荐指数
2
解决办法
1万
查看次数

Rails - 如何获取访问者的IP地址?

我需要将访问者的IP地址存储到我们的数据库中,这是我尝试这样做的方式:

@ip = request.remote_ip
@ip = request.env['REMOTE_ADDR']
Run Code Online (Sandbox Code Playgroud)

但在这两种情况下,即使我将应用程序部署到Amazon EC2实例,该@ip变量也存储了值127.0.0.1.

当我检查http://www.whatismyip.com/,它表明我的IP为109.175.XXX.X.

那么,为什么ruby变量总是显示127.0.0.1地址?我如何获得真正的IP?


编辑: 这是以下输出:

request.env['HTTP_X_FORWARDED_FOR'] => 
request.remote_ip => 127.0.0.1
request.env['REMOTE_ADDR'] => 127.0.0.1
request.ip => 127.0.0.1
Run Code Online (Sandbox Code Playgroud)

我认为问题就在我身边,但我发送了3个朋友的链接,所有人都看到了相同的IP,只有127.0.0.1.

我整天都在解决这个问题但仍然没有成功.

谢谢

ruby ip ruby-on-rails request

14
推荐指数
2
解决办法
1万
查看次数

MySQL - 在两个日期之间从数据库中选择数据

我已将用户注册的日期保存为日期时间,因此例如2011-12-06 10:45:36.我已经运行了这个查询,我期待这个项目 - 2011-12-06 10:45:36 - 将被选中:

SELECT `users`.* FROM `users` WHERE created_at >= '2011-12-01' AND
created_at <= '2011-12-06'
Run Code Online (Sandbox Code Playgroud)

但事实并非如此.存在任何优雅的方式,如何选择这个项目?作为我的第一个想法是2011-12-06 + 1,但这看起来不是很好.

mysql datetime date

13
推荐指数
3
解决办法
9万
查看次数

Rails 3.2 - haml vs. erb.haml更快吗?(2012年2月)

我正在研究一个项目,我仍在考虑使用HAML(漂亮的代码,更少的视图文件)而不是经典的ERB模板.

我担心为什么我没有这样做是产生观点的速度 - 我读了一篇文章/基准,而且几乎总是HAML比ERB慢 - 但事实是,文章是2 - 3年.

所以我的问题是,在2012年初,如何看待这两个模板系统的比较?

haml ruby-on-rails erb view ruby-on-rails-3.2

13
推荐指数
1
解决办法
4354
查看次数

Rails表单(选择/选项) - 如何使用HAML标记所选选项?

在HAML中以表格形式标记当前所选期权值的最快捷,最优雅的方法是什么?

%form{:action => '', :method => 'get'}
   %select{:name => 'param_name'}
      %option{:value => 'A'} A data
      %option{:value => 'B'} B data
Run Code Online (Sandbox Code Playgroud)

单程:

- if params[:param_name] == "A"
  %option{:value => 'A', :selected => 'selected'} A data
- else
  %option{:value => 'A'} A data
Run Code Online (Sandbox Code Playgroud)

但是当select盒子有很多选项字段时,这是不合适的...

forms haml select ruby-on-rails option

13
推荐指数
2
解决办法
3万
查看次数

Lion OSX:如何安装libfreetype.6.dylib?

我正在尝试安装ruby gem,但安装过程已停止,因为:

ld: file not found: /usr/local/lib/libfreetype.6.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我该如何安装这个库?我查了一下/usr/local/lib/,那里的图书馆遗失了.

编辑:

我跑了找到libfreetype.6.dylib并得到:

/Applications/MAMP/Library/lib/libfreetype.6.dylib
/Applications/VLC.app/Contents/MacOS/lib/libfreetype.6.dylib
/Applications/XAMPP/xamppfiles/lib/libfreetype.6.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib/libfreetype.6.dylib
/Applications/calibre.app/Contents/Frameworks/libfreetype.6.dylib
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Info.plist
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF/libfreetype.6.dylib
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Info.plist
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF
/Users/v/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF/libfreetype.6.dylib
/opt/X11/lib/libfreetype.6.dylib
/usr/local/Cellar/freetype/2.4.10/lib/libfreetype.6.dylib
Run Code Online (Sandbox Code Playgroud)

但为什么系统找不到图书馆?

ruby gem homebrew osx-lion

13
推荐指数
3
解决办法
2万
查看次数

如何从数组中获取唯一项?

我是Java初学者,我找到了一些关于这个主题的主题,但没有一个对我有用.我有这样一个数组:

int[] numbers = {1, 1, 2, 1, 3, 4, 5};
Run Code Online (Sandbox Code Playgroud)

我需要得到这个输出:

1, 2, 3, 4, 5
Run Code Online (Sandbox Code Playgroud)

该阵列中的每个项目只需一次.

但是如何得到它呢?

java arrays

13
推荐指数
3
解决办法
5万
查看次数

Capistrano无法部署代码,因为Net :: SSH :: AuthenticationFailed:身份验证失败

我们有一个在Amazon AWS上运行的Rails应用程序.我们几乎每天都会推出一个新代码,连续几个月.

今天,当我尝试在那里部署新代码时,我收到了以下错误消息:

  * 2014-02-16 13:09:51 executing `deploy'
  * 2014-02-16 13:09:51 executing `deploy:update'
 ** transaction: start
  * 2014-02-16 13:09:51 executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@bitbucket.org:my_bitbucket_name/project_name.git master"
    command finished in 2909ms
  * executing "if [ -d /home/deployer/project_name/shared/cached-copy ]; then cd /home/deployer/project_name/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 16958dfcee27dd9c33855ecece0013428e2c57c8 && git clean -q -d -x -f; else git clone -q -b master git@bitbucket.org:rdudacz/looky.co.git /home/deployer/looky/shared/cached-copy …
Run Code Online (Sandbox Code Playgroud)

ruby ssh capistrano ruby-on-rails amazon-web-services

13
推荐指数
2
解决办法
1万
查看次数

Rails 4 - 如何安装"jquery-ui"?

对于使用jquery自动完成插件,我需要安装jquery-ui gem.

到目前为止,我在我的gemfile中有以下内容:

gem 'jquery-rails'
Run Code Online (Sandbox Code Playgroud)

所以我补充说:

gem 'jquery-ui-rails'
Run Code Online (Sandbox Code Playgroud)

application.js我说:

//= require jquery
//= require jquery_ujs
//= require jquery-ui
Run Code Online (Sandbox Code Playgroud)

application.css:

 *= require_self
 *= require jquery.ui
Run Code Online (Sandbox Code Playgroud)

bundle update,重启服务器并:

couldn't find file 'jquery.ui'
Run Code Online (Sandbox Code Playgroud)

我也在应用程序中使用turbolinks.为了让jquery-ui在应用程序中工作,我是否会错过一些宝石?

谢谢.

编辑:

在Gemfile中所有与jquery相关的东西:

gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'jquery-turbolinks'
Run Code Online (Sandbox Code Playgroud)

javascript ruby jquery jquery-ui ruby-on-rails

13
推荐指数
2
解决办法
7785
查看次数