I have two models (one to many relationship between them) in rails 5,
One is ScholarshipGroup and Scholarship model with Admin namespace.
ScholarshipGroup Model:
class Admin::ScholarshipGroup < ApplicationRecord
has_many :admin_scholarships, :class_name => 'Admin::Scholarship',inverse_of: :admin_scholarship_group
end
And Scholarship Model:
class Admin::Scholarship < ApplicationRecord
belongs_to :group, :class_name=> 'Admin::ScholarshipGroup', inverse_of: 'admin_scholarships'
end
I want to need data for all scholarships under a ScholarshipGroup.
But when I run this query from rails console:
$ Admin::ScholarshipGroup.first.admin_scholarships.first
But it gives me this error:
Admin::ScholarshipGroup Load (0.3ms) SELECT "admin_scholarship_groups".* FROM "admin_scholarship_groups" ORDER BY "admin_scholarship_groups"."id" ASC LIMIT ? [["LIMIT", 1]]
ActiveRecord::InverseOfAssociationNotFoundError: Could not find the inverse association for admin_scholarships (:admin_scholarship_group in Admin::Scholarship)
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activerecord-5.0.0.1/lib/active_record/reflection.rb:202:in `check_validity_of_inverse!'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activerecord-5.0.0.1/lib/active_record/reflection.rb:402:in `check_validity!'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activerecord-5.0.0.1/lib/active_record/associations/association.rb:25:in `initialize'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activerecord-5.0.0.1/lib/active_record/associations.rb:235:in `new'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activerecord-5.0.0.1/lib/active_record/associations.rb:235:in `association'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activerecord-5.0.0.1/lib/active_record/associations/builder/association.rb:111:in `admin_scholarships'
from (irb):34
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /home/ubuntu/workspace/bin/rails:9:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.3.1#college/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Why do return this type error ? Can anyone suggest me the solution of this error ?
You defined belongs_to :group in Admin::Scholarship model.
You can try:
has_many :admin_scholarships, :class_name => 'Admin::Scholarship',inverse_of: :group, foreign_key: 'group_id'
Related
Im getting the above error but dont understand why. Here is the stack trace:
/Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/app/models/user.rb:8:in `<class:User>': undefined method `validates_confirmation_of' for User:Class (NoMethodError)
from /Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/app/models/user.rb:4:in `<top (required)>'
from /Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/app/data_mapper_setup.rb:6:in `require_relative'
from /Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/app/data_mapper_setup.rb:6:in `<top (required)>'
from /Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/app/app.rb:4:in `require_relative'
from /Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/app/app.rb:4:in `<top (required)>'
from /Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/spec/spec_helper.rb:3:in `require'
from /Users/benrumble/Desktop/Apple_tv_movies_and_stuff/skeletons/Full_Stack_Sinatra_App_Skeleton/Skeleton_App_with_user_login:sign_up_and_bcrypt/spec/spec_helper.rb:3:in `<top (required)>'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration.rb:1394:in `require'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration.rb:1394:in `block in requires='
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration.rb:1394:in `each'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration.rb:1394:in `requires='
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration_options.rb:112:in `block in process_options_into'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration_options.rb:111:in `each'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration_options.rb:111:in `process_options_into'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/configuration_options.rb:21:in `configure'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/runner.rb:99:in `setup'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/runner.rb:86:in `run'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/runner.rb:71:in `run'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.5.0/exe/rspec:4:in `<top (required)>'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `load'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `<main>'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/benrumble/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
and here is the user.rb model
require 'bcrypt'
require 'dm-validations'
class User
attr_reader :password
attr_accessor :password_confirmation
validates_confirmation_of :password
include DataMapper::Resource
property :id, Serial
property :email, String
property :password_digest, String, length: 60
def password=(password)
#password = password
self.password_digest = BCrypt::Password.create(password)
end
end
I tried with and without 'dm-validations' but it doesnt make a difference.
Any help would be great.
Thanks
I solved this issue by moving the
include DataMapper::Resource
line as the first line after declaring the class.
I was trying to add my custom implementation for ActiveRecordss find_in_batches method. First, I tried to monkeypatch the corresponding module:
module ActiveRecord
module Batches
def find_in_batches2
end
end
end
Task.find_in_batches2 do |group|
end
But ruby said:
NoMethodError: undefined method `find_in_batches2' for Task (call 'Task.connection' to establish a connection):Class
/home/yuri/.gem/ruby/2.1.5/gems/activerecord-4.2.0/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/srv/http/tm/Rakefile:15:in `<top (required)>'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/yuri/.gem/ruby/2.1.5/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
-e:1:in `<main>'
Then I tried following this answer, to no avail. What am I doing wrong and why is it so hard?
Here is the solution:
ActiveRecord::Batches.module_eval do
def find_in_batches2
end
end
ActiveRecord::Querying.module_eval do
delegate :find_in_batches2, :to => :all
end
Don't forget to implement find_in_batches2.
So I have the class 'Range' created by Datamapper (this is in a Ruby/Sinatra project):
class Range
include DataMapper::Resource
#properties
property :id, Serial, :key => true
property :default_gateway, String
property :subnetmask, String
property :main_ip, String
property :backup_ip, String
property :dhcp, String
#relations
belongs_to :vlan, :required => true
has n, :dhcp
end #class Range
I also have a file 'initdata' which I call in my main class. A part of this file tries to fill up the database with some dummy data. The problem is with the class Ranges it gives me an ArgumentError.
Initdata ruby file:
#CREATE RANGES
if Range.count == 0
puts '----- ADDING RANGES -----'
range1 = Range.first_or_create(:default_gateway => '10.1.2.44', :subnetmask => '0.0.255.255', :main_ip => '10.1.0.1', :backup_ip => '10.1.0.2', :dhcp => '192.168.1.2', :vlan_id => 1)
range1.errors.each do |error|
puts error
end
end
I get the following error when I run it in the terminal:
----- ADDING RANGES -----
/home/bene/.rvm/gems/ruby-2.1.3/gems/dm-validations-1.2.0/lib/dm-validations.rb:129:in `initialize': wrong number of arguments (1 for 2..3) (ArgumentError)
from /home/bene/.rvm/gems/ruby-2.1.3/gems/dm-validations-1.2.0/lib/dm-validations.rb:129:in `new'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/dm-validations-1.2.0/lib/dm-validations.rb:129:in `create'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/dm-core-1.2.0/lib/dm-core/model.rb:444:in `first_or_create'
from /home/bene/project/development_sam/lan_portal/dal/initdata.rb:328:in `<top (required)>'
from /home/bene/project/development_sam/lan_portal/app.rb:6:in `require'
from /home/bene/project/development_sam/lan_portal/app.rb:6:in `<top (required)>'
from /home/bene/project/development_sam/lan_portal/config.ru:1:in `require'
from /home/bene/project/development_sam/lan_portal/config.ru:1:in `block in <main>'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from /home/bene/project/development_sam/lan_portal/config.ru:in `new'
from /home/bene/project/development_sam/lan_portal/config.ru:in `<main>'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
from /home/bene/.rvm/gems/ruby-2.1.3/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
from /home/bene/.rvm/gems/ruby-2.1.3/bin/rackup:23:in `load'
from /home/bene/.rvm/gems/ruby-2.1.3/bin/rackup:23:in `<main>'
from /home/bene/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
from /home/bene/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
Does anyone have any idea what I might be doing wrong? I've searched for it, but most solutions are because people wrote their own 'initialize' function, as in my case, it's already defined by DataMapper
There is a core Ruby class Range (which, incidentally, has a 2..3-argument constructor); Appearently, DataMapper does not redefine a constructor if one already exists.
You need to rename your class.
When I start guard and save a rspec request, I always get this error,
I referred to this tutorial, http://railscasts.com/episodes/275-how-i-test
uninitialized constant ActiveRecord::Base (NameError)
See below,
/home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:16:in `<module:ActiveRecord>': uninitialized constant ActiveRecord::Base (NameError)
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:6:in `<module:Adapters>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:5:in `<module:Audited>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record/audit.rb:4:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited/adapters/active_record.rb:3:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/audited-activerecord-3.0.0/lib/audited-activerecord.rb:2:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /home/think/.rvm/gems/ruby-1.9.3-p385#global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /home/think/jonathan/organizor/config/application.rb:7:in `<top (required)>'
from /home/think/jonathan/organizor/config/environment.rb:2:in `require'
from /home/think/jonathan/organizor/config/environment.rb:2:in `<top (required)>'
from /home/think/jonathan/organizor/spec/spec_helper.rb:3:in `require'
from /home/think/jonathan/organizor/spec/spec_helper.rb:3:in `<top (required)>'
from /home/think/jonathan/organizor/spec/requests/password_resets_spec.rb:1:in `require'
from /home/think/jonathan/organizor/spec/requests/password_resets_spec.rb:1:in `<top (required)>'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
from /home/think/.rvm/gems/ruby-1.9.3-p385/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'
I havent done rails testing. This is my first time. I certainly know that some config I have missed. Please help.
This is amazing, I had a empty file in lib directory called, "active_record.rb", this was being loaded instead of rails ActiveRecord. Hence, the uninitialized name error. Guys, be careful what you name your classes that you are going to keep under lib. It overrides.
Gosh, ate one day to figure this out.
Background: I'm building a simple blog using Padrino, Ruby 1.9.2,
HAML, and Heroku. I want the posts index to have a magazine-like look
to it. For each post in the index, the user should see titles, content
teasers, and images. My problem is with attaching the images.
Problem: I've been trying to use the Paperclip gem to attach an image
to each post. Heroku will fish the actual image from an Amazon S3 bin.
So far, when I try to run a migration, I get the error:
$ .../base.rb:1088:in `method_missing': undefined method
`has_attached_file' for #<Class:0xa672140> (NoMethodError)
It looks like Paperclip just won't load, but there's where I get
stuck.
Details:
--Q: What am I doing when I "try to run a migration"?
--A: I put the following into the migrations folder
class AddPictureToPost < ActiveRecord::Migration
def self.up
change_table :posts do |t|
t.has_attached_file :picture
end
end
def self.down
drop_attached_file :posts, :picture
end
end
then run "padrino rake ar:migrate"
--Q: Do I have Paperclip listed in the Gemfile?
--A: Yes.
--Q: What does the post model look like?
--A:
class Post < ActiveRecord::Base
has_attached_file :picture,
:storage => :s3,
:bucket => 'blog_images',
:s3_credentials => {
:access_key_id => ENV['S3_KEY'],
:secret_access_key => ENV['S3_SECRET']
}
end
--Q: What does the app.rb look like?
--A:
class Blog < Padrino::Application
register Padrino::Rendering
register Padrino::Mailer
register Padrino::Helpers
enable :sessions
get '/' do
haml :index
end
end
--Q: What does boot.rb look like?
--A:
PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||=
"development" unless defined?(PADRINO_ENV)
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?
(PADRINO_ROOT)
require 'rubygems' unless defined?(Gem)
require 'bundler/setup'
Bundler.require(:default, PADRINO_ENV)
Padrino.before_load do
end
Padrino.after_load do
end
Padrino.load!
--Q: What does the full error output look like?
--A:
jared:~/blog$ padrino rake ar:migrate
=> Executing Rake ar:migrate ...
/usr/local/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/
active_record/base.rb:1088:in `method_missing': undefined method
`has_attached_file' for #<Class:0xa1ffb30> (NoMethodError)
from /home/jared/isthmus2/app/models/post.rb:2:in `<class:Post>'
from /home/jared/isthmus2/app/models/post.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:640:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/reloader.rb:148:in `safe_load'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:162:in `block in require_dependencies'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `require_dependencies'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/application.rb:34:in `inherited'
from /home/jared/blog/app/app.rb:1:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:640:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/reloader.rb:148:in `safe_load'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:162:in `block in require_dependencies'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `require_dependencies'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:148:in `locate_app_object'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:30:in `initialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:221:in `new'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/mounter.rb:221:in `mount'
from /home/jared/blog/config/apps.rb:34:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `block in load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:640:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:223:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/
active_support/dependencies.rb:240:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/reloader.rb:148:in `safe_load'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:162:in `block in require_dependencies'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:160:in `require_dependencies'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:70:in `block in load!'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:70:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/loader.rb:70:in `load!'
from /home/jared/blog/config/boot.rb:29:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:56:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:56:in `block in rake'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:140:in `capture'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/lib/
padrino-core/cli/base.rb:56:in `rake'
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/task.rb:
22:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/
invocation.rb:118:in `invoke_task'
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor.rb:
263:in `dispatch'
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.14.6/lib/thor/base.rb:
389:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/padrino-core-0.10.5/bin/
padrino:9:in `<top (required)>'
from /usr/local/bin/padrino:19:in `load'
from /usr/local/bin/padrino:19:in `<main>'
If you've read this far...THANKS! I hope you can help me shed some
light on this.
Paperclip is rails agnostic so you need to put in boot.rb in Padrino.before_load this:
ActiveRecord::Base.send(:include, Paperclip::Glue)
File.send(:include, Paperclip::Upfile)
Paperclip.options[:logger] = Padrino.logger
Finally to run migrations under heroku you should run first locally padrino rake gen this will create a Rakefile so you should able to run simply: heroku rake ar:migrate