I have installed the time_splitter gem so that I can use a single date_time field. My bundle includes version 1.0.0. As recommended here, I added this code to my class Sheet:
extend TimeSplitter::Accessors
split_accessor :event_time
I am getting an error on the extend:
NameError in SheetsController#new
uninitialized constant Sheet::TimeSplitter
I'm about to give up and hack together a date/time solution but was hoping for something more elegant. Thanks in advance for your help.
You need to restart your server. Happened to me :)
Related
How do I install the Alchemist gem?
I have added gem 'alchemist' to my Gemfile
bundle install
then I try 10.miles.to.kilometers and get an error: undefined methodmiles'`
according to alchemist I have to add Alchemist.setup somewhere. Where do I add this?
I don't know the gem, but you can try to put it in an initializer, ie in config/initializers/alchemist.rb:
Alchemist.setup
Restart your app after you have added this file.
In terms of your second problem. If you call to_f on an Alchemist::Measurement it gives you the value in terms of the base (in this case meters). If you want to get the number of kilometers you need to call value on it:
irb(main):005:0> 10.miles.to.kilometers.value
=> 16.09344
There might be a useful discussion on if I should change these if they are confusing.
I have an inherited project using the creole gem (0.5.0).
In my view this line seems to break but I can't find out anything about it:
<%= WikiCreole.creole_parse(#a.content) %>
The error message is NameError in Knowledgebase_article#view uninitialized constant ActionView::Base::CompiledTemplates::WikiCreole. If this line is removed then the page will render fine.
The problem is I can't seem to find out much about the error anywhere so I was hoping that someone on SO would know where to start.
Please try <%= Creole.creolize(#a.content)%>
Thanks
Just found the answer as to why my specific setup wasn't working, first of all I hadn't installed the WikiCreole gem, so:
gem install WikiCreole
Then, I was missing the require statement from my model:
require 'wiki_creole'
I'm sure this is an easy question but I'm having a hard time figuring out what to Google.
I'm trying to use the library ChunkyPNG.
I added it to my Gemfile and did a bundle install.
bundle list | grep "chunky"
* chunky_png (1.2.5)
So far so good.
I try using it in my controller:
image = ChunkyPNG::Canvas.from_data_url(params[:data]).to_image
(The docs for this method are available here)
It results in the following error:
NameError in MyController#create
uninitialized constant MyController::ChunkyPNG
Why is prepending the controller namespace? I imagine that's what is causing the error.
Otherwise, it means that ChunkyPNG is not install (and it clearly is).
Am I not able to use this gem upfront without writing some sort of rails plugin to wrap around it?
Thanks
EDIT:
Question has been answered, see #apneadiving's comment
In your controller, or somewhere else in the app do:
require 'chunky_png'
I'm having this strange error for the devise_invitable extension:
uninitialized constant ActiveSupport::SecureRandom
But the strange thing is that I don't know how to load that module anyway, like if in my console I execute ActiveSupport, thats fine and responds with true but not that SecureRandom class, or ActiveSupport::SecureRandom, and like I know its part of ActiveRecord, it's in the docs here: http://api.rubyonrails.org/classes/ActiveSupport/SecureRandom.html
How would you start troubleshooting an issue like this?
More Details
So it seems the class SecureRandom works as is, but not when called as part of ActiveSupport like ActiveSupport::SecureRandom, why would this be?
I fixed this by switching to the master branch of Devise on my 3-1-stable Rails application.
gem 'devise', :git => "git://github.com/plataformatec/devise"
I ran into this issue with the activeadmin gem and solved it with a hack at the top of devise.rb
ActiveSupport::SecureRandom = SecureRandom
Source: http://coderwall.com/p/fttpra
I'm attempting to get Thinking Sphinx working w/ Delayed Jobs but I am not having any success. I keep getting the following error:
uninitialized constant ThinkingSphinx::Deltas::DelayedDelta
I have thinking-sphinx (2.0.2), delayed_job (2.1.3), and ts-delayed-delta (1.1.1) installed. I have restarted sphinx using rake ts:restart. I don't really know what else to try. Any suggestions?
Hey Kyle, I'm using the exact same stack with no problems whatsoever.
Please, make sure you have something like this in your Gemfile:
gem 'ts-delayed-delta', '1.1.1', :require => 'thinking_sphinx/deltas/delayed_delta'
If that doesn't help it'd be nice if you provided us with some more context. Backtrace would be nice.