37 questions
The rails suddenly stopped working...This is the log displayed.>bin/rails:6:warning:already initialized constant APP_PATH>/Users/Sean/Desktop/Renascence/bin/rails:6:warning:previous>definitio...
Let's talk about the following models.idtitleidnameI would like to add created_user_id and updated_user_id to Post. What should I do?If you want to add user_id, raid migration AddUserIdToPost user_id:...
when you want to limit which columns are retrieved using selectHow do I control the columns of the relevant model as well?Post>--CategoryI only want to get title for Post and name for Category.Imag...
studentssubjectsstudents_subjects (intermediate table)student_idsubject_idstudent_idsubject_idThe students_subjects have foreign key constraints in the migration file.I wanted to check if foreign key ...
in ActiveRecord::Base validationsSelect multiple columns in uniquness and Also, is it possible to add the value of the column to the conditions?What do you want to be uniquness?- user_id- mst_category...
| id | name | | id | area_id | name | | id | perfect_id | name | | id | perfect_id | perfect_area_id | name | I would like to store the data using build as follows. | id | name | | -- | ---- || 1 | Ki...
As for ActiveRecord for rails, I think it caches SQL query results.In the log, click Model name Load (0.8ms) SELECT and belowSave the and Load to cache and display the query execution time.CACHE (0.1m...
I'm a beginner at Rails and SQL, so I'm sorry if there are any expressions that are difficult to understand.First, we have the following models: class City<ActiveRecord::Base has_many —favorites ha...
Environment: ruby 2.1.3, rails 4.2, activaterecord-sqlserver-adapter 4.1If you have to switch from place to place to place to process 20 databases.First, prepare an array (specs) containing connection...
Currently, uuid is achieved by adding the following actions to the User model:def before_save_action_name uuid=SecureRandom.uuid uuid=SecureRandom.uuid while User.exists?(:uuid=>uuuid) self.uuid=uu...
« | - 3 - | » |
© 2024 OneMinuteCode. All rights reserved.