I have added new fields to Devise and did rake db:migrate, etc, and it seems to work fine on local host, however on Heroku I get the following error in my logs claiming there is an unidentified method:
https://gist.github.com/1179667
Any help or advice would be appreciated.
Thanks,
So looks like my problem was a combination of a spelling mistake in my user.rb and having zipcode there also which wasn't in the form.
Related
I am finishing the book and I've ignored this error message for too long. Please help me understand how to fix this. Thank you!
1) Error:
PasswordResetsTest#test_password_resets:
NoMethodError: undefined method reset_sent_at=' for #<User:0x007f814e118600>
app/models/user.rb:63:increate_reset_digest'
app/controllers/password_resets_controller.rb:12:in create'
test/integration/password_resets_test.rb:17:inblock in '
The error might point you a little bit into the wrong direction. This NoMethodError is actually caused by that fact that your users table doesn't have a column reset_sent_at.
Rails defines accessor methods (getters and setters) on your User model for each column in the users table. However, since it doesn't have a reset_sent_at column, no accessor is defined and the NoMethodError is being raised.
Make sure you've created the migration where reset_sent_at was added to users (this was done in chapter 10 of the Rails tutorial), and that you have executed the migration as well. After the migration, be sure to restart your Rails server.
I'm using the latest version of the Impressionist and Rails Admin gems, and wondering if anyone could shed some light on an annoying conflict I'm experiencing. The problem is roughly documented here - https://github.com/sferik/rails_admin/issues/1315, yet the vaguely described solution is not working for me. When I have the line is_impressionable in my Listing model, I get an error when starting my Rails server with rails s:
...rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined local variable or method `is_impressionable' for Listing(no database connection):Class (NameError)
If I first start the server, and then add the 'is_impressionable' line, everything works fine, so the problem only occurs during initialization. I don't fully understand the initialization process, so am not sure how to go about getting this to work.
I have tried moving all my rails_admin model configuration options to their respective models, rather than in the initializer, which had no effect. I also have the following line in my initializer:
config.included_models = [Listing,ListingImage,AllOtherModelsHere...]
I have tried adding single quotes around these model names, which results in the following errors, as described in the github issue here
[RailsAdmin] Could not load model Listing, assuming model is non existing. (undefined local variable or method `is_impressionable' for Listing(no database connection):Class)
Any ideas what else I can try to make these gems work together? I don't want to have to remove the is_impressionable line every time I want to restart the server or generate a migration...
Not sure if the same issue that I had but yet I will post what worked for me just in case someone struggles with this too:
Im on a ruby 2.1.5 project with rails 4.2.0 and among other gems I'm using rails admin.
I run into several weird problems trying to set this up. For instance if I added the is_impressionable call within one of my models for some reason the execution of that file stopped there and I started getting weird errors like any method declared below the is_impressionable failed with undefined error.
So what I end up doing was:
class MyModel < ActiveRecord::Base
include Impressionist::IsImpressionable
is_impressionable
end
So this solved my issue and now i can access #my_model_instance.impression_count as expected.
I changed every occurrence of Klass to 'Klass'.constantize in initializer.
I ran a migration on an Image model to add the column Position.
The schema is updated, the column has actually been added to the database, and is accessible through Rails console. I'm even calling an order by clause using that column in ActiveAdmin, and that doesn't grumble .
However when trying to access that attribute in the app, I'm presented with unknown attribute errors.
When trying to display the column in an ActiveAdmin index view, I get:
undefined method `position' for #<Image:0x007f8a3429be98>
It (position) has been added to attr_accessible too.
I've also run:
Image.connection.schema_cache.clear!
Image.reset_column_information
and that hasn't helped either.
Rails 3.2.12
After some searching and trying I was able to reproduce the error it was triggered by a before filter.
This post led me to the solution:
Undefined method "reorder" for #<Array:0xbc38600> using ActiveAdmin
when it helped please upvote the other comment.
I'm using Herkou for some Rails 3 hosting. I have pushed code to Heroku, and I am getting the following error from the logs:
NoMethodError (undefined method `format_date' for #<Project:0x00000001938f40>):
This method does exist! I can for example so this:
$heroku console
>> Project.format_date('2011-07-07 10:50')
=> "2011-07-07"
So my code appears to be deployed. Project responds to format_date.
I also tried heroku restart with no success.
Can anyone help me? Any and all suggestions are appreciated!
Are you sure you are calling format_date on the class itself, like you do in your example, and not on an instance of the class? I.e. Project.new.format_date("2011-07-07 10:50")
I'm having a problem implementing the example in the actaswizard readme, and I was wondering if my error would be obvious to anyone here.
My controllers, models, and migrations are exactly as shown here: https://github.com/adkron/actsaswizard
My routes are as follows:
match 'test' => 'employees#new'
resources :employees
However when I navigate to localhost/test I recieve the following error:
NoMethodError (undefined method state' for #<Employee:0x00000001c22ad0>):
app/controllers/employees_controller.rb:10:inedit'
Does anyone recognize this error, or have any advice on how to get around it? Thanks in advance for any help! In addition, if you know of any good guides or additional examples using this plugin I'd be grateful for them as well.
I think that the actsaswizard uses the AASM (acts as state machine) to navigate you through the steps. That is why you need to specify a field "state" for the model that actsaswizard! This means that you must run a migration that makes a column named state of string type. Let me know if that worked!