Rails

Proper SCSS Asset Structure in Rails

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So, I have an app/assets/stylesheets/ directory structure that looks something like this: |-dialogs |-mixins |---buttons |---gradients |---vendor_support |---widgets |-pages |-structure |-ui_elements In each directory, there are multiple sass partials (usually *.css.scss, but one or two *.css.scss.erb). I might be assuming a lot, but rails SHOULD automatically compile all the files in those directories because of *= require_tree . in application.css, right? I recently have tried restructuring these files by removing all color variables and

Rails 5 and Ruby 2.3.3 Failed to load libmysql.dll

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Getting below error message logged in the console while starting the server for an application created with mysql database. Failed to load libmysql.dll from C:\RailsInstaller\Ruby2.3.0\lib\ruby\gems\2.3.0\gems\mysql2-0.4.7-x86-mingw32\vendor\libmysql.dll Environment Details : Window 7 64 bit Rails 5.0.4 ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32] mysqld Ver 5.7.18 for Win64 on x86_64 (MySQL Community Server (GPL)) Post install message from mysql2 ruby gem received below message on the console. You've installed the binary

nginx reverse proxy from rails to wordpress

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a Ruby on Rails application and a Wordpress blog hosted on separate EC2 instances. I'm trying to make the Wordpress blog to act like a subfolder of the Rails application (example.com/blog instead of blog.example.com) for better SEO The Rails application can be accessed through http and https (http is redirecting to https) https://www.nginx.com/resources/admin-guide/reverse-proxy/ I tried using nginx reverse proxy function and I think it's my best option right now but my attempt was unsuccessful. The main page of the blog opens as

Rails: delayed_job mail not sending

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use delayed_job gem https://github.com/collectiveidea/delayed_job in Rails 3.2 to send a mail in the background. I installed the gem gem 'delayed_job_active_record' I generated the table and ran the migrations, as instructed $ rails generate delayed_job:active_record $ rake db:migrate Noting that there are special instructions for mailers in Rails 3 # without delayed_job Notifier.signup(@user).deliver # with delayed_job Notifier.delay.signup(@user) I did def send_welcome_email #UserMailer.welcome_email(self).deliver <--

Rails requires RubyGems &gt;= 1.3.2. Please install RubyGems and try again (I have rubygems 1.3.6!)

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm running rails version 2.3.5 and rubygems version 1.3.6, when I script/server I get this error Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org any ideas how to fix this? 回答1: The first thing you should do is run: gem env This will output, amongst other things, the RUBYGEMS_VERSION and your GEM_PATHS. Verify that everything you think is true, is indeed true. In the GEM_PATHS, you will probably see multiple paths, the top most being the primary path. You can set GEM_HOME to the primary

JQuery events are not working on heroku in production but work in development

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: this seems to be a common problem but I haven't found a solution applicable for my case. I have some JQuery in bikes.js.coffee that works correctly in development locally. When I push to Heroku the script in bikes.js.coffee does not run. There is no error in the browser's javascript console. I am using Rails 4.0. From reading around I believe it is some error in the way the assets are compiled but I am unable to get beyond that. All images show up fine in production. bikes.js.coffee: ready = -> jQuery ($) -> # when the #make field changes $(

Eventmachine start_tcp_server no acceptor - port is in use or requires root privileges (RuntimeError)

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I haven't been able to run my local server for 3 days now. Restarting my computer doesn't help. A couple of time, after trying repeatedly about 40-50 times, it randomly worked - I can't figure out why. I tried a different port once and that worked, but since then, no port works. Every time I try to run my rails server I get this. /Users/colmtuite/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.5/lib/eventmachine.rb:526:in `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError) from /Users/colmtuite/.rvm/gems

Rails 4.0.0 - Got “no implicit conversion of nil into String”

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Just installed a brand new Rails 4.0.0 app and I got this error ( https://gist.github.com/hartator/6404820 ) on http://0.0.0.0:3000 : no implicit conversion of nil into String activerecord ( 4.0 . 0 ) lib / active_record / connection_adapters / sqlite3_adapter . rb : 24 : in `initialize' activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in ` new ' activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `sqlite3_connection' activerecord ( 4.0 . 0 ) lib / active_record /

Watermark images with paperclip, rails 4

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been attempting to add watermarks to my images, following the answer listed in watermark with paperclip : Watermark.rb: module Paperclip class Watermark < Processor # Handles watermarking of images that are uploaded. attr_accessor :current_geometry, :target_geometry, :format, :whiny, :convert_options, :watermark_path, :watermark_offset, :overlay, :position def initialize file, options = {}, attachment = nil super geometry = options[:geometry] @file = file @crop = geometry[-1,1] == '#' @target_geometry = Geometry.parse geometry @current

Rails 3 with composed_of model and validation

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have this domain model: class Person < ActiveRecord::Base composed_of :address, mapping: [%w(address_street street), %w(address_city city), %w(address_zip_code zip_code), %w(address_country country)] validates :name, presence: true, length: { maximum: 50 } validates :surname, presence: true, length: { maximum: 50 } validates_associated :address end class Address include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming attr_reader :street, :city, :zip_code, :country validates :street, presence: true