Displaying 20 results from an estimated 8000 matches similar to: "update and update_attribute woes"
2006 Jan 17
2
update_attribute and validations
Just in case it saves someone else the several hours of insanity I just
went through, update_attributes will not save unless the model
validations are satisfied, but update_attribute (the singular form)
will save the attribute to the database even if the model validations
would fail!
This appears to be a feature, not a bug
(http://api.rubyonrails.com/classes/ActiveRecord/Base.html) although
2006 Feb 27
4
update_attribute with Validation?
Does anyone know of a way to update individual attributes with
validation? update_attribute disables the validation checks in the
record model, so I''m wondering if there''s a workaround for this.
In my application, I want to allow the user to update some or all the
attributes without having to enter :password and :password_confirmation,
both of which are subject to
2010 May 14
4
Tricky model situatione
I have two models Club and users. users are regular authenticated
users and some of them might create a club. A club can also have
members (essentially users) and there are attributes and models that
apply to member but not to users.
Here is what I have right now.
Club => belongs_to :user
User => has_many clubs (since a user can host multiple clubs).
Now how do I fit this member model
2004 Aug 06
5
Client Woes
My problem is not with the Icecast server, but with my user's ability
to get a decent client to play the streams. I have 3 Icecast streams
created using Ices, and the mountpoints have the mp3 extension.
My users and I have observed:
1) If Quick Time is brought up by the browser, it skips and chokes on
the stream.
2) If Windows Media is brought up by the browser, it will do either of
two
2006 Jul 29
1
creating and storing records in Ruby
I''ve read through my RoR books and I can''t seem to find the solution.
This is a pretty basic, easy, and practical application for RoR. If you
guys know of any resources on the net to answer these questions let me
know.
Question 1:
Basically, I have a many-to-many relationship that I want to add records
to. I use something like this to add records in the A_B table:
2004 Aug 06
2
Client Woes
>This certainly sounds like the 'war for control' that often happens when you
>try to install Winamp & RealPlayer on the same box. It's been discussed at
>great length in the www.winamp.com support forum.
>
>You are sticking the URL into a .ram file in order to start RealPlayer,
>right?
No. I stick the URL, http://www.RainbowRadio.com/club.mp3 into RealPlayer,
2006 Jun 21
5
model with not te be updated attributes ?
Hi List,
I have a table that contains several fields that must be initialized
when first created, but may not be altered afterwards (when updating the
other fields) because they can be changed by external processes.
I noticed that the ActiveRecord update commands (even update_attribute)
only seem to work by loading the complete record, changing fields that
need to be changed and doing a full
2004 Aug 06
3
Client Woes
On Mon, 10 Sep 2001, Jack Moffitt wrote:
> The way to prevetn this download, or rather to work around it, is to use
> a small intermediate playlist file. In order to get maximum client
> support, m3u files are best. Just make an m3u file called stream.m3u
> and in it put:
>
> http://www.RainbowRadio.com:8000/club.mp3
>
> Then point your users to that file. Which will
2008 Mar 07
2
Trouble using RESTful helper
Hi,
I am trying to get into this REST thing, I have a nested resource
whith the following route:
ActionController::Routing::Routes.draw do |map|
map.resources :members
map.resources :clubs do |club|
club.resources :members
end
map.connect '':controller/:action/:id''
map.connect '':controller/:action/:id.:format''
end
Everything worked ok for this
2011 May 21
1
Consequences of overriding update_attribute to force validation?
I know the debate of whether this should validate has been rehashed
many times. My question is, what are the consequences of overriding
this method to force validation? Will this break fundamental things?
Will it break plugins? Is there a reason not to have a strict
validation option?
In my code I will never use this as I consider it a terribly broken
method, but some gems use it and in one case
2006 Dec 08
9
How to update partial attributes of a object from a form?
I have a user table, and it has forty columns, including name, gender,
address, email, phone...
So my @user object will have forty attributes.
I divide these attributes into 4 groups... namely ''general info'',
''personal info'', ''contact info''... and I make separate forms to edit
these 4 different group attributes.
The problem is when I update
2006 Jan 04
0
update_attribute works, update_attributes doesn''t, why?
Hello again...
so I narrowed my problem down. For some reason, while using
login_generator, any User object I pull from the DB can be updated one
attribute at a time using update_attribute, but when I try and do
update_attributes it fails every time. Is this a limitation with
login_generator that I don''t know about, or is there a way around this?
I also tried the .update method and
2007 Nov 21
3
update_attribute weirdness in edge
If I am changing a boolean value, no matter what approach I take, I
get the same results:
lets say table "users" has an "enabled" field that is boolean:
user = User.find(1)
user.enabled.toggle
NoMethodError: undefined method `toggle'' for false:FalseClass
user = User.find(1)
toggle(user.enabled)
NoMethodError: undefined method `toggle'' for
2006 Jul 11
3
update_attributes and save!
I notice that ActiveRecord::Base.update_attributes() calls save().
What if I want to get an exception if the save fails? Is there a way to
get the update_attributes() function plus the save! function?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2006 Mar 29
5
How to skip password validation when updating other fields?
Besides the hashed password, which is saved to db, I have two
password-attributes in my User model:
attr_accessor :password, :password_confirmation
I have validations on these attributes, and I need them to work both on
create and update, since I have pages for changing and resetting the
password.
Now when I want to update just the user''s login name, I guess I have the
next
2006 Jun 08
5
update only the join table in a HABTM - how?
I have a photographers app that requires giving access to galleries for
users. in one part, I want to be able to define gallery access for a
user seperate from updating any of the user info. I have this function:
def edit_access
@user = User.find(params[:id])
@user.galleries = Gallery.find(params[:gallery_ids]) if
params[:gallery_ids]
if @user.update_attributes(params[:user])
2008 Aug 26
1
transaction not working with update_attributes!
I am trying to wrap the updating of two models in a transaction and
when the transaction fails it is not rolling back.
My method is :
def update_attributes(user,params)
@user = user
@company = user.company
begin
User.transaction do
@user.update_attributes!(params[:user])
@company.update_attributes!(params[:company])
end
true
rescue
false
2009 Feb 03
1
update_attributes! does not update nested model
Hi!
I have updated my app to rails 2.3. I have form that has few nested
models and I am happy that I can just write
accepts_nested_attributes_for :tasks, :allow_destroy => true, but
update_attributes! does not update my nested model. I have tried
update_attributes, and it works. Any ideas?
Few lines from log:
update_attributes:
SQL (0.1ms) BEGIN
Education Update (0.3ms) UPDATE
2004 Aug 06
0
Client Woes
> The URL looks like this: http://www.RainbowRadio.com:8000/club.mp3
>
> My goal is to instruct users as how Winamp may be brought up to play
> the stream automatically. I am migrating from Real Audio to
> Icecast, but I cannot complete the migration with users having so much
> trouble with the streams.
So what did you expect to happen just having people click on an MP3?
2008 Mar 03
15
update_attributes not updating
For some strange reason I can''t get update_attributes to work. Any
reason why that might be?
here is my code:
controller:
def update
@user = User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
flash[:notice] = ''Your Information was successfully updated.''
format.html { redirect_to(user_url(@user))