Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `to_i' for #<Channel:0x00000005345968> #32

Closed
kirantpatil opened this issue Jan 27, 2013 · 6 comments · Fixed by #43
Closed

undefined method `to_i' for #<Channel:0x00000005345968> #32

kirantpatil opened this issue Jan 27, 2013 · 6 comments · Fixed by #43
Assignees
Milestone

Comments

@kirantpatil
Copy link

The command ($ bundle exec rake db:create db:migrate kandan:bootstrap) creates below error.

System details:

[smita@localhost kandan]$ cat /etc/issue
Fedora release 18 (Spherical Cow)
Kernel \r on an \m (\l)

[smita@localhost kandan]$ uname -a
Linux localhost.localdomain 3.7.2-204.fc18.x86_64 #1 SMP Wed Jan 16 16:22:52 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

[smita@localhost kandan]$ rails -v
Rails 3.2.11

[smita@localhost kandan]$ ruby -v
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]

Error on xterminal while executing command ($ bundle exec rake db:create db:migrate kandan:bootstrap):

== CreateAttachments: migrating ==============================================
-- create_table(:attachments)
-> 0.0023s
== CreateAttachments: migrated (0.0024s) =====================================

== AddSessionsTable: migrating ===============================================
-- create_table(:sessions)
-> 0.0012s
-- add_index(:sessions, :session_id)
-> 0.0005s
-- add_index(:sessions, :updated_at)
-> 0.0005s
== AddSessionsTable: migrated (0.0024s) ======================================

== DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
-> 0.0083s
-- add_index(:users, :email, {:unique=>true})
-> 0.0007s
-- add_index(:users, :ido_id, {:unique=>true})
-> 0.0006s
-- add_index(:users, :authentication_token, {:unique=>true})
-> 0.0009s
== DeviseCreateUsers: migrated (0.0110s) =====================================

== CreateChannels: migrating =================================================
-- create_table(:channels)
-> 0.0011s
== CreateChannels: migrated (0.0011s) ========================================

== CreateActivities: migrating ===============================================
-- create_table(:activities)
-> 0.0037s
== CreateActivities: migrated (0.0040s) ======================================

== AddGravatarHashToUsers: migrating =========================================
-- add_column(:users, :gravatar_hash, :text)
-> 0.0013s
== AddGravatarHashToUsers: migrated (0.0014s) ================================

== AddActiveToUsers: migrating ===============================================
-- add_column(:users, :active, :boolean, {:default=>true})
-> 0.0009s
== AddActiveToUsers: migrated (0.0011s) ======================================

Creating default user...
Creating default channel...
rake aborted!
undefined method to_i' for #<Channel:0x00000005345968> /home/smita/.gem/ruby/1.9.1/gems/activemodel-3.2.11/lib/active_model/attribute_methods.rb:407:inmethod_missing'
/home/smita/.gem/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/attribute_methods.rb:149:in method_missing' /home/smita/.gem/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/column.rb:178:invalue_to_integer'
/home/smita/.gem/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/column.rb:78:in type_cast' /home/smita/.gem/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/attribute_methods/dirty.rb:86:in_field_changed?'
/home/smita/.gem/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/attribute_methods/dirty.rb:63:in write_attribute' /home/smita/.gem/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/attribute_methods/write.rb:14:inchannel_id='
/home/smita/Documents/kandan/lib/tasks/kandan.rake:35:in block (3 levels) in <top (required)>' /home/smita/Documents/kandan/lib/tasks/kandan.rake:23:ineach'
/home/smita/Documents/kandan/lib/tasks/kandan.rake:23:in `block (2 levels) in <top (required)>'
Tasks: TOP => kandan:bootstrap
(See full trace by running task with --trace)
[smita@localhost kandan]$

@fusion94
Copy link
Member

Please run this command again. I've been trying to track the error down but a second run generally also works.

bundle exec rake kandan:bootstrap

@kirantpatil
Copy link
Author

Fedora 18 ruby version: ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux] used crash the kandan app. Earlier when I tried to delete channel, it used to crash the app.

Now installed RVM and ruby 1.9.3p374 (2013-01-15 revision 38858) and app works perfectly on my machine.

@shadowmint
Copy link

Just an FYI, this continues to be an issue on "ruby-1.9.3-p374 [ x86_64 ]" on OSX. As mentioned, running kandan:bootstrap works if you run it a second time. Weird...

@fusion94
Copy link
Member

fusion94 commented Feb 1, 2013

@shadowmint exactly...

@jrgifford
Copy link
Member

Weird thou. Wonder if its an upstream or us problem. I'll make a note.

@csloz
Copy link

csloz commented Feb 3, 2013

From experiencing this myself,its still broken.

bundle exec rake db:create db:migrate kandan:bootstrap

Creating default user...
Creating default channel...
rake aborted!
undefined method to_i' for #<Channel:0x000000057687e8> /usr/local/rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/attribute_methods.rb:407:inmethod_missing'
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/attribute_methods.rb:149:in method_missing' /usr/local/rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/connection_adapters/column.rb:178:invalue_to_integer'
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/connection_adapters/column.rb:78:in type_cast' /usr/local/rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/attribute_methods/dirty.rb:86:in_field_changed?'
/usr/local/rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/attribute_methods/dirty.rb:63:in write_attribute' /usr/local/rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/attribute_methods/write.rb:14:inchannel_id='
/home/cubieboard/chat/lib/tasks/kandan.rake:35:in block (3 levels) in <top (required)>' /home/cubieboard/chat/lib/tasks/kandan.rake:23:ineach'
/home/cubieboard/chat/lib/tasks/kandan.rake:23:in block (2 levels) in <top (required)>' /usr/local/rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:ineval'
/usr/local/rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `

'
Tasks: TOP => kandan:bootstrap
(See full trace by running task with --trace)

It only works 2nd run around, as it assumes that the 0 byte file is fine:

-rw-r--r-- 1 root www-data 17408 Feb 3 09:20 development.sqlite3
drwxr-sr-x 2 cubieboard www-data 4096 Feb 3 07:14 migrate
-rw-r--r-- 1 cubieboard www-data 3237 Feb 3 09:20 schema.rb
-rw-r--r-- 1 cubieboard www-data 343 Feb 3 07:14 seeds.rb
-rw-r--r-- 1 root www-data 0 Feb 3 09:20 test.sqlite3

bundle exec rake db:create db:migrate kandan:bootstrap
db/development.sqlite3 already exists
db/test.sqlite3 already exists

Although it obviously is not.

According to google, its due to ActiveRecord 3.2 changing functionality?
http://stackoverflow.com/questions/13348980/activerecord-to-i-method-removed-in-rails-3-2-9

For the moment, I've deployed with passenger, and rvm development.

I think you need to add a channel id to the db deployment - I fiddled, but didn't get anywhere, so i'll leave this with you..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants