使用rails 3 + devise + omniauth到facebook连接.在权限对话框中,如果用户单击"不允许",则将用户重定向到:
Started GET "/users/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request." for 127.0.0.1 at Mon Jun 20 16:54:42 -0700 2011
Processing by Devise::OmniauthCallbacksController#failure as HTML
Parameters: {"error_description"=>"The user denied your request.", "error_reason"=>"user_denied", "error"=>"access_denied"}
Redirected to http://localhost:3000/users/sign_in
Completed 302 Found in 2ms
Run Code Online (Sandbox Code Playgroud)
如何获得控制权并提供.js文件以优雅地处理此问题.现在,它正在重定向到根并显示该站点是一个小小的对话框.
想法?谢谢
现在我有以下内容:
<% if !@thread.nil? && @thread.name == 'X' || @thread.name == 'Y' %>
....
Run Code Online (Sandbox Code Playgroud)
这里的问题是我相信无论是否@@thread.nil?,仍然会调用@ thread.name导致错误.
写这个的正确方法是什么,就像这样:
<% if !@thread.nil? && @thread.name == ('X' || 'Y') %>
Run Code Online (Sandbox Code Playgroud)
某些类型包含在列表中?对于thread.name?
谢谢
如果你看下面的链接,你会看到一个浮动的绿色框,箭头指向左边:
http://dribbble.com/shots/107845-hover-button
这可以只使用CSS3吗?是否可以使箭头形状并且具有框和箭头中的渐变?如果是这样,你会怎么做?
谢谢
我正在尝试为我的Rooms控制器编写一个rspec来测试CanCan的权限但是仍然在标题中得到错误.我正在按照控制器测试中的步骤进行操作:https://github.com/ryanb/cancan/wiki/Testing-Abilities
room_controller_spec.rb
require 'spec_helper'
describe RoomsController do
before(:each) do
@user_1 = Factory.create(:user, :password => 'password')
@room_for_user_1 = Room.create(:user_id => @user_1.id)
@ability = Object.new
@ability.extend(CanCan::Ability)
@controller.stubs(:current_ability).returns(@ability)
end
describe "Room Permissions" do
it "should allow a user to join a room" do
@ability.can :show, @room_for_user_1
get :show, { :uuid => @room_for_user_1.uuid }
response.should render_template("show")
end
end
end
Run Code Online (Sandbox Code Playgroud)
关于我如何获得设计+ CanCan + RSpec工作的任何建议,以便我可以测试控制器?谢谢
我正在努力创建一个满足以下条件的ruby正则表达式:
支持的:
到目前为止,我有:
[0-9a-z]{5,500}
Run Code Online (Sandbox Code Playgroud)
有关如何更新以符合上述标准的任何建议?
谢谢
一个jQuery事件传递给我.
然后我可以使用:e.currentTarget给我元素
<input type=?"checkbox" class=?"list_completed_checkbox" id=?"list_item_completed_checkbox_81">?
Run Code Online (Sandbox Code Playgroud)
但是如果我尝试做e.currentTarget.fadeOut(); 我收到一个错误:
68Uncaught TypeError: Object #<HTMLInputElement> has no method 'fadeOut
Run Code Online (Sandbox Code Playgroud)
我如何使用元素w jQuery?谢谢
鉴于以下内容:
ListItem(位置,标题)
1,hello
2,hello2
3,hello3
4,hello4
5,hello5
Run Code Online (Sandbox Code Playgroud)
如果第3项,3,hello3被删除,有没有办法让位置自动更新,即位置5现在是位置4?
给出一串字符串:
var copy = "Hello world what is the day @James Bond blah bah blah blah...";
Run Code Online (Sandbox Code Playgroud)
使用jQuery/JS,给出:
var term = "James Bond";
var id = "XXXXXX";
Run Code Online (Sandbox Code Playgroud)
我怎样才能找到所有匹配'@' + term并返回如下内容:
"Hello world what is the day @[XXXXXX:James Bond] blah bah blah blah..."
Run Code Online (Sandbox Code Playgroud)
谢谢
我们有一个网站范围的config.yml文件,它接触api密钥等...
我的另一个YML文件可以访问config.yml?
config.yml:
development:
thing: 123123123123
Run Code Online (Sandbox Code Playgroud)
plugin_config.yml:
development:
thing: config.yml.development.thing
Run Code Online (Sandbox Code Playgroud)
这可能吗?
对于我的应用程序,如果有一个白色空间是好的.但如果有2-4我想用它来替换它们以保留间距.
使用rails/regex执行此操作的最佳方法是什么?或者是其他东西?
期望的输出:
' ' = ' '
' ' = ' '
' ' = ' '
' ' = ' '
Run Code Online (Sandbox Code Playgroud)