2014-04-21 5 views
1

이 간단한 erb 코드는 완벽하게 작동하며 i18n.yml 파일에 연결됩니다. 아이디어는 클라이언트의 edit.html.erb 페이지를 가져 와서 해당 페이지의 제목을 내 en.yml 파일로 가져와 해당 제목을 @client.fullname 변수로 전달하는 것입니다. 좋아요 :레일 4는 슬림 에러가 발생합니다

<h1><%= t('client.edit.title'), :current_client => @client.fullname %></h1> 

이제 저는 erb 파일을 슬림화하는 중입니다. 그래서 코드 줄의 결과는

h1 = t('client.edit.title'), :current_client => @client.fullname 

입니다하지만 그것은 en.yml 파일에 변수를 전달 wouldnt한다. 대신이 오류가 발생합니다.

/app/views/clients/edit.html.slim:1: syntax error, unexpected ',', expecting ')' ...tty2 = (t('client.edit.title'), :current_client => @client.f... ...^

내가 잘못하고있는 것을 아는 사람이 있습니까?

h1 
    = t('client.edit.title'), :current_client => @client.fullname 
+0

유일한 방법을 제거 할 수 있습니다 : current_client => @ client.fullname) – paulorcdiniz

+0

고마워, 너도 가지고있어! –

답변

0

해시 매개 변수 옵션이 ERB에서 일 것이다 왜 그렇게

h1 = t('client.edit.title', :current_client => @client.fullname) 

확실하지 같은 메소드 호출 괄호 안에 전달되어야하지만, '아무튼 :

+0

맞아, 카를로스. 감사합니다. –

0

시도하십시오 서면으로 옳은 것처럼 보입니다. 번역 식별자 문자열 current_client 옵션 : =의 t ('client.edit.title',

또한 괄호에게 내가이 상대적으로 작업이 전달되었다 만들 수 모두

h1 = t 'client.edit.title', :current_client => @client.fullname 
관련 문제