33 questions
Some models have the following relationships:Group-<GroupUser>-UserUser can belong to Group.How should I write to find Group to which User A and User B and User COnly belong?Now I'm checking the...
Does Rails (ActiveRecord) have a method to delete the contents of a specific column?When I searched, I couldn't find the information to delete the column itself.If I don't have it, I'll try to impleme...
Is there a way to make an element of a record that is rails recognized as a wildcard or to implement something similar?There is a post model that shows the article you posted.The post contains the aut...
We have made a new registration as follows.After that, I pressed the Edit button to change the product name from Product B to Hogehoge.2 Stainless Steel BF-078 10K 350A 3P 2,000 3,000 4,000 9,0002 Sta...
We are currently creating forms for models in hierarchical relationships.Below is the model file.post.rb has_many:itemsaccepts_nested_attributes_for —itemsitem.rb has_one:heading, dependent::destroyha...
I use Rails 3.2.13+MySQL5.Collation in MySQL is collate utf8_unicode_ci.I didn't know this function existed, so I was surprised that I searched and matched the data in full-width katakana in full-widt...
For example, if you run all, the character User Load appears.User.all User Load (3.5ms) SELECT users.* FROM usersOn the other hand, when you run pluck, SQL itself seems to be the same, but User Load i...
ModelA - id - c_id - d_idModelB - id - name - c_id - d_idShared columns for ModelA and ModelB are c_id and d_id.SELECT A.id, B.namefrom ModelA ASA LEFT JOIN ModelB ASB ON A.c_id = B.c_id AND A.d_id =...
I'd like to get the id of the data I just saved in activerecord, but I can't google it (only other information hits), so please let me know.Image data=User.create(:name=>hoge)data.id#ID of the data...
I'd like to count the number of blog posts daily and take a tally, but the way I write the group is redundant.Currently, the results of this query are as good as you would like, but could you write mo...
« | - 2 - | » |
© 2024 OneMinuteCode. All rights reserved.