Ruby on Rails Tuesday, April 7, 2015

I tried attr_accessible, but it seems this one is also not working.

When I am adding the data onto Db through the console then it is giving
error, NoMethodError: undefined method `attr_accessible' for Post (call
'Post.connection' to establish a connection):Class

Found a solution for this one.

I just removed the "attr_accessible :title, :content" line from post.rb
and now I am able to insetr data onto DB through console.

post.rb file:

class Post < ActiveRecord::Base
end

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/28eeb22d42eff57663eeb7a7f650f534%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment