Displaying 20 results from an estimated 100 matches similar to: "In a find, can''t you use both :include and :limit ?"
2006 Apr 19
2
I need help in ActiveRecord..
I have this Product.find(:all, :include => [:brand, :category, :type],
:group =>
"description"), but it dont group by description why?
Bruno
--
Posted via http://www.ruby-forum.com/.
2006 Apr 10
1
random | in join statement with more than one :include
I have an ActiveRecord class that has several has_many,belongs_to,
habtm, and the new has_many => :through relationships.
Whenever I try a
find(:all, :conditions => "some conds", :include [:relationship])
it works fine, but if I have
find(:all, :conditions => "some conds", :include [:relationship,
:other_relation])
it gets a sql error such as
Mysql::Error: You
2008 Jan 12
1
Collection_Select not showing Selected option
Hi, I''m having some problem with getting collection_select to return
the current value when editing a record. According to everything I''ve
seen, there was an issue but it''s been fixed, but I can''t figure out
why it isn''t returning the current value as a selected option. I''ve
checked the table structures, and both the call_driver.product_line_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
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
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
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 1000 samples.
--
View this message in context:
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
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 =>
2008 Apr 21
1
Urgent ActiveRecord has_many Problem - Please Help
Hi Guys,
I''ve been looking everywhere for an answer to this but so far without
success.
I have three models:
1) employees
has_many :memberships
has_many :projects, :through => :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
2007 Jul 26
1
Bi-directional self-referential HABTM
Hi,
I''m having a little trouble figuring out how to make a self-
referential HABTM bi-directional.
I have a Employee class. Each employee 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
=>
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 Jan 08
1
Need input on DB/table design
I''m building a site.. Dah!! and it requires different skills for
different jobs in different states. the site will start off in only
one state but I want to make sure I''m ready for many states. I''m
thinking of a generic skills table with columns skill1 .... skillN.
then another table with columns state, job type, skill name, skill
column mapping to the column in the
2006 Mar 29
2
delete_all not resetting auto incement in database
Hey
I''m writing a simple admin interface thats reading user data (skills)
from a comma separated file.
To clear the database before inserting new skills, I use
Skill.delete_all
Then I insert the new values I read from a file. Everything goes well
up to the point where I see that auto-generated ID''s are not starting
from 1. They start off at 840 (responding to the number of
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"
2007 Jul 09
3
NoMethodError when using find_by_sql
I''m try to verify users on login. Here is my code:
def self.authenticate(username,password,account_code)
employee = self.find(:all,
:select => "e.id, e.first_name, e.last_name, e.username,
e.account_id, e.department_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
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 11
1
ActiveRecord collection_select and has_and_belongs_to_many
Hello everyone, first post to the list and a relative newbie to Rails
development. Done quite a bit of JSP, PHP, HTML, XML etc and thought I would
kick the tires on Rails to see if it can speed up development for internal
applications. Anyway, I am running into a problem that is just driving me
crazy and everything I read on the net doesn''t seem to help. I was hoping
someone here might
2006 Aug 04
2
problem eager loading with sti
Here''s the setup (working off Rails 1.1.4):
Class Project
belongs_to :employee
Class Employee < Person
has_many :projects
When I try to paginate(:employees, :include =>
:projects) I get the error "Association named
''projects'' was not found; perhaps you misspelled it?"
I can :include other models that the Person class
has_many or habtm of, and if I