Skip to content

NoMethodError (undefined method `relations' for nil:NilClass): #481

Description

@yasirhashmi15

I am trying to create new activity object as i followed below tutorial:

https://github.com/ging/social_stream/wiki/How-to-add-new-activity-objects

I created MVC using scaffold name subjects
I am receiving this error:

Started POST "/subjects" for 127.0.0.1 at 2014-06-17 15:00:06 +0100
Processing by SubjectsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"dASWl4E7igoFk8UQdB9QUQw4ORq+xwdx2+aVzBYG0ho=", "subject"=>{"name"=>"test", "description"=>"test"}, "commit"=>"Create Subject"}
User Load (0.3ms) SELECT users.* FROM users WHERE users.id = 2 LIMIT 1
Actor Load (0.2ms) SELECT actors.* FROM actors WHERE actors.id = 2 LIMIT 1
ActivityObject Load (0.2ms) SELECT activity_objects.* FROM activity_objects WHERE activity_objects.id = 9 LIMIT 1
CACHE (0.0ms) SELECT actors.* FROM actors WHERE actors.id = 2 LIMIT 1
(0.2ms) BEGIN
(0.2ms) SELECT relations.id FROM relations INNER JOIN activity_object_audiences ON relations.id = activity_object_audiences.relation_id WHERE activity_object_audiences.activity_object_id IS NULL
(0.2ms) ROLLBACK
Completed 500 Internal Server Error in 104ms

NoMethodError (undefined method relations' for nil:NilClass): app/models/activity_object.rb:274:inallowed_relations'
app/controllers/subjects_controller.rb:47:in block in create' app/controllers/subjects_controller.rb:46:increate'

Rendered /Users/edudoc/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/edudoc/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
Rendered /Users/edudoc/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (10.6ms)

Please help?

Thanks,
Yasir Hashmi

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions