Displaying 20 results from an estimated 153 matches for "activemodel".
2010 Aug 13
2
Rails 3 / ActiveModel for Credit Card information?
...works correctly.
With Active Model it seems logical to create a CreditCard class to
hold this data instead.
**1st issue.**
It seems there still isn''t support for handling the form date_select.
(the card_expires_on(*) parameters). Should this work? Perhaps I''m
just missing an ActiveModel module
**2nd issue.**
In a perfect world this CreditCard class would be on the same form as
an ActiveRecord Order class but I have not been able to get an
ActiveModel to work as a nested object on a form.
something like this.. on the order new form
<%= form_for @order do |f| -%>
. order...
2012 Sep 25
3
Proposal for a new ActiveModel::Errors structure
There are few issues with the current ActiveModel::Errors class.
Firstly, when an error is added to ActiveModel::Errors class via #add
method
(https://github.com/rails/rails/blob/master/activemodel/lib/active_model/errors.rb#L294)
its translation is added. It should not be translated when being added, but
only when being read.
The second iss...
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...
2012 Feb 16
0
Upgrading from 3.2.0 to 3.2.1: Wrong Number of Arguments
...troller is:
user = User.find_by_email(params[:email])
What''s going on here? Here''s the diff in the Gemfile.lock after making
the upgrade:
- actionmailer (3.2.0)
- actionpack (= 3.2.0)
+ actionmailer (3.2.1)
+ actionpack (= 3.2.1)
- actionpack (3.2.0)
- activemodel (= 3.2.0)
- activesupport (= 3.2.0)
+ actionpack (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
- journey (~> 1.0.0)
+ journey (~> 1.0.1)
- activemodel (3.2.0)
- activesupport (= 3.2.0)
+ activemodel (3.2.1)
+ activesupport (= 3.2.1)
-...
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 activerecord model. I launch the console and
try to invoke singular_route_key, and it gives me undefined method:
1.9.2p290 :004 > @user.class.model_name.class
=> ActiveModel::Name
1.9.2p290...
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
https://github.com/rails/rails/blob/master/activemodel/lib/active_model/attribute_methods.rb#L263
define_attribute_methods([name])
en...
2012 Jun 21
1
ActiveModel::Serializers::JSON support arbitrary keys
...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 ActiveModel::Serializers::JSON
def attributes
{label: name, value: id}
end
While I can easily create a method for all the keys I want to create, take
the example above, where a jquery plugin requires a data structure of
"value: id, label: string". Does it really make sense to create a value a...
2013 Jan 08
3
[SEC] Rails 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released!
...orted these security issues.
Here are the SHA-1 checksums for each gem:
### 3.2.11
```
[aaron@higgins dist]$ shasum *3.2.11*
933cd2821b30cdff4a2e0b5cc63f4d2c6b29affe actionmailer-3.2.11.gem
54731c51b55bf0215392971b982139775c0bfa2b actionpack-3.2.11.gem
5ccde66568d8051405c01063f1afaed13bd01082 activemodel-3.2.11.gem
f360c17968486479b0a4207e7eccbe379186a9d2 activerecord-3.2.11.gem
c61ff513be8a8aef898d2e5c4c9508d60727c556 activeresource-3.2.11.gem
41a4e8c382594283026d977554c1e18233198ca8 activesupport-3.2.11.gem
8fa6d19a0daea910e39a0911b2240c2a7b630fb1 rails-3.2.11.gem
ffaec7c3e5211283108cf5afab8e...
2013 Jan 08
3
[SEC] Rails 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released!
...orted these security issues.
Here are the SHA-1 checksums for each gem:
### 3.2.11
```
[aaron@higgins dist]$ shasum *3.2.11*
933cd2821b30cdff4a2e0b5cc63f4d2c6b29affe actionmailer-3.2.11.gem
54731c51b55bf0215392971b982139775c0bfa2b actionpack-3.2.11.gem
5ccde66568d8051405c01063f1afaed13bd01082 activemodel-3.2.11.gem
f360c17968486479b0a4207e7eccbe379186a9d2 activerecord-3.2.11.gem
c61ff513be8a8aef898d2e5c4c9508d60727c556 activeresource-3.2.11.gem
41a4e8c382594283026d977554c1e18233198ca8 activesupport-3.2.11.gem
8fa6d19a0daea910e39a0911b2240c2a7b630fb1 rails-3.2.11.gem
ffaec7c3e5211283108cf5afab8e...
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 appreciated.
Thanks,
James
--
You received this message because you are subscribed to...
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 received this message because y...
2011 May 19
0
NoMethodError (undefined method `serializable_record' for #<ActiveModel
...map{|c| ActiveRecord::Base::Serializer.new(c).serializable_record
-----------------------------------------------------------------------
But am getting below error
------------------------------------------------------------
NoMethodError (undefined method `serializable_record'' for
#<ActiveModel::Serializers::Xml::Serializer:0xa3e2a10>):
------------------------------------------------------------
Can anybody help me
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post t...
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 do :|
--
Posted via http://www.ruby-forum.com/.
--
You received this...
2006 Jun 18
4
share an hash ..
Hello,
How to share an Hash between all objects (model, controller ect ...)
=> I did a static Hash in my model where a static method fill it
basically, this is the code
class Person < ActiveModel
@@anHash.new
def Person.anHelperMethod(aKey)
if anHash.size==0
... load the hash, some SQL to fill the Hash
end
return anHash[aKey]
end
=> The problem,: it always reload the Hash ! as it was a local variable
.... I don''t understand since it has the good behavior...
2010 May 27
1
Question on Rails 3 : forms && ORM && ActiveModel
...se
validation rules straight from models, so you have DRY.
Looking at Rails tutorials I can''t find this decoupling. Validation
rules are placed straight into models ... like
"validates_confirmation_of :password".
So I was wondering about Rails3 ... seeing there''s a new ActiveModel
abstraction of the ActiveRecord interface, can I use that to have the
desired effect?
Also, where can I find some good and up to date tutorials on Rails3 ?
2) ORM lazyness
I like that Django''s ORM and in DBIx::Class, the resultsets
constructed are lazy. I see that in Rails 3 there'&...
2013 Feb 08
1
Problem with many to many relationship
Hi
I''m trying to create a many to many relationship between two models.
A User can be associated with many Incidents and vice versa.
class User < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
has_many :incident_participants, foreign_key: "participant_id"
has_many :participated_incidents, through: :incident_participants
end
class Incident < ActiveRecord::Base
include ActiveModel::ForbiddenAttributesProtection
has_many :incident_par...
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 fals...
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 Mar 29
18
Rails 3.0.6.rc1
ZOMG HAPPY TUESDAY (UTC-7)!!! <3<3<3<3<3
I am happy to announce that the first release candidate for Rails 3.0.6 has
been pushed to rubygems.org.
## Release Candidate: What does it mean?
The release candidate is very similar to what we will actually release for
version 3.0.6. The reason that we release an RC is so that the community can
have a chance to postpone or veto commits
2010 Sep 17
0
Key Value Json ActiveModel::Errors
Hi all,
I''m using Rails 3.0, and I have a model which validates if the
attribute :name is present. On my my views, I use Jquery to submit the
form which creates the model. If the name is not present, Rails
returns something like this Json:
[''Name is a required value'']
Is there a way to make it return something like this?
[''name'': ''Name is a