Hey people i know maybe 1% of ruby and need many help...
I migrated a system from one server to another server
When I try to insert an entry to the database using the system, I get the following error (remembering that I use ruby is 2.1):
undefined method `insert_record' for #<Array:0x007fec2a2b2fa0>
i know maybe this is a solution:
http://alok-anand-ror.blogspot.com.br/2013/11/undefined-method-insertrecord-for.html
i have gems of rake instaled 0.9.2 and 0.9.2.2
when i try run "rake db:migrate" (I think it would solve, I do not know) i received
rake aborted No rake file found
if somebody can help me I greatly appreciate.
thanks in advanced.
it seems your Rakefile is missing .
Check your rails folder should contain Rakefile with following content
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Demo::Application.load_tasks
~
and
undefined method `insert_record' for #<Array:0x007fec2a2b2fa0>
this error is because of incompatibility issues with rails and ruby , try upgrading rails
Related
Have a legacy application built on Rails 3.2.16, Ruby 1.9.3 which is being assessed for updates. Apart from the obvious in that it's running on outdated versions of both Ruby and Rails, I'm stuck with an error when trying to gather the stats.
When executing the command:
rake stats
I'm getting the error:
rake stats
rake aborted!
cannot load such file -- code_statistics
This is also correlated via the 'Rails Console' whereby issuing the command require 'code_statistics' also produces a similar error.
Now I can confirm the following
Rake task exists as shown by the rake -T giving command output of rake stats # Report code statistics (KLOCs, etc...
CodeStatistics class is in the railities library
I suspect that it's a path or file issue with potentially an environment setting that I'm missing Rails 3.2.
Any suggestions ?
Regards
Grant
Ok - so solved the problem. It was a path issue as first suspected.
After some digging in this legacy system I'm reviewing there were path changes made in rspec.rake and cuke.rake files which indicated a parent directory. Changing the path
from:
require 'code_statistics'
to
require 'rails/code_statistics'
has now resolved the issue such that rake stats gives the usual results.
In previous apps when the same database data has been required by everyone we've used seed_dumper & rake db:seed:dump to populate the seeds file and then rake db:seed.
For this app, using the Comfortable Mexican Sofa CMS gem and the fortress plugin it would be nice to do the same. Only seed_dumper only dumps the users - nothing else.
seed_dump (the 'parent' gem) gives the following error:
rake aborted!
NameError: undefined local variable or method `cms_manageable' for Comfy::Cms::Page(Table doesn't exist):Class
/usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/activerecord-4.0.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
/path to my app/app/models/comfy/cms/page.rb:9:in `<class:Page>'
Any ideas or alternate methods would be appreciated. Cheers.
Now using only gem 'seed_dump' (not seed_dumper), running the command bundle exec rake db:seed:dump works for exporting seed data.
I created a new engine in Rails 3.1.3 and apparently there's that rake task that copies over all migrations. I tried following rake abc:install:migrations which threw:
rake aborted!
Don't know how to build task 'abc:install:migrations'
(See full trace by running task with --trace)
I also tried rake abc_engine:install:migrations with the same result.
Then I read bundle exec rake railties:install:migrations or bundle exec rake railties:install:migrations FROM=abc_engine should do the trick too but no success. Nothing was copied even though no error was thrown.
My migrations are located in db/migrate/ within the engine folder and I ran all commands above from spec/dummy/
Does anyone know how to use this new rake task in order to copy migrations from the engine?
I ran this instead:
rake railties:install:migrations
And my migrations were copied from the engine.
Hope this helps.
I finally got found/got lucky with my (similar) issue. For the first error, it just disappeared, not sure why. Then I figured out that I didn't created the migrations using the usual file name format, so the ActiveRecord::Migrator.migrations method was ignoring them.
If the app you're mounting the engine to doesn't already have ActiveRecord (i.e. you're introducing ActiveRecord to your host app for the first time by mounting the engine), you can get this error as well. Specifically, you'll get this error if you don't have require "active_record/railtie" in your application.rb, or if it's commented out. That line is what enables the rake railties:install:migrations task, which is defined here. rake railties:install:migrations is, in turn, called by the rake abc_engine:install:migrations task here.
Tl;dr: try adding require "active_record/railtie" to your application.rb if it's not already there.
My hair is all gone and I'm about to throw my new macbook through the window.
I am trying to execute the famous db:migrate command and I get the following:
rake aborted!
no such file to load -- rake/dsl_definition
I am using rake 0.8.7...it's installed and included in my gemfile. I didn't have require 'rake/dsl_definition' in my rake file and I was getting the famous uninitialized-constant error. Now that I have added require 'rake/dsl_definition' to my rake file I get the error above. Anyyyyy ideas...I have searched and tried a million things with no luck... My migrations worked 2 days ago, now suddenly they don't. I have uninstalled rake 0.9.2 and also did a few other thing suggested in the link below, but nothing worked.r
How to fix the uninitialized constant Rake::DSL problem on Heroku?
heroku rake require 'rake/dsl_definition' fix not working + breaking local rake
How to fix the uninitialized constant Rake::DSL problem on Heroku?
Having rolled back your rake to 0.8.7, you need to remove the require rake/dsl-definition line from your rakefile. You only get the uninitialised constant error with later rakes.
I am trying to install the spree gem using the following instructions http://spreecommerce.com/resources/quick-start
I am getting following error on step 4.6(Populating the Database)
$ rake db:bootstrap
.....
.......
rake aborted!
couldn't parse YAML at line 6 column 50
....
.....
I am using ruby 1.9.2p0, rails 3.0.3 and spree 0.40.2.
Can anyone please tell me what could be the problem?
There's probably an error in a YAML file, not surprisingly. It's likely a fixture used in the bootstrapping process.
You can always run rake with the --trace option to get a better sense of what it was trying to do. Have a look through your fixture files to see if any are invalid, especially at the position indicated.
In boot.rb file inside config directory of my rails project home I added following and it worked.
require 'yaml'
YAML::ENGINE.yamler= 'syck'
I followed instruction from http://www.ruby-forum.com/topic/1002689