activesupport

rails activesupport notifications - wrong db runtime value

做~自己de王妃 提交于 2019-12-13 11:55:59
问题 I'm trying to log requests for my REST API application. I'm using rails notifications for this , like here http://railscasts.com/episodes/249-notifications-in-rails-3 I can't understand how to solve one problem with rails notifications. my initializer code ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload| p name p start p finish p id p payload end Controller respond section class PostsController < ApplicationController # GET /posts

Activesupport / Multi json: “Did not recognize your adapter specification”

会有一股神秘感。 提交于 2019-12-13 04:24:20
问题 I have a Ruby 1.9.3 / Rails 3.1 project with the following in the gemfile: gem 'rails', '3.1.12' gem 'json' gem 'multi_json', '1.7.7' That version of rails sets activesupport to 3.1.12 as well. I'm not sure what the exact cause of the problem is, but when running bundle exec rake test , I got the error: /home/user/.gem/ruby/1.9.3/gems/multi_json-1.7.7/lib/multi_json.rb:121:in 'rescue in load_adapter': Did not recognize your adapter specification. (ArgumentError) ... (more stack trace,

Rails Custom Logger Writes To Log Sporadically

左心房为你撑大大i 提交于 2019-12-13 02:48:43
问题 I've set up a custom logger in an initializer: # /config/initializers/logging.rb log_file = File.open("#{Example::Application.config.root}/log/app.log", "a") AppLogger = ActiveSupport::BufferedLogger.new(log_file) AppLogger.level = Logger::DEBUG AppLogger.auto_flushing = true AppLogger.debug "App Logger Up" Although it creates the log file when I start the application, it doesn't write to the log file. Either from AppLogger.debug "App Logger Up" in the initializer or similar code elsewhere in

Warbler not including ActiveSupport locale files

半腔热情 提交于 2019-12-13 01:08:22
问题 I am using Rails 3.1.3, JRuby 1.7.6, and Warbler 1.3.8 Note This was not happening when using JRuby 1.6.7 - but we recently tried to update the JRuby version, and that is when this issue started. We use Warbler to package our ruby on rails application into a WAR file. That process pre-compiles all the assets and everything works fine (seems to work fine, the command is successful) We then deploy the WAR file with our Software (which uses a JRuby environment - 1.7.6 - and uses Jetty as a web

How does ActiveSupport do month sums?

☆樱花仙子☆ 提交于 2019-12-12 13:57:18
问题 I was pleased and surprised to find that ActiveSupport does month sums in the way I wanted it to. Regardless of how many days are in the months in question, adding 1.month to a particular Time will land you on the same day-of-the-month as the Time . > Time.utc(2012,2,1) => Wed Feb 01 00:00:00 UTC 2012 > Time.utc(2012,2,1) + 1.month => Thu Mar 01 00:00:00 UTC 2012 the months method in Fixnum provided by activesupport does not give clues: def months ActiveSupport::Duration.new(self * 30.days, [

cocoapods activesupport conflicts ios development

♀尐吖头ヾ 提交于 2019-12-12 13:16:50
问题 I tried reporting this issue on the cocoapods project but was directed to post here. I recently took on a project where I work and I am having trouble getting what the previous consultant setup to function on my local workstation. I was able to successfully install the cocoapods gem, however, when I run pod install it blows up.... specification.rb:1990:in `raise_if_conflicts': Unable to activate xcodeproj-0.14.1, because activesupport-4.0.0.rc1 conflicts with activesupport (~> 3.0) (Gem:

Difference between mattr_accessor and cattr_accessor in ActiveSupport?

▼魔方 西西 提交于 2019-12-12 08:47:03
问题 I can't work out from looking through the source what the difference is between the cattr_* and mattr_* methods provided in Class and Module respectively. I read this question: What is mattr_accessor in a Rails module? which gives some details about both methods but doesn't highlight the differences. So my question is what is the difference between them and why do we need both sets of methods when they are practically identical in the source? Also, which should we use when? 回答1: Module is the

How to recover an integer from an ActiveSupport::Duration object

戏子无情 提交于 2019-12-12 03:06:59
问题 How can I recover the integer corresponding to an ActiveSupport::Duration object? At the same time, is it possible to recover the type of time duration? exemple: foo = 2.day bar = foo.duration_integer # expected "2" baz = foo.duration_type # expected "day" or "days" 回答1: You can use the parts accessor like this. The first element is what you call the duration_type and the last one the integer value: 2.day.parts => [:days, 2] 来源: https://stackoverflow.com/questions/28647309/how-to-recover-an

Failed WATIR installation Server 2003

走远了吗. 提交于 2019-12-11 12:36:21
问题 I had to rebuild my box and I currently am unable to install Watir. gem install watir ERROR: Error installing watir: activesupport requires Ruby version >= 1.8.7. Which would be fine if Watir was able to use Ruby 1.8.7 . I am using ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] gem -v 1.3.7 I am not sure when this started to occur, but the documentation on the site is lacking. 回答1: On Windows XP (Professional, Version 2002, Service Pack 3, fully pathched) I have installed

Rails 5 production error activesupport

試著忘記壹切 提交于 2019-12-11 06:25:11
问题 i have a 5.0.0.1 project that got problem deploying it. i use capistrano to deploy and it runs puma for me too. puma gets run and "Somthing went wrong" error shows up. And now i have problem running project in my local development, weird! this errors shows up: ‍‍You have already activated activesupport 5.1.2, but your Gemfile requires activesupport 5.0.0.1. Prepending bundle exec to your command may solve this. (Gem::LoadError) And yes im only able to run project locally with bundle exec