Because of timing I think, when I am executing one of my initializers, I don't have access to Rails.logger.info. Is there a trick? I can't actually even find where Rails.logger is actually set up!
i think this will solve your issue. please let me know
RAILS_DEFAULT_LOGGER.info "abc"
Related
I'm starting up with Backburner to run some jobs in the background of my app. I've tried following the documentation under "Working Jobs", but I'm clearly doing something very obvious and very incorrect.
Gemfile:
gem 'backburner'
Rakefile:
require_relative 'config/application'
require 'backburner/tasks'
Rails.application.load_tasks
And then in the rails console:
rake backburner:work
(which I think will just run all pending, enqueued backburner jobs.)
But all I get is the error: NameError: undefined local variable or method 'work' for main:Object from (pry):1:in '__pry__'
I sorta know what pry does (I use it to throw binding.pry into my code to debug, but that's about it), but I have no idea how it might be causing this. Not to mention I'm still pretty weak on the whole jobs and rake task front in general.
Any help would be much appreciated!
Apparently I'm in the business of asking dumb questions, lately. I was passing a variable to my Backburner.enqueue that is an ID, so I expected it to be numerical, like so: #admin.id. This would have been fine if #admin was defined in the scope of the helper I'm calling my enqueue in, but I'm actually passing that variable to that helper method...which means #admin is not defined, which, guess what Daniel, means #admin.id is undefined. Which means that I'm hitting the job anyways (because no, Backburner is in fact NOT breaking), but I'm not getting the job enqueued the way I thought I was because I was passing an invalid property to it.
So it sort of turns out that the error I got looked completely unrelated to the issue, but there it is. Always pass the variables your methods are expecting, or else expect errors.
EDIT:
Also, I can't downvote my own post. I tried. It deserves it.
EDIT 2:
Turns out it's really hard/not supported to get beanstalkd going on Heroku. Der. Also should have checked that. I just liked how beanstalkd was handling some things and went with it before getting to deploy and realizing it was a no-go.
Instead, I went with Resque as suggested by Heroku. They also support Delayed Job (DJ), but noted it is pretty heavy and Resque is better.
All that to say, I finally got to where I needed to go with Resque, and because it was such a thing I made a little documentation to help me (and maybe any other sad soul who stumbles across this lame post) get background workers running on a Heroku-hosted Rails app in the future. Be warned: it really is a guide for dummies like me, since I had to puzzle out a lot of what now is fairly obvious to me. There are gaps in the Resque documentation that I've included, which really just boils down to being explicit about what certain things mean, and where things go.
The title says it all, and I'm very confused. I can't find any other potential solutions to this issue... is anyone able to help me troubleshoot? I sure would apppreciate it...
Things I've tried:
Reinstalling yumex.
Running yum update again..
I was hoping to avoid doing a complete undo of the large update, because that seems like overkill... If I could just see why exactly authentication gets rejected, I feel like I might be able to uninstall one or two things and fix it...
UPDATE: Sorry guys, I'm retarded. I actually just needed to restart... Nothing told me that this would be necessary, so it slipped my mind that it might be. Thanks anyway if I wasted your time by making you think about this question.
I have had the same problem using korora. the only way I can acces yumex/ software install or any type of things like that are
#notroot $ su
#notroot $ password
#root $ yumex --root
and it would open
I'm using the gem rack-google-analytics in my rails project but when I run it in production mode I get an error.
rack-google-analytics-0.11.0/lib/rack/google-analytics.rb:11:in `initialize': Tracker must be set! (ArgumentError)
I'm trying to find out what this means. initialize': Tracker must be set!
in my application.rb file I have this at the bottom of it.
if Rails.env == "production"
config.middleware.use("Rack::GoogleAnalytics", :web_property_id => "UA-18760745-1")
end
If O take that out the error goes away so it has something to do with initializing this behavior, but just not quite sure why.
Anyone ran into this issue and have a solution to it, that they could share.
The only answer I could find was to not use that Gem and use this one instead as it works right out of the box. Maybe someone else can prove me wrong, which I hope.
Hope this other link helps someone else.
https://github.com/bgarret/google-analytics-rails#readme
Don't know if it helps, but here is my code:
config.middleware.use Rack::GoogleAnalytics, :tracker => 'UA-XXXXXXXX-1'
in application.rb
I'm assuming it requires a value for the :tracker symbol upon initialization (I'm following this readme on the gem's GitHub: https://github.com/kangguru/rack-google-analytics)
Obviously, replace XXXXXXXXX with your organization's tracker code.
And it seems like setting the :web_property_id symbol is a feature of a different (but similarly named) gem, rack-google_analytics: https://github.com/ambethia/rack-google_analytics
I googled trying to find the answer, but failed.
It's actually a quick question, and i just don't have enough memory-management and objective-understanding to solve it properly by myself.
If someone ever user WEPopover library(great tool, thanks to developers https://github.com/werner77/WEPopover), they remember that there is a warning in WEPopoverController.m:
//First force a load view for the contentViewController so the popoverContentSize is properly initialized
contentViewController.view;
and the warning as follows:
Property access result unused - getters should not be used for side effects
I'm not pretty sure what are they trying to achieve, but i truly believe it's not a propoer way to initialize things, but i am not sure if i should use any methods, because i don't want to disturb the functionality.
Any advices and hints will be hihgly appreciated!
I just solved it, I had the same issue! :)
just replace contentViewController.view; with [contentViewController view];
That's all. You might solved it, as you've asked it a longtime before! But it would be helpful to other if they will find the same issue:)
Got an error
uninitialized constant Formtastic::FormBuilder(NameError)
And this, in my config/initializers/client_side_validations.rb
require 'client_side_validations/formtastic' if defined?(::Firntastic)
#seems like comment this line out will fix the problem
#but I need Formtastic here
Did some research and found out this issue may probably caused by the version of client_side_validation.
Here by, I provied the version of the gem
formstastic(1.2.4)
client_side_validations(3.1.0)
If you know anything about this, anything, do tell me.
Looks to my eyes like a couple of typos: "Firntastic" and "formstastic". You've probably solved this already, but if not, give those a look.