search for: recipe_id

Displaying 12 results from an estimated 12 matches for "recipe_id".

2006 Dec 06
2
validates_uniqueness_of where scope euqals created_by "magic" field
I have the following ActiveRecord objects: class Recipe < ActiveRecord::Base has_many :ratings, :dependent => true . . . end class Rating < ActiveRecord::Base validates_uniqueness_of :created_by, :scope => :recipe_id belongs_to :recipe, :counter_cache => true . . . end The created_by field on Rating is implemented as a "magic" field similar to this: http://wiki.rubyonrails.org/rails/pages/Howto+Add+created_by+and+updated_by. It is working fine. The validates_uniqueness_of :created_by, :scope...
2006 Jan 19
5
limits of has_and_belongs_to_many
...oring which will be more work: to rename all the primary id''s in the legacy database, or to work around the fact that the primary id''s are not called ''id'' within RoR instead. I''ve been successful in using a join table with two fields named ''recipe_id'' and ''tag_name'' to relate a table called Recipes with a table called Taggs, using this model: class Recipe < ActiveRecord::Base has_and_belongs_to_many :taggs, :join_table => "recipes_tagnames" , :association_foreign_key => "tag_name" end...
2011 Feb 19
2
Active Record Query
...has many lessons and a lesson has many topics. A topic can have a recipe or vice versa, a recipe has many topics (optional). I need to come up with the most efficient way of querying the database to find those topics belonging to a course (via lessons of course) which have a recipe (in other words recipe_id is not null for this topic record). Simple but challenging :) Thanks for your time. Bharat -- 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 rubyon...
2008 Jul 24
0
Getting Foreign Key to work!
Okay. So I have this simple site, which includes Recipes and then Comments. I want ppl to be able to comment on the recipes, and so I made comments have a recipe_id as it''s foreign key etc. I''m not that much of a noob to not know that stuff. When I click on a recipe, and then make a new comment and click ''submit'' (for the comment) it submits it, but it still has recipe_id as nil! I know how to make the comment know that i...
2012 Apr 02
0
active admin saving selection from collection_select and passing to controller
hi i am using active admin for my app i have a partial with a drop down list where the menu and recipe are populated this page is to group the recipe in a menu _menu_recipe.html.erb <%= semantic_form_for [:admin, @menu_recipe] do |f| %> <p> <%= f.collection_select :recipe_id, Recipe.all,:id,:name,:prompt => true%> </p> <p> <%= f.collection_select :menu_id, Menu.all,:id,:name,:prompt => true%> </p> <%= f.buttons :commit %> <%end%> when ever i try to catch the and create or group it, it comes with a Couldn''t find...
2006 May 07
6
RuntimeError in Recipe#edit
...r nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id Extracted source (around line #8): 5: <body> 6: <h1>Edit Recipe</h1> 7: 8: <form action="../update/<%= @recipe.id %>" method="POST"> 9: <input id="recipe_id" name="recipe[id]" size="30" 10: type="hidden" value="<%= @recipe.id %>" /> 11: <p><b>Title</b><br> It appears that @recipe is null. Any assistance will be appreciated. Regards Ling -- Posted via http://www.ruby-...
2006 May 20
3
In a find, can''t you use both :include and :limit ?
...t_update` AS t0_r10, employees.`is_featured` AS t0_r11, employees.`is_deleted` AS t0_r12, employees.`is_hidden` AS t0_r13, skills.`id` AS t1_r0, skills.`parent_id` AS t1_r1, skills.`name` AS t1_r2, skills.`desc_short` AS t1_r3 FROM employees LEFT OUTER JOIN skills_employees ON skills_employees.recipe_id = employees.id LEFT OUTER JOIN skills ON skills.id = skills_employees.skill_id WHERE (skill_id = 3) But remember, I want to use this in a Pagination scenario, and that''ll require :offset and :limit. Let''s add them in as a test. employees = Employee.find( :all, :limit =>...
2006 Mar 07
1
Error when trying Rolling with Ruby On Rails
...nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id ||| Extracted source (around line *#8*): |5: <body> 6: <h1>Edit Recipe</h1> 7: 8: <form action="../update/<%= @recipe.id %>" method="POST"> 9: <input id="recipe_id" name="recipe[id]" size="30" 10: type="hidden" value="<%= @recipe.id %>" /> 11: <p><b>Title</b><br> |Can anyone explain what happened here? Since all the code is generated by Rails scripts, I was wondering if I have som...
2006 May 09
6
Still Stumbled on First things in trying RubyOnRails
Still Stumbled on First things in trying RubyOnRails http://www.digitalmediaminute.com/article/1816/top-ruby-on-rails-tutorials http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html http://instantrails.rubyforge.org/tutorial/index.html http://rails.homelinux.org/ I had tried the first of the top 12 tutorials and got stuck after adding a new field ?category_id?in the table recipes,
2006 Apr 18
12
Formatting data drawn from a DB
Question for all: Right now i have a Table in a mySQL DB that has a row called Ingredients. When the data is entered into the DB its enter like so from a text area: 1 1/2 lbs. beef top sirloin, thinly sliced 1/3 cup white sugar 1/3 cup rice wine vinegar 2 tablespoons frozen OJ concentrate 1 teaspoon salt 1 tablespoon soy sauce 1 cup long grain rice 2 cups water 1/4 cup cornstarch 2 teaspoons
2006 Apr 21
3
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
...e/edit.rhtml where line #10 raised: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id Extracted source (around line #10): 7: 8: <form action="../update/" <%= @recipe.id %> method="POST"> 9: <input id="recipe_id" name="recipe[id]" size="30" 10: type="hidden" value="<%= @recipe.id %>" /> 11: <p><b>Title</b><br> 12: <input id="recipe_title" name="recipe[title]" size="30" 13: ty...
2006 May 15
33
acts_as_commentable release
I now have the acts_as_commentable plugin up on RubyForge. This plugin will allow you to add comments to any active_record object in your Rails application. So far the directions are simple, and there are only a few features: To install: ruby script/plugin install svn://rubyforge.org//var/svn/commentable/acts_as_commentable In the readme there is a sample migration you will need to use, with