similar to: update_attrbutes without saving?

Displaying 20 results from an estimated 100 matches similar to: "update_attrbutes without saving?"

2005 Dec 01
2
View helpers and nested attributes
Hello all, I have a model with two entities (document and asset) and a 1:1 relationship defined between them (every model has an asset). I want to generate a rthml view that generates a hash for document attributes and a nested hash for asset attributes (for example {:document =>{:name=>XXX :asset => {date =>XXX}}) According to the Pragmatic Programmers book (page 355), the input
2006 Apr 27
2
NoMethodError - why?
Getting this error when hitting update. NoMethodError in Article#update You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occured while evaluating nil.update_attributes Source code. def create @article = Article.new(params[:article]) @article.user = @session[''user''] if @article.save
2006 Mar 17
3
Updating Table without ID Column
Hey All, I''ve been having a slight problem updating attributes for a row that matches something other than it''s ID...For ex: My table that has 3 rows..ColumnID, ColumnTitle, and ColumnDescription. I want to update a row in that table WHERE CoumnTitle = @myvar....But whenever i run update_attrbutes[:mytable] it''s looking for an id for the record when i need to to
2006 Mar 05
6
Which postgresql adapter to use for rails core? How about production?
I wanted to fix some things up in the trunk, so I set up the databases and ran the unit tests. A bunch fail for postgres, and even more error out. I know of two postgresql adapters: postgres-pr and ruby-postgres. Strangely, they each fail different tests. So if I want to fix things up, which one should I be using? For that matter, which adapter should I be using for production? Finding out
2007 Feb 28
12
Specifying that code is called in a block
Not sure if this is possible currently. I have a section of code like this: ActiveRecord::Base.transaction do cow.save! duck.save! dog.save! end (Names changed to protect the innocent.) I''d like to specify that the saves run in a transaction. I can do ActiveRecord::Base.should_receive(:transaction).and_yield But is there any way to specify that the code is
2006 Jan 23
5
Undefined method error
Hi everybody, Small problem. I get this error: undefined method `all_categories'' for BlogCategory:Class Code of BlogCategory class is: class BlogCategory < ActiveRecord::Base has_and_belongs_to_many :blog_posts validates_presence_of :name validates_uniqueness_of :name # Return all categories ordered by name def all_categories find :all, :order =>
2006 Mar 06
6
Executing SQL in rails, and the types of the data returned
Hi, Every once in while I have to run SQL by hand, in my models mostly. But I''m wondering if there is a better way of doing it than I do. And, I have a question concerning types of the fields in the result the query produces. First, about the types. In a certain model, to get and return the value of a boolean function, I have to do: result =
2006 Mar 07
4
Get rid of the "public"
Hello to all! First I want to appologize if this topic has been already discussed but the search does not work :) I have RoR installed on a shared server. I also have a RoR application installed in a subdomain. The structure is as follows: www //this is my home WWW folder +--- www //maps to www.mydomain.com | +--- webapp //maps to webapp.mydomain.com. Here is my RoR application |
2006 Mar 28
8
Rails 1.1: not-null constraint violations
Since upgrading to Rails 1.1, I now get these errors: PGError: ERROR: null value in column "added" violates not-null constraint : INSERT INTO authors ("added", ...) VALUES(NULL, ...) The ''added'' column has a default of current_timestamp, and this used to work fine with Rails 1.0. Are we supposed to put default values in models'' before_create or
2006 May 18
5
Overriding default DELETE behavior with logical deletes
Hello! I am trying to figure out how to implement *logical deletes* instead of physical deletes using ActiveRecord. Basically, in many applications that deal with E-Commerce, you really can''t physically delete almost anything, because records must be kept for auditing and customer service tracking purposes. In the past, I''ve implemented logical deletes as follows: 1.
2006 Jan 26
3
Problems with simple scaffold code
Hi all, I had scaffold generate some code on a brand new app the trace is here: http://rafb.net/paste/results/H87GHC68.html Could you point me to what problem needs to be fixed please as i''ve been banging my head against this for some time now? The table is very simple and its called "user" with id, email, password fields. I''ve set pluralize_table_names to false
2006 Jan 29
2
field sets and unicode
Hello gentlemen, I''ve forced to such unicode problem: I have: <%= text_field_tag ''search'', nil, :id => ''search'', :size => 10 %> <%= observe_field ''search'', :url => {:controller =>
2011 Jul 08
3
Efectos aleatorios, interaccions y SNK, LSD o Tukey
Queridos R-users: Tengo una duda que hace mucho tiempo que estoy intentando resolver, os explico a modo de ejemplo: Tengo estos efectos: Año(5 niveles),Localidad (10 niveles) y genotipo (3 niveles), año y localidad son aleatorios y genotipo es fijo (los he escogido yo). Me gustaría hacer obtener una tabla parecida a la Tabla Anova donde aparezca cada factor y sus interacciones y
2007 Apr 18
1
[Bridge] Re: Bridge Digest, Vol 31, Issue 6
Hello You must add first: vlan (tagged) to eth2 eth2 interface is not tagged by default and not know vlan-s . It is like a cisco if you have 24 ports in cisco by default all ports are in vlan1. if you want to do trunk (with vlans) you myst add (vlans) to this ports (tagged or untagged) So you can compare that all interfaces in linux by default are in one vlan(but not tagged). (only for
2006 Mar 09
3
Building a model from a database view
Hi, I''m trying to use rails to build a model from a database view. I get this output C:\dev\v6\project>ruby script/generate scaffold Assignment ... error Before updating scaffolding from new DB schema, try creating a tab le for your model (Assignment) Is this not possible in Rails? It would be *really* helpful for my application. -------------- next part -------------- An
2005 Dec 22
3
foreign_key setting ignored
I''m having a spot of bother creating a ''has_many'' relationship between two legacy database tables. The relationship is ''company'' table has many linked records in the ''contact'' table. Iv''e used ''generate scaffold'' on these tables and everything is fine. I then decided to define the relationship in the
2007 May 04
1
Multiple SA in the same IPSec tunnel
Hi, When a IPSec tunnel is established between two peers, I understand that the "normal" situation is to have in a given moment two SAs, one for each direction of the tunnel. However, in one of my tunnels (peer P1 running GNU/Linux with setkey and racoon; peer P2 is a Cisco router) there is a large number (around 19) of SAs established (this has been observed in P1 with
2006 Mar 17
3
Timestamps casted to nil?
Hi, for some reason, all timestamp fields with or without time zone in my Postgres tables seem to be casted to nil. From console: >> me = User.find(''PS12345'') => #<User:0x2379788 @attributes={"mtime"=>"01.03.2006 13:26:32.737166", "valid"=>"8", "valid_from"=>"01.03.1999 14:09:21 CET",
2006 Feb 19
2
possible rails -> postgresql bug
Hi I have a problem accessing an array field in a Postgresql database. Here is the table definition. View "neil.flashing_codes" Column | Type | Modifiers -------------+-----------------------+----------- code | character varying(10) | description | text | folds | integer[] | View definition: SELECT
2006 Jan 24
9
ActionMailer: Mail isn''t delivered
Hi all I used the search for this, but I got an Application Error, so sorry for the newbie question. I have tried to send an e-mail using ActionMailer. I have to following config (environment.rb): ActionMailer::Base.server_settings = { :address => "mail.psyguide.org", :port => 25, :domain => "mail.psyguide.org", #:authentication => :login, #:user_name