sqlite and ruby generate command problem - ruby-on-rails

When I run the command
$rails generate scaffold User name:string email:string
/home/user/.rvm/gems/ruby-1.9.2-p290#rails3tutorial/gems/sqlite3-1.3.3/lib/sqlite3/sqlite3_native.so: [BUG] Segmentation fault
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
I get the above error...
I installed sqlite but it is version 2.8.17
my gem list returns this:
actionmailer (3.1.0.rc8)
actionpack (3.1.0.rc8)
activemodel (3.1.0.rc8)
activerecord (3.1.0.rc8)
activeresource (3.1.0.rc8)
activesupport (3.1.0.rc8)
addressable (2.2.6)
ansi (1.3.0)
arel (2.2.1)
bcrypt-ruby (3.0.0)
builder (3.0.0)
bundler (1.0.18)
coffee-rails (3.1.0.rc.7)
coffee-script (2.2.0)
coffee-script-source (1.1.2)
erubis (2.7.0)
execjs (1.2.4)
heroku (2.6.1)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.13)
launchy (2.0.5)
mail (2.3.0)
mime-types (1.16)
multi_json (1.0.3)
polyglot (0.3.2)
rack (1.3.2)
rack-cache (1.0.3)
rack-mount (0.8.3, 0.8.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.0.rc8)
railties (3.1.0.rc8)
rake (0.9.2 ruby)
rdoc (3.9.4)
rest-client (1.6.7)
rubyzip (0.9.4)
sass (3.1.7)
sass-rails (3.1.0, 3.1.0.rc.7)
sprockets (2.0.0, 2.0.0.beta.15)
sqlite3 (1.3.4, 1.3.3)
term-ansicolor (1.0.6)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
turn (0.8.2)
tzinfo (0.3.29)
uglifier (1.0.2)
any ideas ? :/

Related

Cannot use symbols as values in my rails queries with psql

I've just tried to add translation_center to my app but have come across numerous errors.
There is a line in the translation_center gem which uses a symbol as a value for an attribute when creating a new active record object. The line reads:
translation = self.translations.build(value: self.name.to_s.split('.').last.titleize, lang: :en, status: 'accepted')
notice the
lang: :en
part
this raises an error
PG::UndefinedColumn: ERROR: column translation_center_translations.en does not exist
if I replace this part with
lang: 'en'
then it works fine
This is just one issue, there are a few others that raise this kind of error all related to symbols in the queries. e.g now whenever I call i18n.t(:a_symbol) I get an error
I'm using Rails 3.2.19 and translation_center 1.7.0
I found this "When using Postgres along with the Geocoder gem, your queries cannot use symbolized keys" in this issue Receiving the error PG::UndefinedColumn: ERROR: column mymodels.distance does not exist when using Geocoder's near method
I am not using geocoder, but I wonder if any of my other gems could be causing this conflict.
Here is my list of gems
bundle show
Gems included by the bundle:
RedCloth (4.2.9)
ZenTest (4.5.0)
actionmailer (3.2.19)
actionpack (3.2.19)
activemodel (3.2.19)
activerecord (3.2.19)
activeresource (3.2.19)
activesupport (3.2.19)
acts_as_votable (0.10.0)
amq-protocol (1.9.2)
ancestry (2.1.0)
arel (3.0.3)
audited (3.0.0)
audited-activerecord (3.0.0)
bcrypt (3.1.7)
bcrypt-ruby (3.1.5)
better_errors (1.1.0)
binding_of_caller (0.7.2)
bootstrap-sass (3.0.3.0)
bootstrap-wysihtml5-rails (0.3.1.24)
builder (3.0.4)
bullet (4.11.3)
bundler (1.6.0)
bunny (1.0.7)
capistrano (2.15.5)
capistrano-ext (1.2.1)
celluloid (0.15.2)
chronic (0.10.2)
cocoon (1.1.2)
coderay (1.1.0)
coercible (1.0.0)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.7.0)
country-select (1.1.1)
date_validator (0.7.0)
debug_inspector (0.0.2)
declarative_authorization (0.5.7)
descendants_tracker (0.0.4)
devise (3.0.4)
devise_invitable (1.2.1)
diff-lcs (1.2.5)
erubis (2.7.0)
ethon (0.7.1)
exception_notification_rails3 (1.2.0)
excon (0.38.0)
execjs (2.2.1)
factory_girl (4.4.0)
factory_girl_rails (4.4.1)
ffi (1.9.3)
fog (1.22.1)
fog-brightbox (0.1.1)
fog-core (1.22.0)
fog-json (1.0.0)
font-awesome-rails (4.1.0.0)
formatador (0.2.5)
formtastic (2.2.1)
gon (5.1.0)
guard (2.6.1)
guard-rspec (4.2.10)
haml (4.0.5)
haml-rails (0.4)
haml_scaffold (1.1.0)
highline (1.6.21)
hike (1.2.3)
hodel_3000_compliant_logger (0.1.1)
i18n (0.6.11)
inflecto (0.0.2)
ipaddress (0.8.0)
journey (1.0.4)
jqtree-rails (0.1.8.1)
jquery-datatables-rails (1.12.2)
jquery-rails (3.1.1)
jquery-ui-rails (4.2.1)
json (1.8.1)
libv8 (3.16.14.3)
listen (2.7.9)
lodash-rails (2.4.0)
lumberjack (1.0.9)
mail (2.5.4)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.0)
mocha (1.1.0)
multi_json (1.10.1)
net-scp (1.2.1)
net-sftp (2.1.2)
net-ssh (2.9.1)
net-ssh-gateway (1.2.0)
newrelic_rpm (3.9.0.229)
nifty-generators (0.4.6)
nokogiri (1.6.3.rc3)
oink (0.10.1)
oj (2.9.9)
orm_adapter (0.5.0)
pg (0.17.1)
polyamorous (0.6.4)
polyglot (0.3.5)
pry (0.9.12.6)
pry-doc (0.6.0)
pry-nav (0.2.3)
pry-rails (0.3.2)
puma (2.8.2)
rabl (0.10.1)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.4)
rack-test (0.6.2)
rails (3.2.19)
railties (3.2.19)
rake (10.3.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
rdoc (3.12.2)
ref (1.0.5)
request_store (1.0.6)
routing-filter (0.3.1)
rspec (3.0.0)
rspec-core (3.0.2)
rspec-expectations (3.0.2)
rspec-mocks (3.0.2)
rspec-rails (3.0.1)
rspec-support (3.0.2)
rvm-capistrano (1.5.3)
sass (3.3.9)
sass-rails (3.2.6)
slop (3.5.0)
spork (0.9.2)
spring (1.1.3)
spring-commands-rspec (1.0.2)
sprockets (2.2.2)
squeel (1.1.1)
state_machine (1.2.0)
symmetric-encryption (3.6.0)
syntax (1.2.0)
syslog-logger (1.6.8)
therubyracer (0.12.1)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (1.1.0)
translation_center (1.7.0)
treetop (1.4.15)
typhoeus (0.6.9)
tzinfo (0.3.39)
uglifier (2.5.1)
uniform_notifier (1.6.2)
warden (1.2.3)
webrat (0.7.3)
whenever (0.9.2)
will_paginate (3.0.7)
ya2yaml (0.31)
yard (0.8.7.4)
This issue is because of the sqeel gem. It does not allow using symbols for values in queries.
Therefore, it cannot be used with the translation_center gem.
remove from gemfile and bundle install

Getting this error:Use RbConfig instead of obsolete and deprecated Config on running "rake db:migrate" command

rake db:migrate
/var/lib/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
Getting above error on running rake db:migrate.
Below are the list of gems i have installed in my system.
* LOCAL GEMS *
actionmailer (4.1.4, 2.3.14)
actionpack (4.1.4, 2.3.14)
actionview (4.1.4)
activemodel (4.1.4)
activerecord (4.1.4, 2.3.14)
activeresource (4.0.0, 2.3.14)
activesupport (4.1.4, 2.3.14)
arel (5.0.1.20140414130214)
builder (3.2.2)
bundler (1.6.3)
childprocess (0.5.3)
domain_name (0.5.19)
erubis (2.7.0)
ffi (1.9.3)
hike (1.2.3)
http-cookie (1.0.2)
i18n (0.6.11)
json (1.8.1)
mail (2.5.4)
mechanize (2.7.3)
mime-types (2.3, 1.25.1)
mini_portile (0.6.0)
minitest (5.4.0)
multi_json (1.10.1)
mysql (2.9.1)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
nokogiri (1.6.2.1)
ntlm-http (0.1.1)
polyglot (0.3.5)
rack (1.5.2, 1.1.6)
rack-test (0.6.2)
rails (2.3.14)
rails-observers (0.1.2)
railties (4.1.4)
rake (0.8.7)
rubyzip (1.1.6)
selenium-webdriver (2.42.0)
sprockets (2.12.1)
sprockets-rails (2.1.3)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (1.2.1)
unf (0.1.4)
unf_ext (0.0.6)
watir-webdriver (0.6.10)
webrobots (0.1.1)
websocket (1.1.4, 1.0.7)
Try updating Rake,the log as you posted in question shows rake 0.8.7 version , you might try removing it.
Install latest rake version, might be it resolve your problem

What do I need to do to get activerecord-import to work?

I am trying to use activerecord-import, but I can't seem to get my application to recognize its existence.
I get
undefined method `supports_import?' for #<Class:...>
or
undefined method `import' for #<Class:...>
no matter what I do. I've been googling this for days and trying everything I can think of
It worked when we had rails 2.3.5 and ar-extensions, but since upgrading to rails 3.2 it has been broken.
Everyone says the solution is to use activerecord-import, but I don't seem to know how to do that. I have installed the gem -- I believe the correct version for my version of ActiveRecord -- and I've required it in my code, but there must be some other thing I have to do.
I have this in my Gemfile:
gem 'activerecord-import', "~> 0.3.0"
this in my code:
require 'activerecord-import'
and this is my gem list:
$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.13)
actionpack (3.2.13)
active_utils (2.0.0, 1.0.5)
activemerchant (1.38.1, 1.37.0, 1.34.1)
activemodel (3.2.13)
activerecord (3.2.13)
activerecord-import (0.3.1)
activeresource (3.2.13)
activesupport (3.2.13)
acts_as_tree (1.1.0)
arel (3.0.2)
builder (3.0.4)
bundler (1.2.1)
capistrano (2.15.5)
ckeditor (4.0.6)
climate_control (0.0.3)
cocaine (0.5.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
composite_primary_keys (5.0.13)
dbf (2.0.6)
erubis (2.7.0)
exception_notification (3.0.1)
execjs (2.0.1, 1.4.0)
fastercsv (1.5.5)
friendly_id (4.0.10.1)
highline (1.6.19)
hike (1.2.3)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
json (1.8.0)
libv8 (3.16.14.3 x86_64-linux, 3.11.8.17 x86_64-linux)
mail (2.5.4)
mime-types (1.25, 1.23)
mini_magick (3.6.0)
mini_portile (0.5.1)
money (5.1.1)
multi_json (1.8.0, 1.7.9, 1.7.7)
mysql2 (0.3.13)
net-scp (1.1.2)
net-sftp (2.1.2)
net-ssh (2.6.8)
net-ssh-gateway (1.2.0)
newrelic_rpm (3.6.7.152)
nokogiri (1.6.0, 1.5.10)
orm_adapter (0.5.0)
paperclip (3.5.1, 3.5.0)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.1.0, 0.9.2.2)
rdoc (3.12.2)
ref (1.0.5)
rmagick (2.13.2)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)
sass (3.2.10, 3.2.9)
sass-rails (3.2.6)
sprockets (2.2.2)
sqlite3 (1.3.8)
subexec (0.2.3)
therubyracer (0.12.0, 0.11.4)
thor (0.18.1)
tilt (1.4.1)
tinymce_fm (0.0.2)
treetop (1.4.15, 1.4.14)
tzinfo (0.3.37)
uglifier (2.2.1, 2.1.2)
will_paginate (3.0.4)
zip (2.0.2)
The answer is that there are some special steps you need to take to use this particular gem.
require "activerecord-import/base"
ActiveRecord::Import.require_adapter('mysql2')
This was found on the github wiki page for activerecord-import

