小编Kev*_*n Z的帖子

Rails基于URL参数设置布局

所以我试图根据url params改变视图的布局.

到目前为止,我发现我必须在控制器中设置布局.在我的控制器显示动作下我有:

if params['iframe'] == 'true'
  render :layout => 'vendored'
end
Run Code Online (Sandbox Code Playgroud)

布局'vendored'存在于视图/布局中.我多次得到可怕的渲染.以下是我的控制器中其余的show动作:

 def show
    @event = Event.find(params[:id])
    @user = current_user
    @approved_employers = current_user.get_employers_approving_event(@event) if user_signed_in?
    respond_with(@event)
Run Code Online (Sandbox Code Playgroud)

问题是我没有看到另一个渲染.我没有在整个控制器中看到另一个.当然,有一个渲染,因为它渲染我的默认应用程序布局,是否导致问题?我在rails文档中读到了我可以添加的内容

and return
Run Code Online (Sandbox Code Playgroud)

到最后,这应该解决问题,但不知道在哪里放,因为两个渲染不是彼此相邻.我也没有看到任何其他redirect_to.我应该在哪里寻找这个其他渲染?那是问题吗?

controller ruby-on-rails render url-parameters

4
推荐指数
1
解决办法
2602
查看次数

MySQL Ruby Gem安装问题

所以我知道之前已经问过这个问题,我已经查看了之前的所有答案,但仍然无法找到解决方案.希望你们都能提供帮助.

设置:我正在运行Mac OS X 10.6服务器.我已经在Web应用程序上使用了内置的MySQL安装,它运行良好.现在我正在尝试运行需要MySQL的RoR应用程序.

所以,每当我进入

gem install mysql
Run Code Online (Sandbox Code Playgroud)

它吐出以下错误:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/Users/admin/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb --with-mysql-config=/var/mysql
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/admin/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
    --with-mysql-config
extconf.rb:35:in ``': …
Run Code Online (Sandbox Code Playgroud)

mysql macos ruby-on-rails osx-server ruby-on-rails-3

3
推荐指数
1
解决办法
8115
查看次数