Displaying 20 results from an estimated 1100 matches similar to: "Polymorphic associations?"
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
2007 May 05
4
autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
> On 5/5/07, Luis Lavena <luislavena at gmail.com> wrote:
> > describe "A User (in general)" do
> > before(:each) do
> > @user = User.new
> > end
> >
> > it { @user.should have_many(:contest_public_votes) }
> > it { @user.should have_many(:design_industry_user_interests) }
> > it { @user.should
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
2011 Sep 14
1
rspec and should have_many through
Hi,
Anyone can help me with rspec shoulda validations please.
I can''t get the syntax right for these validations. Please correct me
it { should have_one :tradable, :through => :trade_order}
it { should belong_to :source, :polymorphic => true }
it { should have_many :transfers, :as => :source }
this is for Rspec 2, rails 3.1,
gem "rspec-rails"
gem
2011 Mar 01
11
Did rails or shoulda go insane on the inflection of 'taxes'?
I have a model ''xp_jurisdiction_taxes'' which rails (3) created correctly.
Another model ''xp_jurisdiction_states'' has many :xp_jurisdiction_taxes.
In my spec I am using a shoulda helper to test the association but get the
following error. BTW, greped the whole project just in case and the string
''taxi'' exists nowhere.
1)
2009 Jun 27
6
User has many topics or subtopics
Hi,
So i have users in the system and i have topics. Topics also
have_many subtopics. What is the cleanest way to setup the AR
relationships if a user can either have_many topics or subtopics ?
Its basically a dual select box dropdown, where the second dropdown is
optional.
Is the best to have user_topics, and user_subtopics tables and manage
that way ? or combine into one table with STI
2007 Oct 19
11
Patch idea for rspec_on_rails
I recently wrote a matcher for testing AR associations which allows
you to specify things like:
Foo.should have_many(:bars).through(:bazes)
I''m pretty darned proud of it and a couple of people have suggested
that I should submit it to the rspec_on_rails project. Before I go to
the trouble of writing out rdoc and fully spec''ing it, I just wanted
to make sure this was
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 May 20
3
In a find, can''t you use both :include and :limit ?
I''m trying to do a find that includes a join. It has to be a find
because I''m using the results for a Pagination, so I need to limit my
query to the number of results I want to display per page.
Here''s 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
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall.
Thanks to Wilson for converting to the new form. I''ve added a few
lines. Basically, it iterates over your model associations and does
two things.
- First, just try to call the association. Usually fixes speeling
erors or other such silliness.
- Second, try to find a record with an :include on the association.
This
2011 Jun 30
8
Error of DEPRECATION WARNING
Hi,
I Have a strange error when i type the command "rake db:migrate "
Can you help to solve this error or give me some advices
the error is:
DEPRECATION WARNING: Rake tasks in /home/joanne/Desktop/picto/vendor/
plugins/prawnto/tasks/prawnto_tasks.rake are deprecated. Use lib/tasks
instead. (called from <top (required)> at /home/joanne/Desktop/picto/
Rakefile:7)
thanks for help
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 =>
2007 Jul 10
1
Reserved words
Is action_id reserved_
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
2020 Mar 31
1
Antw: [EXT] Re: Multithreaded encoding?
>>> Ralph Giles <giles at thaumas.net> schrieb am 30.03.2020 um 23:17 in Nachricht
<11930_1585603054_5E8261ED_11930_50_1_c110a52d-de95-3bbb-35b2-eca12c79f143 at thaum
s.net>:
> I'm not aware of any other attempts, and there have never been official
> plans. It's difficult to partition input for opus at anything other than
> the track level, because of the way
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
2012 May 04
3
Database schema question
Im setting up a very basic rails app and have a question about the needed
migrations & associations.
Basically, my app is an occasion reminder service that emails users when
occasions that they select or input are coming up.
Occasions will be selected from a checkbox type list or alternatively
manually input by the user (name and date of the occasion).
Users can have_many occassions.
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
=>
2011 Jul 11
36
has_many and belongs_to association
Hi ,
I want to test the one below but I got the problem
belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
in my test
context "test"do
should have_many :phrases
end
in language.rb
belongs_to :name, :class_name => "Phrase", :foreign_key => "name"
error is
1) Failure:
test: check has_many and belongs_to