小编Pea*_*ace的帖子

“51”的未定义方法`permit':字符串

更新时出现这个错误,不知道为什么会出现这个错误

def update1
 @user = User.find(params[:user])
 if @user.update_attributes(user_params)
   redirect to user_steps_path
 else
   render 'edit1'
 end
 end

private
  def user_params
    params.require(:user).permit(:fname, :lname, :email)
  end
end
Run Code Online (Sandbox Code Playgroud)

参数:

{"utf8"=>"?",
 "authenticity_token"=>"wY+llV4qot5xDsxp1JvaltvPdrZND7goaorBTh8Vteo=",
 "user"=>"51",
 "commit"=>"Update"}
Run Code Online (Sandbox Code Playgroud)

编辑.html.erb

这是我的编辑表格

<%= form_for :user do |f| %>
    <div class="form-group">
    <%= f.label :First_Name %><br />
    <%= f.text_field :fname, :class=> 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.label :Last_Name %><br />
    <%= f.text_field :lname, :class=> 'form-control' %>
  </div>
  <div class="form-group">
    <%= f.label :Email_Address %><br />
    <%= f.email_field :email, :class=> 'form-control' %>
  </div>
  <div …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails params

6
推荐指数
2
解决办法
1万
查看次数

我们如何在rails中添加带div的link_to?

我想添加link_to一个

<div class="panel-body"> 
Run Code Online (Sandbox Code Playgroud)

它应该是这样的

<%= link_to 'div',{:controller=>'users',:action=>'go'} 
Run Code Online (Sandbox Code Playgroud)

但我找不到任何办法.

这是我的div:

<div class="panel-body"></div>
<div class="panel-footer back-footer pink">
  workers signup
</div>
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

5
推荐指数
1
解决办法
3988
查看次数

输入范围滑块的 Javascript 代码在 Internet Explorer 11 中不起作用

这是我的 html 代码

<input type="range" name="que1" min="0" max="100" value="0" class="slider" id="myRange">
Run Code Online (Sandbox Code Playgroud)

它的 javascript 代码是

var slider = document.getElementById('myRange')

function onChange(event) {
  var x = event.target.value

  if (x == 0) {
    slider.className = ''
  } else if (x > 30 && x < 60) {
    slider.className = 'MyClass-1'
  } else if (x == 100) {
    slider.className = 'MyClass-2'
  }
}

slider.addEventListener('input', onChange)
Run Code Online (Sandbox Code Playgroud)

当我拖动滑块时,值会发生变化,但类没有根据值添加,它在 chrome 中完美运行,但在 Internet Explorer 11 中却没有。

有什么解决方案可以在 ie11 中实现?

html javascript input rangeslider internet-explorer-11

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

获取WooCommerce的最低变化价格

我是一个初学者,正在尝试学习Wordpress并且有一个价格可变的产品:

  • 鳕鱼250卢比
  • 在线卢比200

我想在我的主题中使用最低价格functions.php.

我怎样才能获取或获得最小值?

我想在下面的代码中使用:

function filter_gateways($gateways){

    $payment_NAME = 'cod'; // 
    $min_variation_price = ''; <--------------- minimum variation price

    global $woocommerce;

    foreach ($woocommerce->cart->cart_contents as $key => $values ) {
        // Get the terms, i.e. category list using the ID of the product
        $terms = get_the_terms( $values['product_id'], 'product_cat' );
        // Because a product can have multiple categories, we need to iterate through the list of the products category for a match
        foreach ($terms as $term) {
            // 20 is …
Run Code Online (Sandbox Code Playgroud)

php wordpress product categories woocommerce

2
推荐指数
2
解决办法
5794
查看次数