[Rails] Re: Need help understanding :order usage

2010-04-16 Thread RVRoadie
Thanks for taking the time to set me straight. I confess that I did not look at the API. I have a hard time navigating the API and sometimes avoid it when I really should be looking there first. As a result of your comment, I did find this link: http://railsapi.com/doc/rails-v2.3.5/ It is a sea

[Rails] Need help understanding :order usage

2010-04-16 Thread RVRoadie
Import has_many IRows IRow belongs to Import @import = Import.find(params[:id]) Shouldn't both of the following statements work the same? #1 :@i_rows = @import.i_rows(:order => :row_sort) Generates: SELECT * FROM "i_rows" WHERE ("i_rows".import_id = 4) #2 @i_rows = IRow.find_all_by_import

[Rails] Re: Need help with find

2010-04-03 Thread RVRoadie
Club has many Members Person has many Members Members belong to Club, Person > > What are the relationships between the models (has_many, belongs_to and so > on)? > > Colin > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to t

[Rails] Re: Need help with find

2010-04-02 Thread RVRoadie
Finally figured out something that worked. @club = Club.find(params[:club_id]) ids = @club.members.connection.select_values('SELECT person_id FROM members') @people = Person.all(:order => 'name_sort', :conditions => ["id NOT IN (?)", ids]) Any comments or be

[Rails] Need help with find

2010-04-02 Thread RVRoadie
Kind of new at this and have been unable to find an example of what I want to do. I have three models, people, clubs and members. @members = @club.members.all --> finds all club members How do I write a find of all people that are not members of @club Thanks -- You received this message becau

[Rails] How to use find method on table with two column index

2010-03-29 Thread RVRoadie
I created an index with person_id and club_id but I can't figure out how to properly access it (doesn't show up in the find_by... lists) Can someone provide me a sample find statement to best use this index Thanks. class CreateMembers < ActiveRecord::Migration def self.up create_table :mem

[Rails] Re: How to calculate per_page value based on browser window size for will_paginate

2010-03-26 Thread RVRoadie
Thanks for your ideas. I decided to make per_page an attribute of the user and set it at login. That way it gives all my list pages a common look. I had already put this inside a form_tag I am using for a search box, so I didn't want to add another form_tag. The search box and the pagination boxe

[Rails] Re: How to calculate per_page value based on browser window size for will_paginate

2010-03-26 Thread RVRoadie
Ok, I tried as you suggested with: <%= select_tag(:per_page, options_for_select(%w{10 20 30 40 50}, selected = session[:per_page]), :onchange => "session[:per_page] = this.value") %> Lines per page I can't seem to get the :onchange to set a new value for session[:per_page]. I checked :onchange w

[Rails] How to calculate per_page value based on browser window size for will_paginate

2010-03-26 Thread RVRoadie
def self.per_page 20 end Any suggestion on how I can calculate this value base on the size of the browser window? Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googl

[Rails] Re: Using store values from drop down list

2010-03-12 Thread RVRoadie
Thanks for the advice. Changing to a hash did what I wanted it to. I can see the advantage of generalizing this in a model. Thanks for the suggestion. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to

[Rails] Using store values from drop down list

2010-03-10 Thread RVRoadie
Hi, I was trying to understand stored values vs display values. # model code CLUB_TYPES = [ # Displayed stored in db [ "Public" , "pub" ], [ "Village" , "vil" ], [ "Private" , "pvt" ] ] validates_inclusion_of :club_type, :in => CLUB_TYPES.map {|disp, value| value} #view c