2014-09-15 1 views
1

테스트로 나는 link_tobutton_to을 모두 사용했지만 전자는 작동합니다. 후자의 경우 매개 변수가 전달되지 않은 것처럼 보입니다. 페이스 북에서 URL에 분명히있을 때 client_id이 없다는 오류가 발생하기 때문입니다.GET을 통한 외부 링크에 button_to 사용

LINK_TO 코드 :

<%= link_to "test", @auth_url %> 

<!-- rendered HTML --> 
<a href="https://www.facebook.com/v2.0/dialog/oauth?client_id=XYZ...">test</a> 

button_to 코드 :

<%= button_to @auth_url, method: :get, class: "btn btn-block btn-lg btn-social btn-facebook", style: "color:white" do %> 
    <i class="fa fa-facebook horiz"></i> Invite me with Facebook 
<% end %> 

<!-- rendered HTML --> 
<form action="https://www.facebook.com/v2.0/dialog/oauth?client_id=XYZ..." class="button_to" method="get"> 
    <div> 
    <button class="btn btn-block btn-lg btn-social btn-facebook" style="color:white" type="submit"> 
     <i class="fa fa-facebook horiz"></i> Invite me with Facebook 
    </button> 
    </div> 
</form> 

내가 버튼을 원하는 때문에 button_to를 사용하고 싶습니다 ...하지만이 같은 링크 스타일을 지정할 수 있습니다 이런 일을 할 수있는 방법이 없다면.

감사합니다.

이 경우

답변

1

, 난 그냥과 같이 자바 스크립트를 사용하여 종료하는 것이, 내가 다른 브라우저에서 버튼을 스타일링으로 발견 된 많은 문제가있다 :

$("#inviteme3").click(function() { 
    var link_string = '<%= @auth_url %>'; 
    var decoded = link_string.replace(/&amp;/g, '&'); 
    location.href = decoded 
    return false; 
});