Shoulda not working in Padrino, fails with undefined method `delegate'

I've recently set up a couple of Padrino projects and each time I generated the project, I used Shoulda as the test option. But when I try to run 'padrino rake test,' it fails with the following error:
Sonnys-MacBook-Pro:sample_blog sonnyjitsu$ padrino rake test
=> Executing Rake test ...
/Users/sonnyjitsu/.rvm/rubies/ruby-2.0.0-p353/bin/ruby -I"lib" -I"/Users/sonnyjitsu/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib" "/Users/sonnyjitsu/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/rake_test_loader.rb" "test/app/**/*_test.rb"
/Users/sonnyjitsu/.rvm/gems/ruby-2.0.0-p353/gems/shoulda-matchers-2.4.0/lib/shoulda/matchers/active_record/association_matcher.rb:77:in `<class:AssociationMatcher>': undefined method `delegate' for Shoulda::Matchers::ActiveRecord::AssociationMatcher:Class (NoMethodError)
Here is my gem list
actionmailer (4.0.1, 3.2.3)
actionpack (4.0.1, 3.2.3)
activemodel (4.0.1, 3.2.15, 3.2.3)
activerecord (4.0.1, 3.2.15, 3.2.3)
activerecord-deprecated_finders (1.0.3)
activeresource (3.2.3)
activesupport (4.0.1, 3.2.15, 3.2.3)
addressable (2.3.5)
arel (4.0.1, 3.0.3, 3.0.2)
atomic (1.1.14)
backports (3.3.5)
bcrypt-ruby (3.1.2)
bigdecimal (1.2.0)
builder (3.1.4, 3.0.4, 3.0.0)
bundler (1.3.5)
bundler-unload (1.0.2)
classifier (1.3.3)
coffee-rails (4.0.1, 3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3, 1.3.3)
colorator (0.1)
commander (4.1.5)
daemons (1.1.9)
data_mapper (1.2.0)
data_objects (0.10.13)
dm-aggregates (1.2.0)
dm-constraints (1.2.0)
dm-core (1.2.1)
dm-do-adapter (1.2.0)
dm-migrations (1.2.0)
dm-mysql-adapter (1.2.0)
dm-serializer (1.2.2)
dm-sqlite-adapter (1.2.0)
dm-timestamps (1.2.0)
dm-transactions (1.2.0)
dm-types (1.2.2)
dm-validations (1.2.0)
do_mysql (0.10.13)
do_sqlite3 (0.10.13)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.0.2, 1.4.0)
executable-hooks (1.2.6)
fast-stemmer (1.0.2)
fastercsv (1.5.5)
ffi (1.9.3)
git (1.2.6)
haml (4.0.4)
highline (1.6.20)
hike (1.2.3, 1.2.1)
htmlentities (4.3.1)
http_router (0.11.0, 0.5.4)
i18n (0.6.5, 0.6.0)
io-console (0.4.2)
jbuilder (1.5.2)
jekyll (1.3.1)
jekyll-import (0.1.0.rc1)
journey (1.0.4)
jquery-rails (3.0.4, 2.0.2)
json (1.8.1, 1.7.7, 1.7.3)
json_pure (1.8.1)
libv8 (3.16.14.3 x86_64-darwin-13)
liquid (2.5.4)
listen (1.3.1)
mail (2.5.4, 2.4.4)
maruku (0.6.1)
metaclass (0.0.1)
mime-types (1.25.1, 1.18)
mini_portile (0.5.2)
minitest (4.7.5, 4.3.2)
mocha (0.14.0)
multi_json (1.8.2, 1.3.6)
mysql2 (0.3.14)
nokogiri (1.6.0)
padrino (0.11.4, 0.9.21)
padrino-admin (0.11.4, 0.9.21)
padrino-cache (0.11.4, 0.9.21)
padrino-core (0.11.4, 0.9.21)
padrino-gen (0.11.4, 0.9.21)
padrino-helpers (0.11.4, 0.9.21)
padrino-mailer (0.11.4, 0.9.21)
polyglot (0.3.3)
pony (1.6.1, 1.5.1)
posix-spawn (0.3.6)
psych (2.0.0)
pygments.rb (0.5.4)
rack (1.5.2, 1.4.1)
rack-cache (1.2)
rack-protection (1.5.1)
rack-ssl (1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.3)
railties (4.0.1, 3.2.3)
rake (10.1.0, 0.9.6, 0.9.2.2)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
rb-kqueue (0.2.0)
rdoc (4.0.0, 3.12.2, 3.12)
redcarpet (2.3.0)
ref (1.0.5)
rubygems-bundler (1.4.2)
rvm (1.11.3.8)
safe_yaml (0.9.7)
sass (3.2.12, 3.1.19)
sass-rails (4.0.1, 3.2.5)
sdoc (0.3.20)
sequel (4.4.0)
shoulda (3.5.0)
shoulda-context (1.1.6)
shoulda-matchers (2.4.0)
sinatra (1.4.4)
sinatra-contrib (1.4.1)
sinatra-extension (1.0)
sinatra-flash (0.3.0)
slim (2.0.2)
sprockets (2.10.1, 2.1.3)
sprockets-rails (2.0.1)
sqlite3 (1.3.8, 1.3.6)
sqlite3-ruby (1.3.3)
stringex (1.5.1)
syntax (1.0.0)
temple (0.6.7)
test-unit (2.0.0.0)
therubyracer (0.12.0)
thin (1.6.1)
thor (0.18.1, 0.17.0, 0.14.6)
thread_safe (0.1.3)
tilt (1.4.1, 1.3.3)
treetop (1.4.15, 1.4.10)
turbolinks (1.3.1)
tzinfo (0.3.38, 0.3.33)
uglifier (2.3.1, 1.2.4)
url_mount (0.2.1)
uuidtools (2.1.4)
yajl-ruby (1.1.0)
I've not tried to use shoulda-matchers outside of rails before, but it looks like they make use of the delegate macro provided by ActiveSupport. Try require 'activesupport' (or a more limited subset if you'd rather) in your tests to see if that helps.
require 'active_support/core_ext/module/delegation'
worked for me

