Displaying 20 results from an estimated 700 matches similar to: "Proposal for a new ActiveModel::Errors structure"
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
2011 Feb 03
5
Ignore attr_accessible in seed file
Is there a way to tell Rails to ignore attr_accessible when seeding the
database and to allow mass assignment with create or new?
I know how to skip validations but do not find anything on mass
assignment...
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2011 Jun 11
15
after initialize blowing up---help
All,
Can anyone see what''s happening here?
================== migration =======================
class CreateGreetings < ActiveRecord::Migration
def self.up
create_table :greetings do |t|
t.string :greet
t.string :language
t.integer :count
t.timestamps
end
end
def self.down
drop_table :greetings
end
end
================== greeting.rb
2011 Jan 06
4
Not able to insert value in rails console
I am using authlogic for authentication in rails 3.0.3 with ruby 1.9.2
Using activerecord-sqlserver-adapter (3.0.5)
windows with sqlserver database
when i create user details in rails console, i am getting below error,
>User.create(:login=>''test'',:password=>''test123'',:password_confirmation=>''test123'')
2010 Jul 28
3
Rails 3.0.0.rc // rails locales prevent app boot
Hi all,
I got the following error message when booting up my app (which works
fine with Rails 3.0.0.beta4) in Rails 3.0.0.rc;
activesupport-3.0.0.rc/lib/active_support/file_update_checker.rb:27:in
`stat'': can''t convert Array into String (TypeError)
When I put some debug code on that line I see the follwing array being
passed;
2010 Aug 13
2
Rails 3 / ActiveModel for Credit Card information?
When submitting billing information in the past I''ve always used
attr_accessor for credit card details as they should not be saved in
the database. In addition I always end up storing the card
expiration date so that the date form helper works correctly.
With Active Model it seems logical to create a CreditCard class to
hold this data instead.
**1st issue.**
It seems there still
2010 Feb 20
23
Rails 3 possible bug in Routing
Hi, I just ran into this ActionController::RoutingError and just
wanted to check if someone can confirm this as a bug in the Rails 3
beta gem.
config/routes.rb contains:
get ''login'' => ''session#new''
post ''login'' => ''session#create'', :as => :login
GET /login works fine:
Started GET
2012 Aug 05
0
ActiveRecord::Validator vs ActiveModel::Validator
I know that there is an ActiveModel Validator class
https://github.com/rails/rails/blob/master/activemodel/lib/active_model/validator.rb
which is used for the class level validation macros.
But I didn''t find a an ActiveRecord Validator class.
From my understanding in Rails 3, validations have been moved into
ActiveModel to leave ActiveRecord as an ORM.
So now I see this Rails 3 code
2013 Jul 21
4
how to use activemodel collection.build for a has_many :through association
Hi all,
In my controller I am doing the following to populate a nested form for a
has_many through association:
def new
@specification = Specification.new
Component.find_each.each do |component|
@specification.component_specifications.build(:component_id =>
component.id)
end
The idea being whenever someone creates or edits a form, it will be
populated with all
2013 Jan 20
6
preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr
Greetings,
I''m getting this - ActiveModel::MissingAttributeError: missing
attribute: some_attr - on a random basis under a unicorn server,
running rails 3.2 and ruby 1.9.3
As the case of the last poster in the following thread -
https://github.com/rails/rails/issues/1906 - I too am able to resolve
this issue by settingpreload_app to false.
However, this is not the behaviour I want to
2012 Jun 21
1
ActiveModel::Serializers::JSON support arbitrary keys
Is there a reason why AM:S doesn''t support arbitrary keys to serialization?
I can see a lot of uses cases where arbitrary keys could come handy. Right
now, if one tries to do it, AM:S checks if the keys match a method of the
model and raises exception if it can''t find any.
class Client < ActiveRecordBase
attr_accessible :name, :address, as: :creator
include
2010 Jul 12
2
[R3B4] errors[:base] = appends, doesn't "set" - bug, feature, or "error 18"?
If you haven''t heard, an "error 18" means "the error is 18 inches from
the screen." Which would mean that I totally get that this could just
be me being stupid.
However, for some reason I''m thinking this violates the normal
behavior of an Array object, so I''m curious as to if I''m doing
something wrong here, or if something really is buggy
2010 May 27
1
Question on Rails 3 : forms && ORM && ActiveModel
I''m a Django/Catalyst user that''s evaluating Rails ... I need a Ruby
framework, and I''m trying to see if learning Rails is worth it or I
should just go for Sinatra + various libs available.
Django has a couple of things I like ...
1) the Forms API
In Django I like that it''s being decoupled from models ... form
objects have fields with validation rules that
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
2012 Sep 03
0
undefined method `singular_route_key' for "User":ActiveModel::Name
In ActionDispatch::PolymorphicRoutes, there is a call to
build_named_route_call an on line 172 (of latest rails code from
github), there is a call to singular_route_key:
model_name_from_record_or_class(parent).singular_route_key
Now model_name_from_record_or_class returns an ActiveModel::Name
object, which is a wrapper to the string class, that returns a string
name of the class of an
2011 May 19
0
NoMethodError (undefined method `serializable_record' for #<ActiveModel
Hi ,
Am using rails 3 .I have added code in my controller
-----------------------------------------------------------------------
la.map{|c| ActiveRecord::Base::Serializer.new(c).serializable_record
-----------------------------------------------------------------------
But am getting below error
------------------------------------------------------------
NoMethodError (undefined method
2010 Apr 09
0
[PATCH] add :root option to ActiveModel JSON serialization
This is a small, straightforward patch that I''d love to see merged:
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4358-patch-add-root-option-to-activemodel-json-serialization
It''s all pretty self-explanatory, it basically just ports a useful
option from to_xml to to_json, making their interfaces more compatible
with each other. Feedback would be greatly
2012 Jul 08
0
ActiveModel::ValueObject
Hi guys
Seeing `composed_of` removed I put together a quick proof-of-concept
ValueObject implementation on top of ActiveModel and ActiveRecord
`serialize`.
https://gist.github.com/3070184
Features:
- VO''s are immutable
- VO''s are identified by their attributes
- VO''s can be conveniently created from hashes (with a little extra work)
What do you think?
--
You
2011 Aug 20
2
[Linux] Error installing rails "activemodel requires activesupport"?
Well, I''m trying to install Rails through gems in a Linux box `sudo gem
i rails --pre` I''m getting this:
ERROR: Error installing rails:
activemodel requires activesupport (= 3.1.0.rc6, runtime)
Which is funny, because when I check `gem list` I get
activesupport (3.1.0.rc6)
bcrypt-ruby (2.1.4)
builder (3.0.0)
i18n (0.6.0)
multi_json (1.0.3)
I don''t know what to
2010 Nov 06
0
ActiveModel: undefined method `attributes`
Trying to setup a tableless model, and serialize it to XML, but am
getting:
NameError: undefined local variable or method `attributes''
anyone know what I need to get the attributes method defined?
thanks!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to