Displaying 20 results from an estimated 2000 matches similar to: "insecure: can't modify hash"
2013 Nov 09
1
ActiveRecord return normal?
Hi Everyone,
I''m totally brand new to RoR. I''m really starting to love coding more now
that I''ve found RoR. I have what might be a dumb question, but I''m curious
to know this.
Is it normal to get this result:
In the Beginning Rails 4 book
I''m following this step:
irb(main):097:0> article.location = "Toronto, ON"
Here''s
2008 Jun 29
3
Working around/with Restful Authentication
I''m using Restful Authentication, and the code to create a user is
pretty straight forward - there is a before_save action and a
before_create action:
before_save :encrypt_password
before_create :make_activation_code
But for some reason when I try to create a user programmatically in
the controller like this:
User.new(:email =>
2009 Jun 22
1
getting error can't modify frozen hash
Hi,
When I upgraded my rails application to rails 2.3.2 I am getting
error ''can''t modify frozen hash'' on using
@something.update_attribute(params[:something]).
Can anyone help me who is familiarize with this bug?
Thanks,
2007 May 23
6
RESTful RESOURCE PARTIAL UPDATE
I have modified scaffolding code slightly to get three edit actions
and three update actions.
The requirement: to allow users to edit attributes for the same model
from seperate forms instead of one form, while using the given
scaffolding code and performing model validations. I am using
restful_authentication with the login email password validations
defined.
class users_controller
2008 Feb 13
4
Migration Issues: Can't update newly added column values
Hello everyone, just wondering if anyone can help me with a migrations
question here.
Using:
rails 2.0.2
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin]
mysql 5.0.45
Platform:
windows xp
The problem:
----------
I created a migration that is designed to add a column named
"deleted_at" (timestamp) and then remove a column named
"is_deleted" (boolean). The idea is to
2006 Jul 10
0
Strange acts_as_paranoid behavior
Using the acts_as_paranoid plugin with rails 1.1.4 (model also uses
acts_as_threaded and acts_as_taggable) and getting some unexplainable behavior.
The following tests:
assert_equal Conv.count, num
assert_equal Conv.count_with_deleted, CONVS_TOTAL
Produce the following SQL:
SQL (0.000000) SELECT count(*) AS count_all FROM convs WHERE ((
convs.deleted_at IS NULL OR convs.deleted_at
2007 Aug 03
0
acts_as_paranoid and Association Extensions (has_one troubles)
Hi... Isn''t there a proper way or hack/workaround for the following?
* For the example with unfortunate disabilities.. look below,,,
Usage of has_* (associationmethods) do {def with_deleted
AccociatedModel#with_scope} {Paranoid''s#find_with_deleted}...
The has_one associations give me a nil object when invoking it with
Model.association_OBJECT.with_deleted. Has_many does like
2006 Jan 31
2
find_by_sql question
I''m no good at SQL and I have a question that will hopefully be fairly
easy to answer.
I''m using acts_as_paranoid which instead of deleting a record adds a
deleted_at column with the datetime the row was deleted. I want to have
a find_by_sql filter out any row where deleted_at is not null.
I have (at least the relevant parts):
#a couple working filters here.
filters <<
2008 Jun 24
2
wrong number of arguments (1 for 0) when using respond_to?
Trying to get an otherwise working app (in Rails 2.0.2) up to speed
with Rails 2.1.0 and Ruby 1.8.7, I have some broken code I can''t seem
to fix:
module Pathmaker
def self.append_features( base )
base.before_save do |model|
model.path = model.name.downcase.
gsub( /\ and\ /, ''-'' ).
gsub( /\ on\ /, ''-'' ).
2008 Jul 31
2
Freeze field in active record
Hello,
I have a freeze field in a table (that I can''t change).
When I try to find a record in this table I have the exception :
C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.1.0/lib/active_record/attribute_methods.rb:104:in
`instance_method_already_implemented?''
C:/DATA/InstantRails-2.0/ruby/lib/ruby/gems/1.8/gems/
2013 Jun 15
1
A puzzle about default_scope
Hi, guys
I have a puzzle about default_scope.
Suppose I have two model:
class User < ActiveRecord::Base
has_many :blogs
default_scope where(deleted_at: nil)
end
class Blog < ActiveRecord::Base
belongs_to :user
end
I want to produce sqlselect blogs.* from blogs inner join users on users.id
= blogs.user_id and users.deleted_at is null
And the code Blog.joins(:user), which I think
2014 Mar 01
0
Rails controller problems
1. Users_Controller CRUD expects param[:id] to create User instance. With
Orders_Controller, I'd like to retrieve a list of users who have ordered. I
know Orders_Controller expects param[:id] to be for creating Order
instance. So does this mean if I want to retrieve a list of users who have
ordered, I should create a method called 'get_orders' in Users_Controller?
2. Can
2006 Nov 04
0
write_attribute trouble
Can anyone clarify something for me? I''ve been having a hard time with
write_attribute.
If I do (for instance in a callback):
write_attribute(:user, user)
Is obj.user_id set automatically too? And viceversa, if I do:
write_attribute(:user_id, user.id)
Does that set obj.user for me?
Doesn''t seem like it''s doing that for me.
Anyone understands exactly what
2008 Feb 22
2
ActiveRecord::DangerousAttributeError ???
Hi,
For some reason, this harmless block of code in my application
controller
def index
@wide = true
end
is causing this hideous error. I have read the error means that the
error is raised when attribute has a name reserved by ActiveRecord.
Does that mean that none of my models can have columns named "toggle"?
Here is the error and framework trace:
2006 May 11
0
acts_as_paranoid, aliasing and nested scopes in Rails 1.1
I have a real problem with the acts_as_paranoid plugin. The aliasing of
find and so the nested scope does not seem to work at all, when
combining it with similar plugins.
The description:
I made a copy of ''acts_as_paranoid'' in the plugin directory, renamed it
to ''acts_as_very_new''(just a nonsense plugin for testing), and
simplified the code (original code
2006 May 10
0
Saving extracted data
Hi there,
I have a file upload form on my page that is for images. In the model I have
this:
def file_data=(file_data)
@file_data = file_data
write_attribute ''extension'',
file_data.original_filename.split(''.'').last.downcase
write_attribute("content_type", file_data.content_type)
write_attribute("current_name",
2008 Jan 17
0
It seems to be a restful_authentication bug (was Re: Re: named route new_session not working)
On 1/16/08, Jimmy Palmer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> sorry for the ambiguity. I will work on being more descriptive. :)
>
> In the method access_denied in the file authenticated_system.rb from
> restful athentication, it generates this:
>
> def access_denied
> respond_to do |format|
> format.html do
>
2009 Sep 23
5
Overriding AR read/write_attribute - Overridden write_attribute Is Never Called
Could someone explain this?
#config/initializers/ar_attributes.rb
module ActiveRecord
module AttributeMethods
alias_method :ar_read_attribute, :read_attribute
def read_attribute(attr_name)
p "read_override"
ar_read_attribute(attr_name)
end
alias_method :ar_write_attribute, :write_attribute
def write_attribute(attr_name, value)
2006 Apr 24
0
ImageMagick and EXIF Data
Hi there,
I''m writing a little application that parses an image file and extracts the
camera settings from the file (the EXIF data) and saves all the fields to
the database. The idea is that after awhile people will be able to search
based on camera make, model, lens settings, etc... and all the pictures that
meet those requirements will be displayed. The picture is stored on the file
2008 Dec 11
2
restful_authentication errors
When I run
[code] script/generate authenticated user --include-activation [/
code]
it seems to work at first, but then it reports:
" The name ''SessionsHelper'' is either already used in your application
or reserved by Ruby on Rails. Please choose an alternative and run
this generator again "
I''ve heard that having both acts_as_authenticated and