Displaying 20 results from an estimated 5000 matches similar to: "How do templates get access to controller variables?"
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 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 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 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 Mar 23
5
Dirt simple .rcss templates
There was some discussion on this list recently about doing .rcss
templates in Rails using a custom template handler. I''ve come up
with a very simple way to support rcss without a handler. Turns out
all it takes is a route and an action that calls render(:file...). I
put a full write-up on my blog earlier today:
2006 Jan 27
5
Before I write this myself, is there already an easier way?
Recently I''ve wanted to be able to take the data I''ve painstakingly
defined in my fixture files and slurp it up into my development database
so I can play with my website (locally, in development mode) with the
same data I use in my tests.
In a similar vein, I want to take the table definitions in the
development_structure.sql file and use it to re-define my development
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 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 17
1
many-to-many with extra fields
I''m trying to work with a many-to-many relationship, but the join
table needs to have a is_primary field. What is the best way to work
with this (adding / changing primary / deleting)? I understand that
the :through option in Edge Rails can handle this better, but I was
just wondering if there was a good way to handle this with Rails 1.0.
Thanks,
Kyle
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