Displaying 20 results from an estimated 1000 matches similar to: "best practice for object transaction?"
2007 Jul 11
10
autocomplete in array
Experts,
have you figure it out with autocomplete to pass as array objects?
still i''m finding out the way to figure. :(
regards,
Bala
--~--~---------~--~----~------------~-------~--~----~
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
2005 Dec 27
2
actions with no views?
In Depot, the demo application in the the Agile book, actions that
modify the model such as add_to_cart redirect to another action that
has a clear view role, like index, or show_cart, instead of
generating the view themselves. This uses an HTTP redirect that goes
to the client and returns.
Is this an idiomatic way to design the flow in Rails?
-- fxn
2006 Oct 02
2
when to use find_by_sql
I have a bunch of queries to compute some counters, like
find_by_sql(<<-SQL
SELECT p.*, c.nfavourites
FROM people p, (
SELECT fp.person_id, COUNT(fp.user_id) as nfavourites
FROM favourite_people fp, users u
WHERE fp.user_id = u.id
AND u.cluster = ''#{in_cluster_of_user.cluster}''
GROUP BY fp.person_id
) as c
WHERE
2005 Dec 23
2
SQLite in-memory
I left ":memory:" in database.yml for testing and the most simple
tests in the Agile book do not work (see trace below for test_truth).
Since that''s what comes with the distributed database.yml I suppose
it''s me doing something wrong.
Did someone get SQLite ":memory:" working? How does it grab the schema?
-- fxn
% rake test_units
(in
2007 Dec 10
2
Updating Rails to 2.0 on Mac OS X 10.5.1 won't work
Hi,
I just wanted to update my Rails installation with "sudo gem update
rails" but I get this error:
Updating installed gems...
Bulk updating Gem source index for: http://gems.rubyforge.org
Attempting remote update of rails
Install required dependency activesupport? [Yn] y
Install required dependency activerecord? [Yn] y
ERROR: While executing gem ... (OpenURI::HTTPError)
404
2008 Oct 11
8
Observing few fields in a form - Best Practise?
Hi,
im looking to build a page similar to a shopping cart page. When you
change the ''price'' or ''quantity'' fields, the total is calculated and
displayed.
There are other fields in the form which have no relation to this
action. So i guess observe_form is not required. Can someone tell me
what the best practise is for this?
2005 Dec 25
3
SQLite primary key schema
So after successfully getting the test SQLite db to run from memory, I
tried running some tests but found that somewhere in the schema
translation from Postgres (my devel database) and SQLite Rails fails
to properly set the ''id'' column, which breaks all kinds of things.
Take as an example my ''users'' table. In Postgres the schema is
(generated with pgAdmin III):
2007 Oct 12
3
whats the right way to avoid this nil error..
I have an model Order and a model Customer. Each customer has_many
Orders. Each Order belongs_to a Customer.
If I create an order but don''t specify a Customer (for whatever
reason, maybe it''s unknown at the time).. I obviously can''t access
@order.customer.name because I''ll get a nil error...
So what''s the right way to handle that? If the Customer is
2011 Dec 01
5
Validation failed: Host already has a report for time and kind
Howdy,
I''ve been getting this issue for about a month in dashboard. All our
nodes poll on a cronjob between 00:00 and 01:00 daily, but one node
has been getting this as a failed task for a while, with the yaml
files building up on the server. Outside of this one cronjob, other
puppet runs on the same node are running just fine. The backtrace on
dashboard is:
Importing report
2008 Apr 30
7
rescue_from issue with AWS - uninitialized constant
The new rescue_from in edge rails seems to conflict with
ActionWebService, which I need for various other purposes. When I
define, for example (with AWS gem installed):
<b>rescue_from ActionController::RoutingError, :with
=> :page_not_found</b>
I get the exception:
<b>uninitialized constant
ActionWebService::Dispatcher::ActionController::Base</b>
OK, so AWS
2005 Dec 22
13
in-memory SQLite for testing
I am following the rails book, and arrived to the section about
testing. The test database is configured as:
test:
adapter: sqlite3
database: ":memory:"
and I get this error with the simple product test:
% ruby test/unit/product_test.rb
Loaded suite test/unit/product_test
Started
E/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/lib/sqlite3/
errors.rb:94:in
2006 May 18
3
ActiveRecord after save new and old values
I want to write a function that after an ActiveRecord saves
successfully, can show me what the before and after values of a
particular column are. Is this possible without creating a separate
object before modifying the current one?
-John
2009 Nov 26
15
bad move? - complex form with *many* observe_field's
I have a pretty complex form with many text fields and a number of
selects. We let the user add multiple types of associated objects to
the parent object and to edit the values for those associated objs, so
the form can have something like the following number of fields on the
page:
9 text fields + 3 selects + a*(1 text + 1 select) + b*(1 text + 1
select) + c*(1 text + 1 select) + d*(1 text +
2006 Feb 11
5
after_(read|find) callback?
I am pondering the possibility of encrypting/decrypting some fields
in a SQLite backend on-the-fly.
The point of the message is not security, I know that''s broken, but
whether there''s a technique that provides on-the-fly save/read
filters. Of course the solution would need to work transparently in
joins, so
user.posts.last.title
would do the right thing if title
2007 Dec 13
16
"Tricks" for testing after_create callback???
I''ve got a model Message, which needs to send an email using action
mailer after it''s first saved in the database.
I want to pass the model to the mailer which then uses methods on the
message model to render the email.
So the natural way to do this is in an after_create callback on the
Message model.
But I can''t see an easy way to test this. Here''s my spec
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to
2.2.2.
I am almost there but I have hit a problem with ActiveRecord.
Before the upgrade, the following code was working fine.
def create_root(administrator)
root = create_root_collection(self.pingee_name,
administrator,
2006 Mar 10
9
Observers?
Hello all!
I''m having an issue with Observers, and I''m hoping someone knows the
answer.
Here is the definition:
app/models/vehicle_observer.rb
> class VehicleObserver < ActiveRecord::Observer
> def after_save(vehicle)
> breakpoint
> if vehicle.has_new_mil_indication?
> UserMailer.deliver_mil_notice(vehicle)
> end
> end
> end
2010 Feb 25
9
uninitialized constant UsersController::User
i just created an application to list the primary details of
userbut it is showing an error lik this
"uninitialized constant UsersController::User"
this is my controlller
class UsersController < ApplicationController
puts"hiiiiiiiii"
def index
puts"hiiiiiiiii"
@users = User.find(:all)
puts @users
respond_to do |format|
format.html # index.html.erb
2009 Feb 21
2
ArgumentError on model create statement
I have a rails app model that I''m getting a strange error that is just
baffling me. I''ve stripped everything out of my model down to the
basics and still get the error.
So, here is the current model:
class Metric < ActiveRecord::Base
end
When I go into the console, and issue a simple "Metric.create" command I
get the following error:
>> Metric.create
2007 Dec 13
4
Attachment_fu problems on updates
On the creation of a member the member''s picture uploads as it should.
However, when updating the member, while selecting a new picture, an
error is thrown:
can''t convert nil into String
RAILS_ROOT: /Users/chris/Documents/Projects/Rails/CommunityCMS/trunk
Application Trace | Framework Trace | Full Trace