Displaying 20 results from an estimated 300 matches similar to: "ActiveRecord return normal?"
2008 Dec 15
0
insecure: can't modify hash
A weird problem occurs (only on the prod server, not locally), when i
try to register a new user with restful_authentication.
Once in a while, i get the following error when trying to sign up as a
new user:
Insecure: can''t modify hash
usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:309:in
`delete''
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/
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:
2009 Feb 02
9
ActiveRecord Unexplainable SystemStackError - Only in WEBrick
This SystemStackError is driving me crazy. It only takes place when
testing with WEBrick - I can''t reproduce it with any tests. It is
caused by calling the "missing" id method (base.rb:2435) on my
ActiveRecord class.
WEBrick and my tests are running as the same user, with a `ulimit -s`
of 10240. Plus the query works sometimes so I don''t think this
matters.
2008 Jul 08
0
Bug with serialized columns in console ?
Hi,
I recently added 2 serialized columns in my class Server :
class Server < ActiveRecord::Base
serialize :visa, Hash
serialize :appli, Array
...
No problem in my controller and my application and everything works as
expected : Excel exports following the "visa" Hash or "appli" Array
are ok.
But since I added the visa Hash, I can''t load the record with
2013 Nov 18
1
wrong number of arguements (1 for 0) on ActiveRecord::Base#send
So I''m not exactly using Rails, but just ActiveRecord. Though I felt
this would be more appropriate in the Rails forum than the general Ruby
forum.
I''m working on an app that interacts with databases, without having a
database of its own.
I have a class called Modeller, and a Modeller#retrieve_model(name)
method that takes a name, looks for a table matching that name, creates
a
2008 Nov 19
3
Rails.cache and problem with model id?
I have the following:
MODEL:
def self.get_tag_cloud
Rails.cache.fetch(''fetish_tag_cloud'', :expires_in => 1.hour) do
find(:all, :conditions => [ "approved_for_tag_cloud = true"], :order
=> "LTRIM(name)")
end
end
CONTROLLER:
def index
@fetishes = Fetish.get_tag_cloud
end
VIEW:
....
<% @fetishes.each do |fetish| -%>
2010 Aug 22
7
Rails 3: Error saving an object with no useful information
Hey,
I''m kinda desperate cause I''m getting an error and have no idea how to
fix this since it doesn''t give me any information hinting where the
problem is:
irb(main):054:0> reload!;User.last.save!
Reloading...
NameError: undefined local variable or method `to_ary'' for
#<User:0x4ed5d20>
from
2008 Jun 07
2
rcov causing a segmentation fault on rspec 1.1.4 and rails 2.1
Hello again :)
I''m trying to run rcov on my specs here but i''m getting a lot of
segmentation faults (and they usually happen at different places):
/home/mauricio/NetBeansProjects/reeds/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:211:
[BUG] Segmentation fault ruby 1.8.6 (2007-09-24) [i486-linux]
2008 Jul 16
3
constructor in model
Hi all,
I have an activation model that when constructed should set the key
(column in the activations table) to test.
class Activation < ActiveRecord::Base
belongs_to :user
def initialize
this.key = "test"
end
end
When i do ac = Activation.new I gget
NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
2014 Feb 17
0
Need help -FATAL: database "catarse_development" does not exist
Hi
i try to run this
rake db:migrate
How i fix this
i get this
[root@localhost catarse]# rake db:migrate
/usr/local/rvm/gems/ruby-1.9.3-p484/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in
`block in require': iconv will be deprecated in the future, use
String#encode instead.
You no longer need to have jasmine.rake in your project, as
it is now automatically
2008 Mar 13
3
Refreshing a page gives a "stack level too deep" error.
I''m converting our app into restful rails. A couple of my classes
(Resource and Asset) have a has_many relationship with each other -
here''s the routes:
map.resources :assets, :has_many=>[:resources]
map.resources :resources, :has_many=>[:assets]
I''m getting something weird in my view pages. When i go to
/resources/4/assets
it works. I go to the page
2012 Feb 14
4
What I'm doing wrong, has_and_belong_to_many
Hello, I''m trying to insert into my migrate but when I try on rails
console this error shows:
1.9.3-p0 :001 > group = Group.new
=> #<Group id: nil, name: nil, description: nil, created_at: nil,
updated_at: nil>
1.9.3-p0 :002 > group.name = "Group Name"
=> "Group Name"
1.9.3-p0 :003 > group.description = "Description"
=>
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",
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
2011 Feb 05
3
ActiveModel::AttributeMethods limiting
In my attempt to add AM:Dirty to my model I realized that
AM#AttributeMethods is a bit imperfect. It''s impossible to generate
attribute methods step-by-step in DataMapper-like manner.
class Model
include ActiveModel::Dirty
def self.property(name, klass = String)
define_property_accessors(name, klass)
# This method will be called once, because of
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
2013 Oct 23
0
Error: allocator undefined for Proc
I had this problem all of a sudden, just changed some puppet classes in my
modules, but no particular stuff or no error in the catalog creation.
Env :
Puppet master version 3.2.0-rc1
Centos kernel 2.6.32-279.11.1.el6.x86_64
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Info: Caching catalog for jbossvdbmaster.prod.italy.cloudlabcsi.eu
Debug: Searched for resources in 0.01 seconds
Debug:
2008 Sep 17
0
permalink_fu and classes with different primary_key than id?
Has anyone else had problems with this scenario?
class Team < ActiveRecord::Base
# Primary key
self.primary_key = ''team_id''
has_many :players, :foreign_key => :team_id
has_permalink :city, :param => true
end
I am getting all kinds of trouble - that goes away if I comment out
the has_permalink declaration.
With PermalinkFu:
>> fs = Team.new
=>