similar to: some strange behavior for has_many with STI

Displaying 20 results from an estimated 100 matches similar to: "some strange behavior for has_many with STI"

2006 Jul 16
2
HELP - Save drop down list using "collection_select"
Each post has a single category, which I''m filling a drop down list by using this: #view <p><label for="post_type_id">Category</label><br /> <%= collection_select(:id, :type_id, Type.find(:all), :id, :category) %> </p> In my Post model I have a field called "type_id" which is to be filled by the id in the Type table upon
2010 Jun 23
0
Rails 3 - AJAX Response
Hi, I need help with some AJAX in rails 3. So basically, I have a select option in my index page for my User model. This select option is a form that modifies the user''s type. The " :remote => true " works and the type is changed when hit the submit button. But, nothing happens in the browser. The user is updated. I''m actually not sure where to put either my JS /
2006 Mar 21
3
Newbie - ActiveRecord relationships
So I''ve worked through Agile Web Development with Rails and I''m now trying my first little app to get into the swing of things. Its a task tracking app where people can create tasks and assign them to others, and also log time against the tasks. I''m having trouble working out the model relationships. This is what I''ve got so far, but its not right as
2009 Aug 11
2
Bugzilla not working following RHEL to CentOS migration
Dear listmates, I've recently moved a server from RHEL5 to CentOS 5.3 after it was decided not to renew the subscripton. Everything works beautifully except for Bugzilla, which throws MySQL errors. For example, the sanitycheck.cgi page says: # # # Bugzilla ? Sanity Check * Home * | New * | Search * | * | Reports * * | My Votes * | Preferences
2006 Nov 01
0
Re: YAML.load(some_string) doesn't return hash?
Oleg Kh wrote: > A small problem here. As per documentation on > http://corelib.rubyonrails.org/classes/YAML.html YAML.load(string) > should just return a hash. However on my windows machine it returns > something like this: > > #<YAML::Syck::DomainType:0x36d5038 > @domain="yaml.org,2002", > @type_id="map:HashWithIndifferentAccess", >
2010 Jun 08
9
[Rails Heroku] Problem with saving object (on heroku hosting)
Hi All, I have some strange problem which appears only on heroku hosting 2.3.5 default stack (not on my local computer) I have some models. Here they are: class Contact < ActiveRecord::Base belongs_to :user belongs_to :type, :class_name => "ContactType", :foreign_key => "type_id" validates_presence_of :name, :on => :create, :message =>
2006 Jan 25
1
If Param not set...
Hello all, I''m developing an application which allows users to browse items for sale... Using the url localhost:3000/browse/by_type/2 (2 is the id of the category they are in) Displays the information I want, however localhost:3000/browse/by_type/ will display an error page (becuase the id param is not set) in my by_type.rhtml view, how to i check to see if the param is set? and
2005 Dec 12
2
count sql failing with unknown table....
Hey Rails People, I''m doing my first Rails app and I''m having a newbie problem with the count method.... Mysql::Error: #42S02Unknown table ''jobs_sectors'' in where clause: SELECT COUNT(*) FROM jobs WHERE (jobs_sectors.sector_id = 1 ) Extracted source (around line #4): 1: <div class="sectors"> 2: <ul> 3: <% for sector in @sectors
2006 Mar 05
1
Help with Self-Referential HABTM
With the help of the Rails Recipes have got a self-referential HABTM relationship working, but I''m really struggling with getting a new entry from a form accepted. i should say here that the form is also submitting info for the join table too. So in my model I have: class Type < ActiveRecord::Base has_and_belongs_to_many :subtypes, :class_name => ''Type'',
2005 Mar 09
10
Confused about extending the login generator ''user''
I''ve been using the login generator ''out of the box'' for simple authentication, and its been working fine. Now I want to extend it by simply adding ''type_id'' field which links to my ''user_types'' table, but I''m hitting: #<ActionController::SessionRestoreError: Session contained objects where the class definition
2006 Aug 17
1
More on n-way.
Hey, i found some n-way threads on the list, but I think they don`t solve my case, or I didn`t understand how all of it works. I''m new to Rails, so be pacient. :) I''ll use an example of movie catalog, I''m realing doing a kind of movie catalog, for laerning rails, and I did this: Models: Movie, Actor, Director, Writer, Country, Language The Movie model HABTM Actor,
2006 Jan 21
0
Display options from HABTM
I have a large certifications table that I would like to have a little more controll over, it is part of a HABTM relationship. ----------------------------------- db''s (simplified) >certifications id course >employees id department_id type_id name >departments id name >types id kind >certifications_employees certification_id employee_id
2006 Jan 25
1
cache_sweeper causes undefined method error
I created a sweeper ItemSweeper and saved it in app/models/item_sweeper.rb. Then I put this in my item_controller.rb: cache_sweeper :item_sweeper, :only => [:create, :destroy, :update] But now when I call the view action, I get this error: ActionView::TemplateError (undefined method `title'' for nil:NilClass) on line #5 of app/views/item/view.rhtml: 5: <H1
2012 Feb 14
0
cumsum formula to determine plankton phenology
Dear R-users -- -- Heather Anne ------------------------------------------- Heather A. Wright, PhD candidate Ecology and Evolution of Plankton Stazione Zoologica Anton Dohrn Villa Comunale 80121 - Napoli, Italy website<http://www.szn.it/SZNWeb/cmd/ShowArchiveItem?TYPE_ID=HUMANRESOURCE&ITEM_ID=21942&LANGUAGE_ID=2> Lab: +39 081 583 3201 Cell: +39 366 484 2196 Fax: +39 081 764 1355 *
2006 Feb 14
0
rubyforge-0.1.1
SIMPLIFY SHARING YOUR RUBYGEMS ON RUBYFORGE! ~> gem install rubyforge SYNOPSIS rubyforge [options]* mode [mode_args]* DESCRIPTION simplistic script which automates a limited set of rubyforge operations MODES setup() initializes your .rubyforge directory. you need to run this first before doing anything else. example : rubyforge setup login()
2011 Jun 27
2
insert value of primary key into another field before record is saved
Hey all, I created a seed task: def books! books = Book.where(:type_id => Type.find_by_name(''Fiction'')).order(''id'') books.each do |book| @books = 4.times.map do |i| subbook! "#{book.book_num}-#{i}".to_s, :book_state => BookState[:available].id, :book => book end end puts "log it:
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id, rating, etc. What I have now is something like: if(@params[''category_id'']) @items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id'']) elsif(@params[''category_id''] and @params[''member_id''])
2006 Jul 20
5
How can I make has_many prevent a delete that would lead to orphans?
e.g. class Asset < ActiveRecord::Base validates_presence_of :asset_number, :make, :model, :location, :name, :serial_number validates_numericality_of :asset_number validates_uniqueness_of :asset_number belongs_to :user belongs_to :location belongs_to :asset_type, :foreign_key => ''type_id'' end class Location < ActiveRecord::Base validates_presence_of :name
2006 Jul 18
5
Newbie RoR question
I am currently working on a small database project to track company assets. Right now my Database consists of 3 tables. 1 for the equipment, 1 for the users info, and 1 for the type of equipment. I have all 3 databases working on a model test site using RoR. Where i am having trouble is getting the databases to talk together. I can''t find this answer anywhere else. My main table
2005 Dec 22
7
Ruby on Rails and lookup tables
Hi, I''m a newbie on both Ruby and Ruby on Rails, and I''m struggling with my first app. I have a table with a column called "employee_id" which is a foreing key associating it with the "employees" table. I have populated both tables. When I run "ruby script/generate scaffold <model name> <controller>" it generates a web page with all