Displaying 20 results from an estimated 8000 matches similar to: "many-to-many with extra fields"
2007 Dec 12
7
Release Retrospective
First off, congrats to everyone for getting Rails 2 released. A lot
of work went into the release, and it''s good to see us reach this
milestone. And now that the release dust has settled, I think it
might be useful for us to have a retrospective and evaluate how the
release went.
I think the Ruby on Rails project has improved a lot this year, and
this is another opportunity
2006 Jan 15
6
Saving one-many associations (elegant solution please)
What is the most elegant way to save new one-many associations?
order = Order.new(:name => "My Order")
order.line_items << LineItem.new(:product_id => 1, :quantity => 2)
order.line_items << LineItem.new(:product_id => 2, :quantity => 5)
order.save
The above - which is by far the most elegant way of putting it - doesn''t
work for me - the line_items
2006 Feb 10
4
before_save gotcha
Is it will known and accepted that before_save triggers should return
true? I didn''t notice this before but now I see it in the
documentation.
Here is what I''m doing in my model:
def before_save
if self.has_album?
self.visible = self.album.visible?
end
end
That results in the expected result when album.visible? is true - but
not when it is false. To make it
2006 Mar 02
3
@session or session
Which is more appropriate? @session[] or session[]? Both seem to work.
Is there a difference between which should be used in the controller
vs. the view?
2006 Jan 09
6
What is AJAX?
What is AJAX?
SteveT
Steve Litt
Author:
* Universal Troubleshooting Process courseware
* Troubleshooting Techniques of the Successful Technologist
* Rapid Learning: Secret Weapon of the Successful Technologist
Webmaster
* Troubleshooters.Com
* http://www.troubleshooters.com
2006 Mar 19
2
How to create a proper name for the diff for the RoR patch?
Hello,
http://dev.rubyonrails.org/wiki suggests to:
Create a patch with your changes: svn diff > my_properly_named_patch.diff
but how this proper name looks like?
olegf
2006 Apr 26
4
Re: Rails AR/Oracle Unit Test: [4280] failed
The revised patch submitted on #4748 broke the build, I''m looking to
sort out why.
Also note that this auto-test email didn''t make it to rails-core because
it was too big (every test failed, so the resulting email was huge).
I''ll patch my auto-testing script to truncate the email to no larger
than a few kb.
Michael Schoen wrote:
> "marcel" made
2006 Mar 22
2
Edge Rails (1.1.0 RC1) and Typo Trunk
I tried the current Typo trunk with Edge Rails (1.1.0 RC1) and ran
into the following problems:
1) /public/../config/environment.rb:107: undefined method
`enable_upload_progress'' for ActionController::Base:Class
(NoMethodError). I commented this line out and installed the Upload
Progress plugin and this problem _appears_ to have gone away.
2) The second problem I
2006 Jan 03
4
Would someone like to tell me why this code will not solve my problem? (it''s short)
I am building an invoicing system but cannot use the auto_increment
field to determine the invoice number (because they are running 3
different companies off the one system. I need to find the last
invoice number from any given company and then add 1 to it to get the
next invoice number. BUT, there is a unique case on the very first
invoice produced because there is no earlier invoice
2006 Feb 28
3
Object#id will be deprecated?
I didn''t get the memo on this :P
members_controller.rb:12: warning: Object#id will be deprecated; use
Object#object_id
Line 12 is:
@member = Member.find(@current_member.id)
How _should_ I be writing that line?
Thanks,
Joe
--
Posted via http://www.ruby-forum.com/.
2006 Feb 20
5
find(:all) vs find_all
I started with Ruby on Rails in the 0.13.x period, so I''m sure I
missed out on a lot of history. There''s probably some good
explanation for something I''ve been wondering about, but I haven''t
seen it written down anywhere. Maybe someone can clue me in.
I''ve always felt that one of the uglier APIs was the
ActiveRecord::find() method. I call
2007 May 08
3
assert_difference eval magic in [6693]
I just saw Marcel''s change to assert_difference that changes the
method API to take a string param that is evaled in a lambda.
http://dev.rubyonrails.org/changeset/6693
I much preferred the old API, since it''s simple enough to pass a
lambda. Passing a string means the lambda is in the wrong scope and
doesn''t have access to objects in the test case scope.
For an
2006 Jan 11
6
RJS and layouts
Hi all,
I''ve been using RJS more and more for my app and I have sorta run into a
possible issue. My app has different user roles that require different
layouts. So far, this has worked fine, but now that I''m using rjs more
and more I''m finding that the two don''t really work together since I
have to rails not to use a layout upon controller method
2006 Jan 05
4
testing file uploads
Hi all,
I was wondering about the class used when rails receives file uploads.
Sometimes it appears to be a File, and other times it is a StringIO.
Also it has methods such as original_filename that don''t appear to
belong to either of these classes. I ask because I''m trying to work out
how to test my fil upload related models and controllers.
Is there some standardised way of
2006 Feb 25
2
How do templates get access to controller variables?
This is probably more of a Ruby question than a Rails question. I''ve
always wondered exactly how controller instance variables are being made
accessible to the ERb code in the views.
In the Agile Rails book on pages 38, there''s a sidebar at the top that
hints at what''s going on:
"Rails does some Ruby magic so that the instance variables of the
controller
2006 Jan 18
6
next rails release?
when is the next release of rails expected to drop?
i''m looking forward to the multiple habtm associations working
correctly, among a bunch of other fixes... just curious!
-A
--
Posted via http://www.ruby-forum.com/.
2006 Jan 08
2
sorting issue
I''ve got the following setup:
category (hm) <-> (bt) activity
An activity has an amount, date, location, note, and category. I''m
sorting my activities table by category_id (foreign key in activity),
but how do I sort it by category_name instead? Basically I just need
category_name in the result set. Here''s what I have now:
@all = Activity.find(:all, :order
2006 Mar 25
7
Overriding <div class="fieldWithErrors">
Does anyone know how to override the <div class="fieldWithErrors">
behaviour when a form field is incorrect?
Thanks,
Dan
2006 Apr 24
4
[TIP] Ensure your test data is valid
Recently I wanted to check that my test data was valid. Seems like a
reasonable thing to want to do so I thought I''d share the rake task. Add
this code to a rake file in lib/tasks and run with rake
db:fixtures:validate. It will print out the class, record id and error
messages for any model objects that fail validation.
Enjoy!
-Jonathan.
--
namespace :db do
namespace :fixtures do
2006 Jun 08
3
has_many :through updates on delete.
I have a model that looks like this:
class Actor < ActiveRecord::Base
has_many :member_groups, :foreign_key => ''member_id'', :class_name =>
''GroupMember''
has_many :groups, :through => :member_groups, :source => :group
end
class Group < Actor
has_many :group_members, :foreign_key => ''group_id'',:dependent =>