[Rails] counting the result of a join

2014-07-02 Thread Ronald Fischer
I have in my model :dicts, :cards and :idioms. Each Dict has many Cards and each Cards has many Idioms. Also, :idioms has an Integer column :kind. I would like to find out, whether a certain dict object has at least one Card which has at least one Idiom where :kind has a certain value. This is

[Rails] counting a check_box selections?

2011-07-24 Thread mr ma
Hello to everybody! I have the following code in new.html.erb allowing a user to select more questions (item) for creating a questionnaire: ... % for item in @itemss % %= check_box_tag questionnaire[item_ids][], item.id, @questionnaire.items.include?(item) % a %=

Re: [Rails] counting a check_box selections?

2011-07-24 Thread Tom Meinlschmidt
use jquery and bind click event to some calculcation function. you can set some value or metadata to count with eg = check_box_tag 'name', value, checked?, :'data-count' = 123, :class = 'sums' and you jquery var result; // global variable jQuery('.sums').each(function() {

[Rails] Counting items in associate with a limit

2011-02-11 Thread Rob Nichols
Rails 3 --- I have a relationship where Category has_and_belongs_to_many Article. I want to grab a small subsection of articles related to a particular category. When I try to iterate over these, Rails tries to count the records and gets the wrong number. The issue is that there is bug in

[Rails] Counting words for visual details

2009-09-28 Thread Pål Bergström
I've made a survey in Rails where I want people to pick three words, characteristics for different personality types, from a list of 30 words for 20 different visual details such as linear, organic, symmetry, etc. I save each answer for each user, with the visual detail in one column and the

[Rails] counting blog comments

2009-09-17 Thread Mark
I have posts and comments, and I'd like to display the number of comments each post has (and display 0 if none). In the index Posts view, I display a list of posts and their authors using the below partial. What I can't figure out is how to limit the comment count to the post listing (my

[Rails] counting a users adverts and then doing stuff

2009-08-06 Thread bingo bob
I've got a load of users and they have adverts, such that a User has many adverts and an Advert belongs to a user. I'm going to need to stop users creating more than a certain number of adverts based on their status. I've got things working ok but it's a bit inelegant as I'm doing it with before

[Rails] Counting up in 5's or something similar.

2009-06-05 Thread Ruby on Rails: Talk
Hi I'm sure I've read somewhere that you can count up in 'jumps' using ruby? I've got two times and I want to basically go up in 15 minute jumps without using the whole for loop thing. Any helpful ideas? All my ruby books are in storage and I can't find anything on google ...but then I'm not

[Rails] Counting

2009-05-13 Thread Remco Swoany
Hi, I generate and download a cvs from my (HBX)stats-tool. The data is campaign-history value for tracking the hisitory of campaigns Campaign-history Orders Direct 4 Direct~Direct 6 adwords2 adwords~direct~direct 4 organic12

[Rails] counting number of guests online

2009-02-18 Thread Scott Kulik
I'm currently using eldorado forum which shows the users that are currently logged on. I wanted to also add the number of guests that are currently viewing the site. What do you think is the best way to go about this and where should I keep track of this number? I'm thinking I would have to

[Rails] Counting / Aggregation Queries

2008-10-21 Thread Neal L
Hi all, Suppose you have two models -- one for Files and anther for Downloads -- such that a file has_many = :downloads If you wanted to get a count of the downloads for the current month and the two previous months, is there a way to get that data from one query? Something like: