similar to: has_many :through full stack help

Displaying 20 results from an estimated 100 matches similar to: "has_many :through full stack help"

2013 Oct 23
3
Rails 4 and HABTM Checkboxes: Unpermitted parameters error
I have a simple Rails 4 project with two scaffolded models: Practice and Practitioner. I have set these both as habtm and am in the process of adding checkboxes to the Practitioner form so that I can check off the practices that this practitioner belongs to. In the practitioners_controller, I added practice_ids to the practitioner_params permit list, but I am still getting the error: Started
2009 Dec 24
1
Question to use R plot GO pie chart
Hi, I have a list of IPI gene IDs. I want to find out whether there is a package which can map the gene ontology to these IPIs, and plot the pie chart to demonstrate the molecular function distributions. The input is like the following gene IPI IDs: IPI:IPI00008860.1|SWISS-PROT:Q9BXJ4-1|TREMBL:Q542Y2|ENSEMBL:ENSP00000231338;EN
2006 Jan 19
0
Problem with an Tree-like object hierarchy (ActiveRecord acts_as_tree)
Hello people on rails, I am developing a web interface for a database that has hierarchical data. I want the user to be able to browse the tree (~1300 nodes) and activate/deactivate and showing/hiding groups of nodes (like selecting one node selects all the children and the leafs). So I have a tree of objects (ActiveRecord acts_as_tree). Because I need the tree to be persistent and I
2006 Feb 11
3
Creating new object using params posted from form
Hi, I have a problem creating an new instance of an object using params posted from a form. The object being created is not a sub class of ActiveRecord and is very simple. It''s model file is just: class Search attr_accessor :major_build_id, :minor_build_id, :environment_id, :system_id end The controller creates an empty instance variable the first time the page is called, else
1998 Jul 02
1
Synchronize Unix/SMB passwords with 'synchpasswd'
Hi, It's been a while since I created my smbpasswd file, and therefore it is no longer in synch with my Unix file. I've added and removed users over time, and now I need a way to update the 'smbpasswd' file without losing the encrypted passwords that are already in place (ie. I don't want to just run 'makesmbpasswd.sh' again). So, I've written the
2006 Aug 02
2
many-to-one relationship, do I need a second table?
Ok, to keep things short. Im wondering if I need a secondary relationship table to handle my many-to-one relationships. Here is an example of what I''ve written down. For instance say I want to find all of the people in a given location. class Location < AR:Base has_many :people end class Person < AR:Base belongs_to :location end My SQL tables look like: CREATE TABLE
2005 Nov 03
0
AR model and virtual attributes
i have a need to create a ''virtual'' attribute. Is the following possible? class User < ActiveRecord::Base # user things are owned by user at his selected location has_many :owned_things, :class_name => "Thing", :conditions => ''user_id = #{id} and location_id = #{location_id}'' attr_accessor :location_id end class AccountController <
2008 Jan 09
0
problem with checkboxes updating table
I''m having issues getting checkboxes to update a cross-reference table correctly. I keep seeing entries in the locations_users table, for location_id and user_id, "11" and "2", respectively. The user id is fine, but there is no such location with id 11. There are only 5 locations and their ids go from 1-5! I can''t seem to find where the 11 is coming from.
2005 Sep 28
0
search engine, select the selected option
hey, i have a search engine that let u search on the an employee how can i make that if the user select "employee1" , on the next page "employee1" is selected this is my code (rhtml) <tr> <td><label for="employee_id">Employee</label></td> <td colspan="3"><%= select "employee", "id",
2006 Jun 26
2
How can I sort options in a select box?
Pretty much a newbie here, looking for help on select boxes in forms.... Is there any way in the view to sort the options of a drop-down select box? My current code (within a larger _form.rhtml file) is: <div class="form-element"> <label for="asset_location_id">Location</label> <%= select ''asset'', ''location_id'',
2011 Sep 27
0
has_many with :finder_sql returns [nil]?
Is it supposed to do that? I find it very confusing. AR 3.0.10 class Unit has_many :units, :finder_sql => proc { "SELECT * FROM `#{table_name}` WHERE `location_id`=#{id} AND `location_type`=#{Location::UNIT}" } end Both should return []. However... >> Unit.first.units.find([1000000]) [2011-09-27 10:05:11|main|debug] Unit Load (4.0ms) SELECT `units`.* FROM `units`
2006 Jul 31
1
Adding new rows to a db
I''ve created the following function, and for testing have hardcoded the following values: def addNewRow @timesheet = Timesheet.find(:employee_id => ''1'', :cost_code_id => ''14'', :dept => ''007'', :ending_date =>
2006 Mar 16
4
Table Relationships Problems.
I have the following tables setup: locations :id :name systemmessages :id :name systemmessage_validtimes :id :name :systemmessage_id :location_id :start :end The systemmessage_validtimes has a ''has_many'' relationship with systemmessages, meaning that there could be many valid times for each system message. @systemMessage = Systemmessage.find(1) E.g. I
2006 Nov 04
0
Problems with ActiveRecord, Oracle adapter, find_by_sql, multi-table join - ORA-04043 error
Hi all, Windows XP Oracle 10g client OCI8 0.1.16 Ruby 1.8.5 Rails 1.1.6 I''m hitting weird behavior with the Oracle adapter and a find_by_sql call on a multi-table join. The SQL looks like this: SELECT DISTINCT e1.ip_address, loc.street, loc.city, loc.state FROM schema.net_element ne, schema.equipment e1, schema.equipment e2, schema.building b, schema.cust_loc cl, schema.location
2006 Aug 04
5
query across tables
I am trying to do things the proper rails way and use the auto generated id to refernce other tables. Now I''ve hit a wall in trying to write a query. timesheets: id, employee_id, code_id, ... values codes: id, job_number, code How can I show just the timesheets that belong to a specific job? I would need to check the codes table and look at the jobs, so I was thinking of something
2010 Dec 14
5
Build associated model confusion
I''m new to Rails3, and I''m just trying to get one last thing to work before I call it a night. The situation is the following (please if the code is horrible, just let me know, still learning): I want to log a dive. I might have a new location on that dive at which point I have to create a new Location, and then create the dive. A dive has_one location. A location has_many
2008 Apr 23
1
Validation dependent on unsaved parent
I''m having trouble with a validation that depends on an attribute of a belongs_to parent. If the child is added to an unsaved parent (parent.children << new child), the has_many collection parent.children includes the unsaved child. However the belongs_to attribute child.parent appears to be nil until the parent has been saved. Without access to the parent attributes, the validation
2008 Jul 12
0
Limits on Postgresql integers not respected
Hi, I find that limits on postgresql integers are not respected in Rails 2.1. For example setting t.integer :employee_id, :limit => 8 resolves to a regular int in schema.rb: t.integer :employee_id Is there a quick monkey-patch to this? Ram --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2007 Jun 08
0
Advanced search
I like the simple search of ferret; I would like to take this one step further and do an advanced search; the user will type in key words and use a drop down box to select the location; now how to pass this location_id to the ferret search so it searches key words only on matching records with same location_id? thanks -- Posted via http://www.ruby-forum.com/.
2006 Nov 04
0
one to many relationship; has_one
I''m new to ruby and rails and as a result am a bit lost on implementing a one to many relationship. In my DB I have 2 tables contents and locations, contents contains the foreign key location_id. I generated a content and a location model using rails scripts and then edited the models as follows class Content < ActiveRecord::Base has_one :location end class Location <