Created_at get a wrong value when I rebuild my gems . Ruby on Rails

My RailsGem Version is '2.3.4 ,and I builded it long before. Today I upgraded my gems system then every Model's "Create_at" displays a wrong value in Views.
The value in Mysql is right:
any.created_at : 2011-11-01 21:32:49
but in my view file:
<%= any.created_at %> = "Fri Mar 25 21:12:21 +0800 2011"
this is my gem list:
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activerecord-jdbc-adapter (1.2.0)
activerecord-jdbcmysql-adapter (1.2.0)
activeresource (2.3.4)
activesupport (2.3.4)
arel (2.2.1)
aws-s3 (0.6.2)
builder (3.0.0)
bundler (1.0.21)
cgi_multipart_eof_fix (2.5.0)
cocaine (0.2.0)
coffee-script (2.2.0)
coffee-script-source (1.1.2)
daemon_controller (0.2.6)
daemons (1.1.4)
erubis (2.7.0)
execjs (1.2.9)
fastthread (1.0.7)
gem_plugin (0.2.3)
hike (1.2.1)
i18n (0.6.0)
jdbc-mysql (5.1.13)
jquery-rails (1.0.16)
json (1.6.1)
libv8 (3.3.10.2 x86-linux)
mail (2.3.0)
mime-types (1.17.2)
mongrel (1.1.5)
mongrel_cluster (1.0.5)
mongrel_service (0.4.0)
multi_json (1.0.3)
mysql (2.8.1)
mysql2 (0.3.7)
paperclip (2.4.5)
passenger (3.0.9)
polyglot (0.3.2)
rack (1.0.1)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (2.3.4)
rake (0.8.7)
rdoc (3.11, 2.5.11)
rdoc-data (2.5.3)
rubygems-update (1.8.11)
sass (3.1.10)
sass-rails (3.1.4)
sprockets (2.0.3)
therubyracer (0.9.8)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.30)
uglifier (1.0.4)
xml-simple (1.1.1)
Do this:
<%= any.created_at.to_s(:db) %>

Resources