ruby-on-rails-4.2

AWS SES Timeout

☆樱花仙子☆ 提交于 2019-12-22 11:25:45
问题 I am using Rails 4.2, the AWS-SES gem and the Mailform gem. I am trying to set up AWS SES in development and have added this to config/development.rb : # Configure mail using AWS SES config.after_initialize do ActionMailer::Base.delivery_method = :amazon_ses ActionMailer::Base.custom_amazon_ses_mailer = AWS::SES::Base.new( :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'], :access_key_id => ENV['AWS_SECRET_KEY_ID'], :server => 'email.eu-west-2.amazonaws.com' ) end When I attempt to send

Installing Rails 4.2.0.beta1 - Unresolved dependency found during sorting

ぐ巨炮叔叔 提交于 2019-12-22 04:48:10
问题 I've attempted to install Rails 4.2.0.beta1 (released Aug 20, 2014). I get an error "Unresolved dependency found during sorting." Here are the details: $ ruby -v ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0] $ gem -v 2.4.1 $ gem install rails --pre ERROR: While executing gem ... (Gem::DependencyError) Unresolved dependency found during sorting - activesupport (>= 4.0) (requested by sprockets-rails-3.0.0.beta1) How can I install Rails 4.2.0.beta1? 回答1: This issue has been fixed

Installing Rails 4.2.0.beta1 – Bundler could not find compatible versions for gem “sprockets-rails”

吃可爱长大的小学妹 提交于 2019-12-22 03:41:37
问题 I've attempted to install Rails 4.2.0.beta1 (released Aug 20, 2014). I get an error Bundler could not find compatible versions for gem "sprockets-rails" . Here are the details: $ bundle update rails Fetching gem metadata from https://rubygems.org/......... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Bundler could not find compatible versions for gem "sprockets-rails": In Gemfile: sass-rails (~> 4.0.3) ruby depends on sprockets-rails (~> 2.0) ruby rails

RangeError for simple integer assignment in Rails 4.2.0 that should be caught by validation

蹲街弑〆低调 提交于 2019-12-22 03:15:34
问题 * UPDATE: this is now fixed in 4.2.stable and 4.2.1 * in Rails 4.2.0 (and current 4.2.stable), the ensure_in_range method happens before AR validation, yielding a RangeError if I do something as simple as @obj.threshold = 10_000_000_000 on a column with a postgres type integer threshold | integer | it yields RangeError: 10000000000 is out of range for ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer with limit 4 from .../2.0.0-p598/lib/ruby/gems/2.0.0/bundler/gems/rails-62e9e61f2d1b

mongodb connection refused docker-compose

与世无争的帅哥 提交于 2019-12-21 12:22:37
问题 The dockerfile consists as:- FROM ruby:2.2.3-slim MAINTAINER Milan Rawal <milan@gmail.com> RUN apt-get update && apt-get install -qq -y build-essential nodejs libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core curl htop --fix-missing --no-install-recommends ENV INSTALL_PATH /air_scout RUN mkdir -p $INSTALL_PATH WORKDIR $INSTALL_PATH COPY Gemfile Gemfile RUN bundle install COPY . . RUN bundle exec rake RAILS_ENV=production SECRET_TOKEN

Share enum declaration values between models

こ雲淡風輕ζ 提交于 2019-12-20 17:59:31
问题 I'm applying enum on the following attribute: transparency The same attribute (with enum) is used in two different models: Category and Post Is it possible to share the enum values between models, to avoid code duplication: enum transparency: %w(anonymous private public) 回答1: You can use a concern. module HasTransparency extend ActiveSupport::Concern included do enum transparency: %w(anonymous private public) end end Then include it in your models: class Category < ActiveRecord::Base include

Why does Rails 4.2 + responders keeps telling me to add responders to the Gemfile?

不羁岁月 提交于 2019-12-18 05:56:46
问题 I'm upgrading a Rails 4.1.8 app (also using rails-api ~> 0.3.1) to 4.2.0.rc2 and would like to retain the respond_with functionality. I've added responders to the Gemfile, but when I bin/rake spec , I get: /Users/sloveless/.gem/ruby/2.1.0/gems/actionpack-4.2.0.rc2/lib/action_controller/metal/mime_responds.rb:10:in `respond_to': The controller-level `respond_to' feature has been extracted to the `responders` gem. Add it to your Gemfile to continue using this feature: (NoMethodError) gem

No such file or directory @ rb_sysopen - public/receipts/416981.pdf

吃可爱长大的小学妹 提交于 2019-12-18 04:41:59
问题 Below on line no. 2, I am getting this error: Errno::ENOENT in OrdersController#print def generate_receipt(filename = nil, current_user = nil) filename ||= "public/receipts/#{id}.pdf" Prawn::Document.generate(filename, :page_layout => :portrait, :page_size => 'LETTER', :skip_page_creation => false, :top_margin => 50, :left_margin => 50)do |pdf| pdf_receipt_data(pdf, false, 'store_front', current_user) pdf.number_pages "<page> of <total>", :at => [0, 0] end end On my localhost this code is

No such file or directory @ rb_sysopen - public/receipts/416981.pdf

感情迁移 提交于 2019-12-18 04:41:13
问题 Below on line no. 2, I am getting this error: Errno::ENOENT in OrdersController#print def generate_receipt(filename = nil, current_user = nil) filename ||= "public/receipts/#{id}.pdf" Prawn::Document.generate(filename, :page_layout => :portrait, :page_size => 'LETTER', :skip_page_creation => false, :top_margin => 50, :left_margin => 50)do |pdf| pdf_receipt_data(pdf, false, 'store_front', current_user) pdf.number_pages "<page> of <total>", :at => [0, 0] end end On my localhost this code is

How to change the default binding ip of Rails 4.2 development server?

百般思念 提交于 2019-12-17 03:01:30
问题 After upgrading our team's rails application to 4.2, as the release note mentioned, the default ip rails server binds to is changed to localhost from 0.0.0.0 . We develop with Vagrant, and want the development server to be accessible directly from browser on the host machine. Instead of typing rails s -b 0.0.0.0 every time from now on, I wonder if there's any more elegant solution, so that we can still use sth as simple as rails s to start the server. Perhaps: a config file rails s reads