activerecord
Related to result of eager loading in ROR Active Record
I have an Invoice model which belongs to Customer (and of course Customer has_many invoices). If I do:[详细]
2023-04-09 01:08 分类:问答how to perform a somewhat complicated ActiveRecord scope query for a polymorphic association?
S开发者_StackOverflow中文版o, I have a Notification model that is polymorphic, and I want to be able to filter out notifications that are of a notifiable_type Comment where comment.user == current_use[详细]
2023-04-08 21:34 分类:问答How can I only display records which have not yet reached their expiry date (field)?
In my app I can add offers and give them a start and end date, the offers are displayed as partials. How can I go about only displaying them if the start date is todays date or earlier and the end dat[详细]
2023-04-08 20:27 分类:问答Save belongs_to ID in a form, without using a hidden field?
I am trying to work out the best way to save a belongs_to record ID, whilst creating a new child record. I am currently using a hidden field to retain the parent\'s ID.[详细]
2023-04-08 19:01 分类:问答Understainding Rails queries in loops
I could use some help understanding Rails queries in loops. Loop 1: ruby-1.9.2-p290 :005 > (1..3).each do |i|[详细]
2023-04-08 18:03 分类:问答Creating named relations in Rails 3 models
I\'m trying to learn Rails and I\'m struggling to understand how self relations are declared using the ActiveRecord component.[详细]
2023-04-08 17:43 分类:问答Ordering records by frequency with Arel
How do I retrieve a set of records, ordered by count in Arel? I have a model which tracks how many views a product get. I want to find the X most frequently viewed products over the last Y days.[详细]
2023-04-08 17:29 分类:问答Heroku ActiveRecord Error: PgSQL put null in id field
I just deployed a simple Ruby on Rails (3.0.10) application to Heroku. There is a line of code create a new User object like this.[详细]
2023-04-08 17:14 分类:问答symfony 1.4/ doctrine 1.2 active record relationship tables code organize
Let´s say I have a schema containing 3 tables: Users,Pages and Followers. An user can follow many pages. The followers table would contain the page_id and user_id.[详细]
2023-04-08 16:58 分类:问答Camping model ignores association
module App::Models class Team < Base has_many :players [...] end class Player < Base belongs_to :team[详细]
2023-04-08 16:00 分类:问答