similar to: Ordering one model class by details contained in another

Displaying 20 results from an estimated 4000 matches similar to: "Ordering one model class by details contained in another"

2006 May 22
13
How is this possible?
When run from the console, the following code works, when run through the WEBrick server I get a "You have a nil object where you didn''t expect it!" class Competition < ActiveRecord::Base has_many :comp_dates, :order=>:position def initial_date comp_dates.first end def display_dates i_d = initial_date if i_d.nil? return "unknown"
2006 Jan 15
2
acts_as_tree & acts_as_list for a single model?
Hi, If I have a db table categories - id - name - parent_id - position is it alright to have the Category model act_as_tree and for each level act_as_list? class Category < ActiveRecord::Base acts_as_tree :order => :position acts_as_list :scope => :parent_id end Thanks, Peter
2007 Aug 15
3
ActsAsList specs
Hi, How are people specifying models which act_as_list? I''m thinking that it would be possible to check that acts_as_list instance methods have been added to a class using something like this: describe Page, "acts_as_list" do it "should act as a list" do Page.ancestors.should be_include(ActiveRecord::Acts::List::InstanceMethods) end it "should use
2006 Sep 24
8
form_for and Multiple Models Being Saved
Howdy Folks, I want to use form_for to allow a user to submit a form that contains two instances of the same model. They are entering calendar dates and I want them to be able to submit 2 from the same form. Ok, so, using form_for, what is the best way to do this? form_for seems to be setup to handle a single instance in that it wants a name for the variable, etc... Has someone else done this?
2008 Dec 06
1
find with add of an atttributes
I have wrote this: EventDate.find(:all, :include => [:container,{:event => [:photo,:event_type_names]},{:place=>:location}], :joins =>" RIGHT JOIN (SELECT event_dates.id,date_add(event_dates.date, INTERVAL i DAY ) AS date FROM (select 0 as i union all select 0 union all select 1 union all select 2) as integers CROSS JOIN event_dates
2008 Jan 15
0
HABTM acting as list on Rails 2
Hi Fellow Railworkers Now that Rails 2 is the engine, is there an easier way to have a HABTM relation act_as_list? The solution outlined in the wiki is pretty ugly: http://wiki.rubyonrails.org/rails/pages/HowToUseActsAsListWithHasAndBelongsToMany Thanks for any hints, -sven -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this
2007 Nov 22
1
has_many :through questions
I''ve created the following associations using :through: class Person < ActiveRecord::Base has_many :attendees, :dependent => :destroy has_many :events, :through => :attendees, :uniq => true end class Event < ActiveRecord::Base has_many :attendees, :dependent => :destroy has_many :people, :through => :attendees, :uniq => true
2006 Jan 31
1
Updating :has_many - :through related items
Hi, I''ve got my little app working pretty well. I''m using pretty much the model and table layout from my previous thread, as suggested by Bill Katz: <http://www.ruby-forum.com/topic/52506#26260> I have the Create page working and a delete Match page working, which along with the appropriate record in the Matches table, removes the linked items in the competitions table.
2006 Jun 11
4
[Question} how best to use attribute driven db with Rails
I designed out a mostly attribute driven database. Originally i was going to use PHP, but have now decided to use RoR. Being able to use the built in OR functionality would be nice, but I am not sure how well it melds with attribute dbs. If anyone can give me some pointers, I would really appreciate it (especially since this is my first endeavor and on an important project as well).
2006 Jun 04
0
A little confused about routes....
I''m currently playing around with various URL patterns and I''m a little confused about how routes and the _url helpers work. I''ve read through the AWDWR book (1st edition and current 2nd edition beta book) and I''m still not clear on what''s happening. I''ve been working with variations of the following route: map.competition
2017 Dec 01
0
2018 ASA Computing/Graphics: Chambers Software Award and Student Paper Competition
Dear R-help Listers, The submission site for the two awards (Chambers Student Software; Computing/Graphics Student Paper) is open at http://asa.stat.uconn.edu<http://asa.stat.uconn.edu/> until the deadline, 5:00 pm EST, December 15, 2017. The results will be announced by January 15, 2018. The award recipients are expected to present in a topic-contributed session at the 2018 JSM in
2017 Oct 18
1
2018 ASA Computing/Graphics: Chambers Software Award and Student Paper Competition
Dear R-help Listers, The following two student competitions are of interests to the now many student R package developers. I'd appreciate your help in spreading them. #1. John M. Chambers Statistical Software Award 2018 The Statistical Computing Section of the American Statistical Association announces the competition for the John M. Chambers Statistical Software Award. In 1998 the
2006 Jan 03
0
has_and_belongs_to_many include problem
hey, i have users who are in groups, and i have a search form, where i can search on group, user lastname, and user firstname. All this is also with pagination. these are my models class User < ActiveRecord::Base has_and_belongs_to_many :groups end class Group < ActiveRecord::Base has_and_belongs_to_many :users end in my controller i do this THIS works (but in need pagination) @users2
2006 Feb 13
1
another simple question: per_page in pagination
Hi, Why can''t I use a variable to specify the :per_page attribute when using the most basic form of pagination? (if I use a hardcode number, it runs) What did I do? Thx. My code: def list_orders page_size = 20 ... order_pages, @orders = paginate(:orders, :per_page => page_size) end My Errors: undefined method `>'' for false:FalseClass RAILS_ROOT:
2007 Feb 10
2
Ferret and Paginating Find
Hey all, I''ve been really happy with ferret thus far and all my search on my site is based on it. One of the recent challenges I ran into is changing some of my pagination within my site. Until now, I just used the tutorials out there that talk about how to get pagination working with acts_as_ferret. Recently, I decided to change my pagination to begin using the "Paginating
2012 May 28
1
rendering a partial inside another using render_to_string and (:formats) in controller
I want to clean my code by moving the duplicated lines : partial = render_to_string( :partial => "#{file}", :formats => [:html] ) to the pagination_partials function. ================================================= WORKING CODE: ================================================= def render_format_search_partial(file, options={}) # TODO remove this line to use the one
2011 Mar 23
1
R helps win competitions
DeaR ComRades, This is a quote from a News article in Science's 11-February issue, about competitions to model data: "For Chris Raimondi, a search-engine expert based in Baltimore, Maryland, and winner of the HIV-treatment competition, the Kaggle contest motivated him to hone his skills in a newly learned computer language called R, which he used to encode the winning data model.
2006 Jan 15
0
OS X Rails - Nuby
OK, I''m diving into new things - a .net programmer and windows user trying to develop in Rails on my Mac. Initial setup was easy, and I had things working and was thrilled with myself. Then I shut down. Next time I booted up, mysql was acting all kinds of funny. I finally got that working again (I *think* it mostly had to do with me not having the right path, I unfortunately
2003 Nov 20
0
Trust, users, groups, scripts, etc. questions.
I have some things I'd like someone brighter than me to explain. #1. Add xxxx scripts. Everyone seems to put these scripts in their smb.conf. The add user and add machine make sense, and they work, but explain to me how the other scripts, such as add user to group, are supposed to work? When do they get called, etc.? I guess most of these involve the smbldap tools. #2. Here's my
2005 Dec 01
0
[MySQL] extended count function for use with queries containing a GROUP BY clause
Hi everybody. While playing around with pagination I noticed that when using certain GROUP BY clauses Rails would think that your result contains less lines than it actually does. This is related to the use of a plain "SELECT COUNT(*)" for getting the number of total rows which the following query will return. In order to bypass this problem, I created the following replacement for