As the title says, I'm trying to link models using belongs_to and has_one, but it doesn't work.
・ What i am trying to do
rails g devise Account
I want to be able to call the contents of the Post model from the Account model by associating the Account model created in step 1 with the Post model that saved the contents of the micropost.
Even if I enter Account.find (1) .Post as above, I get a No method error and I am told that Post cannot be found.
I would appreciate it if you could tell me why it didn't work or another way.
Answer # 1
Probably, but I think it's the other way around.
How is it?
- ruby on rails - i can't create a model with rails
- ruby - rspec the expected model is not created
- ruby on rails - mechanism of cooperation between web services and smartphone apps
- ruby on rails - not created
- ruby - unable to create rails model (environment: cloud9)
- ruby - i want to distinguish between rails 0 and nil
- ruby on rails - product model test code does not succeed
- ruby on rails - about the code of the adjacency list model implemented in rails
- ruby on rails - returns a value from the rails model to the controller
- ruby on rails - join a group created by another user
- new project is not created in ruby on rails
- ruby on rails 5 - child model record not created
- ruby on rails 5 - i don't understand the difference between model and controller methods
- ruby on rails - i want to sort the values of the graph created by gem "chartkick"
- [ruby on rails] how to write when getting a model nested in multiple stages with includes
- ruby on rails - i want to validate only the foreign key on the model side
- about the empty model created by "new" of ruby on rails
- ruby on rails - i'm a beginner i'm deploying an app created with rails on heroku, but i can't proceed with an error
- ruby on rails - [rails] post form created with form_with does not work properly
- ruby - sass :: syntaxerror on rails s
- ruby - an error occurred when implementing the micropost search function using ransack
- ruby - i started the server in rails s but can't open it
- Data cannot be inserted due to MySQL character conversion error
- ruby on rails - i want to solve the problem that "we're sorry, but something went wrong" is displayed in the productio
- ruby - how to upload images directly from rails to s3 on aws
- nginx - bundler: failed to load command: unicorn cannot start with an error saying unicorn_rails
- ruby - resolve rspec mysql foreignkey error
- ruby on rails - the latitude and longitude of the registered address is not converted by geocoding