Displaying 4 results from an estimated 4 matches for "m000873".
Did you mean:
1000873
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
2006 Jun 30
3
@foo = Bar.new(params[:foo])
While doing @foo = Bar.new(params[:foo]) in a controller, the
application is open to injection attacks.
For example,
My model has following attributes :
name
password
admin - boolean
Now, if on my form I''m just acception name & password, and doing @foo
= Bar.new(params[:foo]) in my controller, someone can just enter
following in form :
<%= text_field ''foo'',
2006 May 28
0
[SUMMARY] Rails Core Weekly (May 23 - May 28)
...ing plan to make this not so, anymore. The
plan results in:
update_attributes params[:shop], {:allow => [:header_color1, :header_color:2]}
However Marcel whispers quietly beneath his beard that you can use
ActiveRecord#attr_protected (
http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000873) :
class Customer < ActiveRecord::Base
attr_protected :credit_rating
end
but alas this is not what Laszlo had in mind. Tim Lucas closes the
thread by providing a wonderful alternative:
%w(name email address).each { |f| @person[f] = params[:person][f] }
[ http://wrath.rubyonrails.org/piperm...
2006 Jun 05
2
When adding a record in console, a parameter comes in as null even when I set it
In console, I am trying to create a User but the :account_id does not come
in. Console just gives me back :account_id => nil. Obviously I''m trying to
set it though. Silly console...
But, I can set the account_id column in my controller like so:
@user = User.new(params[:user])
@user.account_id = account.id
@user.save
Here''s what I give to the controller:
User.create :name