Hi guys, Just wondering if anyone can help me, im quite a newbie to ruby. i have developed an application(Fitness site) which allows users to register and obtain a free fitness programme based on the info they have entered when registering. this is were my problem lies i need to connect the fitness programme to the users table in the database and use some sort of algrothim to select the correct fitness programme for them based on the age they entered when registering. any ideas?? link to website http://funkyfitness.heroku.com/ -- Posted via http://www.ruby-forum.com/. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, The best method is the ActiveRecord relationship. In the users model you place the code has_many :programs and in the progrm model put this belongs_to :users So, in the controller you can use the find method with parameters. I hope this help you! On Feb 24, 2011, at 9:56 AM, Danielle B. wrote:> Hi guys, > > Just wondering if anyone can help me, im quite a newbie to ruby. i > have > developed an application(Fitness site) which allows users to register > and obtain a free fitness programme based on the info they have > entered > when registering. this is were my problem lies i need to connect the > fitness programme to the users table in the database and use some sort > of algrothim to select the correct fitness programme for them based on > the age they entered when registering. any ideas?? > > > link to website http://funkyfitness.heroku.com/ > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, Thanks for your help, just stuck on using the find method with parameters in the controller, i want to have 3 different fitness program''s based on age so under 18 redirect to a specific program, between 18 - 40 redirect to a another program and over 40 redirect to a last program.. any ideas? Age is one of the columns already in the database. -- Posted via http://www.ruby-forum.com/. -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.