similar to: Using many-to-many relations in tests

Displaying 20 results from an estimated 500 matches similar to: "Using many-to-many relations in tests"

2006 Oct 31
4
Auto-increment lost during migration.
Hi. I get some strange results when using rename_column on a primary key in a migration. It seems like the migration script removes the auto-increment property if you rename a column. This is a minimal example. create_table :foo, :primary_key => :foo_id do |t| t.column "name", :string end # renaming the primary key makes auto-increment disappear. rename_column
2006 Jan 09
6
Nil column results, possible to ignore?
For a table "clients" there are city, state, and zip fields. However, for some clients we only have a state with no actual address. The following code throws a "You have a nil object" error when outputting my client list. Is there a way around this, short of writing a specific case for each possibility? <%= client.city + '', '' + client.state +
2006 Jan 09
2
catch id from form and copy between objects
Hi all, Not completely sure what I''m doing, but I need to get data from another table based on and id. Below is some breakpointer output: irb> @params => {"project"=>{"project_description"=>"point2", "project_name"=>"break2"}, "action"=>"create_project",
2006 Jan 10
5
IP Address
There''s got to be a simple answer: how do you get the IP address of a visitor in Ruby? Any help would be appreciated! -- Posted via http://www.ruby-forum.com/.
2006 Jan 05
2
Ruby On Rails Workshop in Zurich, Switzerland
I''m happy to announce a two day RubyOnRails Workshop in Switzerland, 27.-28. February 2006. Details can be found here: http://www.invisible.ch/static/47/ rubyonrailsschulung (german) cheers Jens-Christian -- InVisible GmbH, Langgr?tstrasse 172, 8047 Z?rich Phone: +41 44 401 09 30 http://www.invisible.ch http://not.invisible.ch -------------- next part -------------- A non-text
2006 Jan 09
1
Modifying script generated scaffold output Books/Authors
People, For my little book library db I find the rails script generated stuff fine for most of my needs but there is one thing I couldn''t figure out . . Part of the auto output of app/view/books/edit.rhtml is: <%= start_form_tag :action => ''update'', :id => @book %> <%= render :partial => ''form'' %> <%= submit_tag
2013 Feb 28
2
Create polymorphic resources
Hi I have created a polymorphic association for comments since I need commenting functionality on several models. The issue is that when I create the comment in my Commets#create action, I really don''t know what type the parent is of. So, let''s say I have Foo, Bar and Comment. Comment have this: belongs_to :commentable, polymorphic: true And Foo and Bar both have:
2006 Feb 16
1
Newby: Getting "unitialized constant SockServ" -- help
I can''t seem to find my error. I think it''s fairly basic. Do I have to initialize SockServ somewhere or is this error message really indicating something else? uninitialized constant SockServ C:/rails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing'' #{RAILS_ROOT}/app/controllers/mindreadr_controller.rb:15:in
2006 Jan 12
2
Rails 1.0 gem installation - rake version not supported on
gem install rails-1.0.0 the above commands gives an error saying it requires rake 0.6? what should be done here ? - Thanks - Nirav -- Posted via http://www.ruby-forum.com/.
2006 Jan 16
1
Run method at the same class
Sory for dummy question and bad english ) i''ve got a controller class class ArtController < ApplicationController layout "main" scaffold :art def rec a = a + ''hellomoto'' end def srec for i in 0...5 # run rec here (<- i dont know how do it ) end end end at the srec method i what run rec method at while. how i can do it?) whats
2006 Jan 10
3
multiple items on 1 column
Hello, I am trying to put multiple items in one column and can''t seem to get the syntax right. These are images and the image url''s are being pulled from a database. It seems that <tr></tr> is the trigger to go onto the next item. Here is the code from the controller: def list @items = Item.find_all end Here is the code from list.rhtml file: <%
2006 Jan 10
13
# of entrys in different months
right now im writing a weblog as my first project in rails. Most tings seems to be working great :), but there is (a least) one thing left i can''t figure out how to do. As most weblogs i would like to have an archive, whick looks like this: January 2006 (42) December 2005 (60) November 2005 (2) October 2005 (101) September 2005 (4) August 2005 (2) July 2005 (101010) where (x) is the
2006 Jan 08
6
J2EE equivalent
Gang- 1. Is there anything in Ruby that handles the .properites files similar to the J2EE application servers. Or do I need to define all of the properties as constants? 2. Is there anyway I can load some of my classes (such as singletons) during the startup? I am looking for the startup classes that J2EE containers provide. Thanks -- Posted via http://www.ruby-forum.com/.
2006 Jan 21
7
n-way joins
Hi, I''m somewhat of a Rails newbie and am trying to understand how to formulate n-way (3 or 4 way) joins in Rails (where the join tables contain extra data as well.) Let me give you my basic entities: foos id - pk name - unique bars id - pk name - unique bazs id - pk name - unique frozs id - pk name - unique then i have two separate join tables: foos_bars_bazs - 3 way join
2006 Jan 02
3
rake test_units not loading any fixtures
Hello All, If I run my unit tests individually using Ruby, they all work correctly. However, if I try to run them using "rake test_units", I get a bunch of error messages. The error messages appear to be caused by rake not loading any of the fixtures into the test database. I am using PostgreSQL on Windows. Does anyone have any suggestions? Many thanks, Bruce. -- Posted via
2006 May 17
10
HABTM << producing incorrect insert sql ?
Greetings railsers - I''m trying to add to a collection through HABTM, but the sql insert is trying to insert a PK rather than letting mysql produce the auto_increment''ed PK. ## @medication_dose holds a validated, saved model @medication_dose.medication_frequencies << MedicationFrequency.find (:all) The above bails with, Mysql::Error: #23000Duplicate
2006 Jan 06
3
Getting model class by string
Hello, I have an interessting problem, I''m not sure how to solve :-) I have the name of a model in a variable like this: My model is called Article My var contains "Article" Now - How do I get the model class, so I can call Article.find, Article.new etc ... ? Greetings, Gitte Wange
2006 Dec 22
3
Zed, you''re a moron :-)
Hi ! My mongrel just starting spitting out these nice lines: The error occured while evaluating nil.accept. TELL ZED HE''S A MORON. !!!!!! UNHANDLED EXCEPTION! You have a nil object when you didn''t expect it! Not sure what happened or why, but just FYI: Zed, you are a moron :-) Happy holidays! Gitte Wange
2006 Jan 03
2
Using multiple columns as primary key
Hi! I''m trying to use a primary key made up of two columns in my model''s table. But looking at the docs, it looks like ActiveRecord only supports using one field as primary key. Can anyone point me in a direction of this or verify that it''s not supported? Greetings, Gitte Wange
2006 Feb 09
4
Ruby 1.8.4 trouble
Hi! The ruby installation on my FreeBSD-6 box have been upgraded from 1.8.2 to 1.8.4 by accident. And now all my rails have stopped working. I can''t produce any cool debug info since I have none. running script/ server just coredumps. Running the sites through apache isn''t an option since apache won''t start (get lots of these in my log: [Thu Feb 09 10:38:19