Ruby on rails Rails与嵌入式ruby

Ruby on rails Rails与嵌入式ruby,ruby-on-rails,ruby,html,Ruby On Rails,Ruby,Html,对于我的网站,我有以下标题帮助器: <% provide(:title, 'My Page') %> 中包含的是一段普通的Ruby代码。您只需要将值作为参数传递给providehelper方法 <% provide(:title, current_user.email[/[^@]+/]) %> 这很有效,谢谢。如果允许的话,我会接受答案。@mtcrts70您知道为什么这样做有效而您的代码无效吗?不完全正确,如果您想添加一点颜色,那就太好了。 SyntaxError

对于我的网站,我有以下标题帮助器:

<% provide(:title, 'My Page') %>
中包含的是一段普通的Ruby代码。您只需要将值作为参数传递给
provide
helper方法

<% provide(:title, current_user.email[/[^@]+/]) %>


这很有效,谢谢。如果允许的话,我会接受答案。@mtcrts70您知道为什么这样做有效而您的代码无效吗?不完全正确,如果您想添加一点颜色,那就太好了。
SyntaxError in Static_pages#home

Showing /home/matt/Documents/Ruby/rails_projects/ninja_speak_app/app/views/static_pages/home.html.erb where line #4 raised:

/home/matt/Documents/Ruby/rails_projects/ninja_speak_app/app/views/static_pages/home.html.erb:4: syntax error, unexpected $undefined, expecting ')'
... ;@output_buffer.safe_concat('\') %>
...                               ^
/home/matt/Documents/Ruby/rails_projects/ninja_speak_app/app/views/static_pages/home.html.erb:15: syntax error, unexpected ')', expecting keyword_end
       ');@output_buffer.append= ( cur...
         ^
<% provide(:title, current_user.email[/[^@]+/]) %>