search for: employee_id

Displaying 20 results from an estimated 31 matches for "employee_id".

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 fields except the foreign key field. I had hoped it would make...
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 like Timesheet.find(:all, :order => "employee_id, code_id", :conditions =&g...
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-07-15'') if @timesheet == nil T...
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", @employees.collect {|e| [e.last_name + " " + e.first_name,e.id]} %></td> </tr> code controller @employees = Employee.find_all_by_firm_id(firm_i...
2010 Jul 22
2
p-VALUE calculation
Here is my dataframe with 1000 rows: employee_id weigth p-value 100 150 101 200 102 300 103 180 ..... My question: how can I calculate the p-value in R for each employee? the distribution of the weigth will be established from the above...
2006 Mar 24
6
login forms , redirect_to and ajax-scaffold problems
Hi, I have a standard type authentication technique direct from AWDWR, so there is a before_filter :authorize_employee, :except => :login in my employees_controller.rb the authorize_employee is in application.rb def authorize_employee unless session[:employee_id] flash[:notice] = "Please log in" # save the URL the user requested so we can hop back to it # after login session[:jumpto] = request.parameters redirect_to(:controller => "employees", :action => "login"...
2006 May 20
3
In a find, can''t you use both :include and :limit ?
...the type of thing I want to do: Employee table <-> Skills_Employees table <-> Skills table Let''s say I want to find all the employees who have skill with ID = 3 (''axemanship''). The actual SQL might be: SELECT * FROM employee, employees_skills es WHERE es.employee_id = employee.id AND es.skill_id = 3 In Rails, I figured out that the right way to do that *may* be: employees = Employee.find( :all, :include => :skills, :conditions => ["skill_id = ?",3] ) -- and it works. The SQL in development.log looks correct (if verbose): SELECT employe...
2008 Apr 21
1
Urgent ActiveRecord has_many Problem - Please Help
...=> :membership 2) projects has_many :memberships has_many :employees, :through => :membership 3) membership belongs_to :employees belongs_to :projects Membership is used to join employees to projects. In my projects_controller I have a method called def disassociate_employee(employee_id) end In this function I want to somehow delete the database row in membership that joins employees t o projects. I have no idea how to do this and has so far spend two full days trying to figure this out, but starting to go a bit crazy trying to figure this one out. :-) Thanks for your help!! -...
2007 Jul 26
1
Bi-directional self-referential HABTM
...loyee can have a couple of bosses, who are also employees. The employee class has the following HABTM: has_and_belongs_to_many :bosses, :class_name => "Employee", :join_table => "bosses_courses", :association_foreign_key => "boss_id", :foreign_key => "employee_id" Now this works fine.. but only one way. I can get all bosses of an employee but I can''t get all employees of a boss. In hindsight I think it probaby would have been better to use a :through relationship for this, but I can''t really change the database schema now. The solu...
2006 Jul 06
4
Oracle HR on Rails
Interesting read...apologies if it has been posted already. http://www.oracle.com/technology/pub/articles/saternos-rails.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060706/619e650a/attachment.html
2010 Dec 23
0
has_many :through full stack help
...ave included below what I think is relevant, I am beyond just hints at this point, I need help with the code itself - just cant get it to work. THANK YOU THANK YOU if you can help -------PRACTICE MODEL------- class Practice < ActiveRecord::Base attr_accessible :name, :tax_id, :location_ids, :employee_ids, :system_ids has_and_belongs_to_many :employees has_and_belongs_to_many :locations has_many :implementations has_many :systems, :through => :implementations validates_presence_of :name, :tax_id end -----SYSTEM MODEL------- class System < ActiveRecord::Base attr_accessible :...
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: Talk" group. To p...
2006 Jun 14
1
compare items from 2 db
I''ve dug thru docs, recipes, wiki, but haven''t found anything quite like what I''m trying to do.. I have 2 databases with the same tables and same models representing them. I want to get an item (of same name) from the 2 dbs for comparison. Now, each example of connecting to multiple dbs I''ve seen (including from Rails Recipes and the wiki) assumes that
2006 Mar 24
7
Polymorphic associations?
I''ve read the stuff about polymorphic associations here: http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations But I''m not sure what exactly they are and what their advantage is. Are they the same as HABTM, but they''re "two-way"? Joe -- Posted via http://www.ruby-forum.com/.
2008 Feb 09
0
MVC interplay to query multiple models
...ndering calls/show Call Load Including Associations (0.002511) SELECT calls."id" AS t0_r0, calls."login_id" AS t0_r1, calls."created_at" AS t0_r2, calls."comment" AS t0_r3, logins."id" AS t1_r0, logins."login" AS t1_r1, logins."employee_id" AS t1_r2 FROM calls LEFT OUTER JOIN logins ON logins.id = calls.login_id Completed in 0.08172 (12 reqs/sec) | Rendering: 0.03247 (39%) | DB: 0.00363 (4%) | 200 OK [http://localhost/calls/show/1] which certainly looks to be close to the desired output: thufir@arrakis ~/goodfellow-tool $...
2008 Jun 05
2
RSpec Story - SystemStackError: stack level too deep
I have a story that executes the following (as an example to show the bug I''m experiencing): ---------------------------------------------- Given "I have a fake post saved" do @postCount = Post.find(:all).length @post = Post.new @post.employee_id = 123 @post.name = "Name of the Post" @post.description = "Description of the Post" @post.save end Given "I have visited some page" do get("/posts/") end When "I get some other page" do get(''/posts/''+...
2007 Jul 09
3
NoMethodError when using find_by_sql
...ment_id, o.pay_type_id, o.admin_yn, o.payroll_yn, o.files_yn, o.dept_report_yn,e.salt, e.hashed_password", :conditions => ["e.deleted_yn=0 and e.username = ? and a.account_code = ?", username, account_code], :joins => "as e left outer join options o on e.id = o.employee_id left outer join accounts a on e.account_id = a.id ") if employee expected_password = encrypted_password(password, employee.salt) if employee.hashed_password != expected_password employee = nil end end employee end ------------- I keep getting an error s...
2006 May 11
1
ActiveRecord collection_select and has_and_belongs_to_many
...net doesn''t seem to help. I was hoping someone here might have had the same problem and be able to point me in the right direction. Database Schema: table employees id name table projects id name table project_roles id name table project_members id employee_id project_id role_id I then have the following ActiveRecord objects: class Employee < ActiveRecord::Base has_and_belongs_to_many :project_members, :join_table => "project_members", :class_name => "ProjectMember" end class Project < ActiveRecord::Base h...
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on this, I think it''s time to ask the list. Postgres stores a Date in YYYY-MM-DD format. My users want the dates in MM/DD/YYYY format. Sure, I could explicitly convert it on the app level every place where a date is displayed, but that seemed like a DRY violation. I thought I''d be clever and simply
2006 May 22
0
(nebie) Autocomplete and many to one relationship?
...39;m not sure if I''m doing this right or not. I have a table where one of the fields is a employees name. I expect a relatively small collection of person''s names will be used. I created a simple employees table with just 2 fields: id, and name. Then in my main table I added a employee_id field and setup the belongs_to: / has_many: entries in the models of each. In my _form.rhtml I have the autocomplete line that is working: <%= text_field_with_auto_complete :employee, :name %> ie. If I start typing, I get a pull-down like entry populated from my employees table. The troubl...