我认为使用相关单位开始我的新项目是个好主意.当我正在研究它时,我正在检查chrome仿真,以确保一切在这些设备上运行良好,并且它看起来很好.
然后我把它推到了heroku,它在我的Macbook上看起来很不错,但是当我真的将它加载到我的iPad上时,我想把它扔出窗外......
#bannerTop {
position:relative;
text-align: center;
width:100vw;
height:70vh;
min-height: 70vh !important;
max-height:70vh !important;
background-image: asset-url('skycloudsalpha.jpg');
background-repeat: no-repeat;
background-position: 50% 75%;
z-index:-1;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用VH单位.我怀疑这可能是问题所在?
可能还有一些其他潜在问题,但我不确定如何调试我的问题,因为在模拟器上一切都很好,但在设备本身上却没有.我现在花了大约三个小时,非常感谢一些帮助.
谢谢!
我得到的错误:
ActionView::Template::Error (undefined method `url' for nil:NilClass)
Run Code Online (Sandbox Code Playgroud)
我有这个附件正在增加零
<%= image_tag attachments['tippedlogods.png'].url %>
Run Code Online (Sandbox Code Playgroud)
话虽这么说,我已经在方法中声明了发送电子邮件的附件,这里:
def confirmation(order)
@order = order
mail(to: @order.email, subject: "Order Confirmation", content_type: "text/html")
attachments.inline['tippedlogods.png'] = File.read("app/assets/images/tippedlogods.png")
end
Run Code Online (Sandbox Code Playgroud)
在我的production.rb中:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { :host => 'hidden-peak-xxxx.heroku.com', :only_path => false}
config.action_mailer.asset_host = 'hidden-peak-xxxx.heroku.com'
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN'],
:authentication => :plain
}
Run Code Online (Sandbox Code Playgroud)
这不是在确认电子邮件中发送图像的方法吗?
我在这里关注RoR指南......
注意 Rails 4~
这真让我抓狂...
我在这里看到了几个问题与nokogiri(一个在这里),但它们与脚本有关.我有一个完整的rails应用程序,我刚刚安装了paperclip和amazon-aws,当我进行捆绑安装时也下载了nokogiri ..
gem dependency paperclip
...
nokogiri (>= 0, development)
...
Run Code Online (Sandbox Code Playgroud)
这就是这个宝石被引入的地方..
我读到Nokogiri应该在我的gemfile中,所以我做了一个
gemfile.rb =>
gem 'nokogiri'
gem 'aws-sdk'
gem 'paperclip'
Run Code Online (Sandbox Code Playgroud)
现在我的本地服务器无法启动...
nokogiri-1.6.2.1/lib/nokogiri.rb:29:in `require': cannot load such file -- nokogiri/nokogiri (LoadError)
Run Code Online (Sandbox Code Playgroud)
我也尝试过nokogiri 1.4.4 ......
以前(在我的gemfile中没有nokogiri)服务器会加载,但是当我尝试上传图像时会出现加载错误...同上面的错误
cannot load such file -- nokogiri/nokogiri
Run Code Online (Sandbox Code Playgroud)
关于nokogiri的thotbot/paperclip文档中没有任何内容.我试过了
gem install nokogiri
Run Code Online (Sandbox Code Playgroud)
和
gem pristine nokogiri
Run Code Online (Sandbox Code Playgroud)
没有骰子..
我在捆绑上注意到这条消息:
IMPORTANT! Nokogiri builds and uses a packaged version of libxml2.
If this is a concern for you and you want to use the system library
instead, …Run Code Online (Sandbox Code Playgroud) 我正在玩我的第一个关系.我有三个型号.他们来了.
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :pools
has_many :games,
through: :pools
end
Run Code Online (Sandbox Code Playgroud)
〜
class Pool < ActiveRecord::Base
has_many :users
has_many :games,
through: :users
end
Run Code Online (Sandbox Code Playgroud)
〜
class Game < ActiveRecord::Base
belongs_to :user
belongs_to :pool
end
Run Code Online (Sandbox Code Playgroud)
这个设置是否允许我在IRB中执行以下操作?
u=User.first
u.games
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我得到以下错误.
SystemStackError: stack level too deep
from /Users/ShiftedRec/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/irb/workspace.rb:86
Maybe IRB bug!
Run Code Online (Sandbox Code Playgroud)
我应该能够做u.games和u.pools吗?做一个pool.users和pool.games也不错.
我如何更改我的模型设置,以便我可以访问这些方法..?
我一直在读书,但是很多东西让人感到困惑.
这也是我的架构
ActiveRecord::Schema.define(version: 20140408165647) do
create_table "games", force: true …Run Code Online (Sandbox Code Playgroud) 我正在尝试将用户的facebook url保存到我的数据库中,但是我收到以下错误.
redirection forbidden: http://graph.facebook.com/1240771104/picture -> https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn2/t...
Run Code Online (Sandbox Code Playgroud)
我已经引用了这个问题,但我认为他只是调用一个图像而不是将其保存到带有创建块的数据库中.
这是我的用户模型......
def self.find_for_facebook_oauth(auth, signed_in_resource=nil)
user = User.where(:provider => auth.provider, :uid => auth.uid).first
if user
return user
else
registered_user = User.where(:email => auth.info.email).first
if registered_user
return registered_user
else
user = User.create(
name:auth.extra.raw_info.name,
provider:auth.provider,
uid:auth.uid,
email:auth.info.email,
image:auth.info.image,
password:Devise.friendly_token[0,20],
)
end
end
end
Run Code Online (Sandbox Code Playgroud)
我在'def.self_for_facebook'下面添加了一个URI帮助器,因为我认为我只需要将http发送到https.所以我从另一个堆栈问题中收集到了.
private
def process_uri(uri)
require 'open-uri'
require 'open_uri_redirections'
open(uri, :allow_redirections => :safe) do |r|
r.base_uri.to_s
end
end
Run Code Online (Sandbox Code Playgroud)
我需要添加吗?
if auth.info.image.present?
image_url = process_uri(auth.info.image)
user.update_attribute(:image, URI.parse(avatar_url))
end
Run Code Online (Sandbox Code Playgroud)
到创建块? 这个:
if auth.info.image.present? …Run Code Online (Sandbox Code Playgroud) 我在语义UI中使用了一个复选框。我想切换标签和输入的位置,但事实证明这很痛苦。我正在使用切换复选框。
<div class="ui toggle checkbox">
<input id="privacy" type="checkbox" checked="checked">
<label for="privacy">Public</label>
</div>
Run Code Online (Sandbox Code Playgroud)
语义UI复选框文档位于此处:http : //semantic-ui.com/modules/checkbox.html#/definition
如果我在html中切换输入和标签,切换功能将停止工作。我什至似乎都无法相对定位元素...我可以添加一些简单的类吗,还是可以使输入和标签切换位置,同时仍保持红绿色切换功能的东西?
谢谢..
更新:我正在这里的小提琴:这包括语义ui css和js。