2

我的 rails 应用程序正在生成以下错误(运行 rails 生成器或启动 WEBrick 时):

/home/lachlan/.gem/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined method `paginates_per' for #<Class:0x0000000293d7d8> (NoMethodError)
    from /home/lachlan/.gem/ruby/1.9.1/gems/rich-1.3.1/app/models/rich/rich_file.rb:13:in `<class:RichFile>'
from /home/lachlan/.gem/ruby/1.9.1/gems/rich-1.3.1/app/models/rich/rich_file.rb:6:in `<module:Rich>'
from /home/lachlan/.gem/ruby/1.9.1/gems/rich-1.3.1/app/models/rich/rich_file.rb:5:in `<top (required)>'

我正在使用以下宝石,我认为可能与错误有关:

gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'less-rails'
gem 'twitter-bootstrap-rails'
gem 'jquery-rails'
gem 'rails_admin'
gem 'rich'
gem 'kaminari'

我已经跑了rake db:migrate

关于可能导致这种情况的任何想法?


使用 Javascript 动态创建和删除 Div 标签

当我按下 3 个不同的按钮(红绿蓝)时,我想动态创建 3 个 div 标签。当我按下红色时,我希望“红色”div 的高度是我的屏幕大小,以便整个页面看起来是红色的并且当我按绿色时,我希望“红色”div 的高度成为我屏幕的 50%,而其他 50% 的屏幕应该被其他 div(即绿色)占据。

最后,当我按下蓝色按钮时,我希望所有 div 都以相同的高度出现在屏幕上......

我可以创建 div,但是在按下所有三个按钮后按下红色按钮时,我无法删除以前创建的 div...

这是代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Ass 2</title>

        <script type="text/javascript">

        function fblue() {
            // document.bgColor = 'lightblue';

            selc=document.getElementById("first");
            divBlue=document.getElementById("one");
            myPara.removeChild(divBlue);



             selc=document.getElementById("first");

             divBlue=document.createElement("div");
             divBlue.id = "one";
             divBlue.style.backgroundColor = "lightblue";
             divBlue.style.height = "610px"
             divBlue.innerHTML = "dv tag created successfully";

             selc.appendChild(divBlue);
        }

        function fgreen() {

            selc=document.getElementById("first");
            divBlue=document.getElementById("one");


            divBlue.id = "one";
            divBlue.style.backgroundColor = "lightblue";
            divBlue.style.height = "305px"
            divBlue.innerHTML = "dv tag created successfully";
            selc.appendChild(divBlue);

            divGreen=document.createElement("div");
            divGreen.id = "one";
            divGreen.style.backgroundColor = "lightgreen";
            divGreen.style.height = "305px"
            divGreen.innerHTML = "dv tag created successfully";
            selc.appendChild(divGreen);

            //document.bgColor = ''; 
        }

        function fred() {

            document.getElementById("one").style.backgroundColor = 'lightblue';
            document.getElementById("one").style.width = '1104px';
            document.getElementById("one").style.height = '185px';

            document.getElementById("two").style.backgroundColor = 'red';
            document.getElementById("two").style.width = '1104px';
            document.getElementById("two").style.height = '185px';

            document.getElementById("three").style.backgroundColor = 'lightgreen';
            document.getElementById("three").style.width = '1104px';
            document.getElementById("three").style.height = '185px';
            document.bgColor = ''; 
        }

        </script>
    </head>
    <body style="margin: 0px;">
        <div style="height: 0px;" id="first"></div>

        <div id="four" style="margin-left: 415px; margin-top: 500px">
            <form>
                <input type="button" name="blu" value="Blue" onclick="javascript:fblue();">
                <input type="button" name="gre" value="Green/Red" onclick="javascript:fgreen();">
                <input type="button" name="re" value="Red/Green/Blue" onclick="javascript:fred();">
            </form>
        </div>
    </body>
</html>
4

1 回答 1

0

我设法找出导致问题的原因。我在 rails_admin 配置中排除了“Rich::RichFile”。删除这条线解决了这个问题。

于 2012-11-11T01:05:47.790 回答