小编Ser*_*ora的帖子

当iside选项卡时,gmaps4rails只显示地图的一半.知道为什么吗?

我一直在四处寻找,但我没有发现这样的问题.

Gmaps4rails非常适合我!

插入JQuery选项卡时遇到麻烦.它加载了一半的地图.它实际上看起来像是缺少图片.我可以照常移动/调整大小.但只显示地图的一部分.缺少的部分通常是左/下部分.但是空白部分的大小一直在变化.

同时,悬停地图时显示鼠标光标的手在悬停此空白部分时变为箭头(但此部分仍在Google容器内).

如果我将gmaps容器放在JQuery选项卡之外,它就能完美运行.谁看过这个吗?

视图

   #tabs-4
     #gmap
       =gmaps("map_options" => { "detect_location" => true, "auto_zoom" => false, "center_on_user" => true, "zoom" => 17},"markers" => { "data" => @json })
Run Code Online (Sandbox Code Playgroud)

非常感谢!

google-maps ruby-on-rails ruby-on-rails-3 gmaps4rails

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

Rails 3.2,如何更改:从邮件中的值改为默认(GMail)

我已经建立了一个联系我们表格,我很好地收到了我的gApps收件箱中的电子邮件.但是,收到的电子邮件显示默认值:来自网站的值.我希望它们出现在电子邮件用户输入的电子邮件字段中.因此,当我点击"回复"时,它会将用户地址作为电子邮件必须发送的地址.

我试过这个,但它不起作用.知道为什么吗?

notifications_mailer.rb

class NotificationsMailer < ActionMailer::Base
  default to: "info@hikultura.com"

  def new_contact(message)
      @message = message
      mail(:subject => "[hiKultura.com] #{message.subject}",
        :from => message.email)
  end
end
Run Code Online (Sandbox Code Playgroud)

的ContactController

class ContactController < ApplicationController

  def new
    @message = Contactmessage.new
  end

  def create
    @message = Contactmessage.new(params[:contactmessage])

    if @message.valid?
      NotificationsMailer.new_contact(@message).deliver
      redirect_to(root_path, :notice => "Message was successfully sent.")
    else
      flash.now.alert = "Please fill all fields."
      render :new
    end
  end

end
Run Code Online (Sandbox Code Playgroud)

UPDATE

我跟踪了我在SO中发现的类似案例:reply_to和GMail.但是,当我点击回复时,仍显示:到电子邮件地址.我错过了什么?

notifications_mailer.rb

class NotificationsMailer < ActionMailer::Base

   default :from => 'no-reply@mydomain.com'

  def new_contact(message)
      @message = message
      mail(:reply_to => …
Run Code Online (Sandbox Code Playgroud)

gmail ruby-on-rails contact-form ruby-on-rails-3

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

Rails 3.2 - 未定义的方法`where'for#<Array:... - Model.where()的查询

我试图将给定的Header字段与Alarm模型中的其他字段进行比较.正如您在代码中看到的,我在3个不同的步骤中过滤警报.前2个工作完美.但是,最后一个不起作用.它说:

undefined method `where' for #<Array:...
Run Code Online (Sandbox Code Playgroud)

据我所知,.where是一个适用于数组的类方法.为什么不在这里工作?我也尝试了.find_all_by不同的东西......但无济于事.

@header = Header.find(1)

# Extracts those alarms that are ACTIVE and have something in common with the tittles
@alarmsT = Alarm.activated.where("keyword in (?)", [@header.title_es, @header.title_en, @header.title_en])

# Extracts alarms when Header has at least the same categories as an alarm
@alarmsT = @alarmsT.select do |alarm| 
   @header.category_ids.all?{|c| alarm.category_ids.include? c }
end

// this is the one that does NOT work
# Extract alarms which share the …
Run Code Online (Sandbox Code Playgroud)

sqlite postgresql ruby-on-rails ruby-on-rails-3

0
推荐指数
1
解决办法
7082
查看次数