Displaying 12 results from an estimated 12 matches for "recipe_controller".
2006 Mar 29
11
why belongs_to does not like validation?
This works :
class Recipe < ActiveRecord::Base
belongs_to :category
end
But (when I add validation) this does not work :
class Recipe < ActiveRecord::Base
belongs_to :category
validates_length_of :category, :within => 6..20
validates_uniqueness_of :category, :message => "already exists"
end
thank you
--
View this message in context:
2006 Jun 18
6
integer array columns
Postgres database.
I have a categories table, with two columns id, and name.
I have a recipes table, with a category_ids column.
I want each recipe to belong to one or more category.
in recipe_controller.rb I have this:
def create
@recipe = Recipe.new( @params[''recipe''] )
@recipe.category_ids = @params[''recipe''][''category_ids''].map{
|s| s.to_i }
@recipe.save
end
But I keep getting an error during the INSERT, saying column
category_i...
2005 Mar 09
9
Unit testing + instance variables
...My Controller of interest for testing
class RecipeController < ApplicationController
def list
@recipes = Recipe.find_all
@categories = Category.find_all
end
end
>>
# My test file
require File.dirname(__FILE__) + ''/../test_helper''
require ''recipe_controller''
class RecipeControllerTest < Test::Unit::TestCase
def setup
@controller = RecipeController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
create_fixtures "recipes"
create_fixtur...
2006 May 09
6
Still Stumbled on First things in trying RubyOnRails
...://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, introduced
C:\InstantRails-1.0\rails_apps\cookbook2\app\views\recipe\edit.rhtml,
and modified
C:\InstantRails-1.0\rails_apps\cookbook2\app\controllers\recipe_controller
C:\InstantRails-1.0\rails_apps\cookbook2\app\models\category
C:\InstantRails-1.0\rails_apps\cookbook2\app\models\recipe
I log into http://localhost:3000/category/list, chose an item, and when
I hit the ?Edit? button, error message occurred.
I then went on to modify
C:\InstantRails-1.0\rails_apps...
2005 Sep 25
7
(newbie) Missing Template Error using Rolling With Rails Tutorials
Hi all,
New to the list, Ruby, & RoR. I''ve been going through the Rolling
With Rails tutorial, but am getting the following error when the
instructions tell you to add the @recipes = Recipe.find_all line to
the RecipeController:
Template is missing
Missing template ./script/../config/..//app/views//recipe/index.rhtml
The index.rhtml file is right where it''s supposed to
2006 Apr 11
4
cookbook2
I am a new user to RoR/ I have been working on RoR cookbook2 tutorial
which could be found at
http://instantrails.rubyforge.org/tutorial/index.html. As I have been
going through different stages through trial and error, but now a stage
has come that i m stuck and not able to proceed any further. when it
comes to create a list.rhtml in recipe folder under views, and editing
the code which is
2010 Apr 07
0
Problems with no method error with rufus scheduler
...9;rufus/scheduler''
scheduler = Rufus::Scheduler.start_new
scheduler.each ''10s'' do
recipe = Recipe.check_for_new_print_jobs
end
And here I get an error.. etc. method check_for_new_print_jobs not
found.
The method is in the recipe controller
/app/controllers/recipe_controller.rb
class RecipeController < ApplicationController
def index
end
def show
end
def check_for_new_print_jobs
File.open(''test_scheduler'', ''a'') do |f1|
f1 << "Hey, I am still alive" + Time.now.to_s+ "\n"
end
end
ruby -v
ruby...
2006 Jan 06
3
Cookbook recipes eg - ordering categories in the recipe pull-down box
People,
I can order categories when looking at the categories list page but how
do I change the recipe page to list the categories in alpha order in the
recipe pull-down box?:
> <p><b>Category:</b><br>
> <select name="recipe[category_id]">
> <% @categories.each do |category| %>
> <option value="<%= category.id
2006 Jan 23
2
scaffolding generators and pluralization rules
I''ve been working through the "Rolling with Ruby on Rails" tutorial and have come up against something I''m hoping someone here can help me understand.
In part two of the tutorial, Curt introduces the "ruby script\generate scaffold re
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2005 Mar 06
2
Recipe Browser 0.4.1
I am please to announce the release of Recipe Browser 0.4.1. This
project (and files) can be located at
http://rubyforge.org/projects/recipe/.
This release brings Recipe Browser up to Rails 0.10, with a handful of
bug fixes. Special thanks to E Gard (x2egard) the newest member to
the project who also happened to do all the work for this release ;).
We would love to hear any questions,
2006 Jan 02
19
AR: How to store and restore in YML.
Hello-
I have a database with entries that are segmented by customers. I would
like to be able to store / delete / restore a particular customer''s
information. I will need to rebuild the rows on restore and also
rebuild the associations for the different tables.
For example,
customer {
id
name
}
companies {
id
customer_id (belongs_to)
name
}
contacts {
id
2006 May 21
8
Rails and Postgres
Hi, I''m new to Ruby on Rails and am having a little difficulty working
through the ''Rolling with Ruby on Rails'' tutorial. Can anyone help?
I''m trying to get the cookbook application to work via a Postgresql db.
But get the following error when trying to access
http://127.0.0.1:3000/recipe/new
Errno::EINVAL in RecipeController#new
Invalid argument