Commit Graph

54 Commits

Author SHA1 Message Date
Petrik
c477d95604 Introduce ActiveModel::API
Currently `ActiveModel::Model` is defined as the minimum API to talk
with Action Pack and Action View.
Its name suggests it can be included to create Active Record type
models, but for creating models it's probably too minimal. For example
it's very common to include ActiveModel::Attributes as well.

By moving `ActiveModel::Model`'s implementation to a new
`ActiveModel::API` we keep a definition of the minimum API to talk with
Action Pack and Action View.

For `ActiveModel::Model` we only need to include `ActiveModel::API`.
This will allow adding more funcationality to `ActiveModel::Model` while
keeping backwards compatibility.

Co-authored-by: Nathaniel Watts <1141717+thewatts@users.noreply.github.com>
2021-09-15 18:24:47 +02:00
Rafael Mendonça França
077c66d5d6
Rename master to main in all code references 2021-01-19 20:46:33 +00:00
Ryuta Kamizono
c65864cdca Prefer no allocation start/end_with? over String#[] == 2020-05-29 10:20:13 +09:00
Abhay Nikam
bdfffd1355 Update the Rails mailing list URLs to new discuss discourse URL [ci skip] 2020-04-02 22:00:28 +05:30
Kasper Timm Hansen
0fc1397784
Merge pull request #35559 from ashishprajapati/ashishprajapati/important_textual_improvements
Added missing guide links in documentation and minor wording fix
2019-03-09 22:54:21 +01:00
ashishprajapati
e3ef12b310 Added missing guide links in README documentation and minor wording fix [ci skip] 2019-03-10 03:17:01 +05:30
Abhay Nikam
476abd403b Updated links from http to https in guides, docs, etc 2019-03-09 16:43:47 +05:30
Fatos Morina
37cf9b3466 Fix typos and add a few suggestions 2017-11-28 19:27:43 +01:00
Yoshiyuki Hirano
3a11e0586e Update MIT licenses link [ci skip] 2017-08-22 08:46:02 +09:00
Elektron1c97
6bd417df50 [ci skip] Add a dollar sign to each command in the READMEs
According to pr #22443 in the guides there's always a dollar sign before every command, so why is in the main README a `$` and in every submodule a `%`?

Just eye candy..
2015-12-06 19:18:52 +01:00
Zachary Scott
f7ebdb1ac5 Remove XML Serialization from core.
This includes the following classes:

- ActiveModel::Serializers::Xml
- ActiveRecord::Serialization::XmlSerializer
2015-08-07 11:01:48 -04:00
Julio Lopez
a18b24f71f marking serialization class 2015-07-07 21:58:22 -05:00
claudiob
0080a886b2 [ci skip] Don’t encourage sudo gem install
I think we are better off leaving `sudo` outside of the documented
way of installing gems (`activerecord`, `actionpack`, …).

We don’t want newbies to think that `sudo` is required or, even worse, than
they actually have to type `[sudo] gem install`.

In most scenarios, `sudo` is not needed to install gems, and people who do
need it, probably already know about it.

What do you think? 😁
2015-05-12 14:51:19 -07:00
Rafael Mendonça França
f55bfe7260 Change the deprecation messages to show the preferred way to work with
ActiveModel::Errors
2015-02-20 20:58:58 -02:00
yuuji.yaginuma
66e2e19bc0 use messages instead of deprecated ActiveModel::Errors#[]= method [ci skip] 2015-02-20 23:53:36 +09:00
Zachary Scott
4c66ab2b21 Feature requests should be made on the mailing list, not submitted to
the issue tracker. See also #15455 [ci skip]
2014-06-01 19:11:39 -07:00
ShunsukeAida
33cc907305 Name#model_name doesn't return a String object 2014-05-30 00:09:41 +09:00
Peter Markou
f6ab778297 Fix errors for four of the code samples
The four code samples that fail to run are:

- Add attribute magic to objects. Fixed by introducing a Person
  instance variable.

- Tracking value changes. Fixed by replacing `attr_accessor` with
  `define_attribute_methods`, providing getter and setter methods
  for `name` and providing the missing `Person#save` method. A
  call to `Person#save` has to precede the `person.name = 'robert'`
  assignment, if we want `previous_changes` to include 'bob'.

- Adding `errors` interface to objects. Fixed by introducing a
  Person instance variable, assigning `nil` to its name and calling
  `Person#validate!`.

- Custom validators. Fixed by defining `HasNameValidator` before
  it is used by `ValidatorPerson`.

All the code samples can now be run smoothly.

Call Dirty#changes_applied in Person#save, instead of modifying instance vars.
2014-03-08 21:19:42 +02:00
T.J. Schuck
72bb3fc297 Change all "can not"s to the correct "cannot". 2014-01-03 17:02:31 -05:00
Yves Senn
068289f239 align the result of expressions vertically [ci skip]. 2013-04-12 17:22:39 +02:00
Waynn Lue
008fd54e74 clarify verbiage 2013-03-12 18:44:10 -07:00
Trung Lê
86c4fe8191 ActiveRecord <-> Active Record [ci skip] 2013-01-15 10:52:02 +00:00
Akira Matsuda
7f495993bb Observers was extracted from Active Model as rails-observers gem 2013-01-02 06:23:12 +09:00
Hrvoje Šimić
aee07fe135 include serializers in ActiveModel::Serialization example 2012-10-19 17:24:34 +02:00
Hrvoje Šimić
2d2c82354f better examples in ActiveModel readme 2012-10-19 16:58:30 +02:00
Robin Dupret
f839e619d4 Use a 1.9 Hash syntax in README files (fixes thanks to @vijaydev) 2012-10-10 15:14:03 +02:00
Francesco Rodriguez
00c94d7d94 updating define_attribute_methods documentation 2012-05-14 11:38:23 -05:00
Vijay Dev
700dd0014b Revert "fixing active model links in readme"
This reverts commit c962680e1902d2c9474f0be8ba7b0b8ab361cae6.

Reason: The links must be relative to work in both edge and stable api
sites.
2012-05-07 20:43:04 +05:30
Francesco Rodriguez
ae0a4ca2e1 removing the surrounding +s in active model readme 2012-05-07 09:49:54 -05:00
Francesco Rodriguez
204a79fe61 fixing marked actived model classes in readme 2012-05-07 00:48:19 -05:00
Francesco Rodriguez
79f1daf2ce marking some active model classes 2012-05-07 00:45:54 -05:00
Francesco Rodriguez
c962680e19 fixing active model links in readme 2012-05-07 00:40:00 -05:00
Francesco Rodriguez
9f3637fad5 adding observer example 2012-05-07 00:33:26 -05:00
Alexey Vakhov
616de66c55 Fix ActiveModel README example 2012-05-04 12:32:35 +04:00
Bernard Kroes
be4a44f1f9 Fixed expected value in comment. Removed duplicate lines in example. 2012-04-21 22:16:38 +02:00
Vijay Dev
02a5847d32 fix bad format [ci skip] 2012-04-11 22:37:17 +05:30
Jonathan Mazin
729890469d Fix small markup error; fix incorrect link 2012-04-09 15:41:50 -03:00
Vijay Dev
c0a7999115 minor corrections in AMo::Model docs [ci skip] 2012-03-05 22:46:44 +05:30
Carlos Antonio da Silva
cb9d03f0d4 Add docs with usage examples for ActiveModel::Model
Also add test to ensure basic model does not explode when
initialized with nil.
2012-03-03 04:45:30 -03:00
Vijay Dev
e6c98b83cb Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activerecord/lib/active_record/relation/query_methods.rb
2012-02-09 23:44:17 +05:30
Carlos Antonio da Silva
9296996029 Fixes in AMo README 2012-02-07 20:29:14 -02:00
José Valim
91bb008c0b Update README to mention lint. 2012-02-07 23:17:24 +01:00
Kristian Freeman
2315e96a17 Finished implementation of MIT license linking. 2011-12-23 13:03:21 -08:00
Waynn Lue
2579d88405 capitalize RubyGems properl 2011-08-13 16:22:31 -07:00
Rashmi Yadav
111347f0cc The trailing '/' isn't being picked up by Github anyway, and the link works as is. 2011-08-13 16:22:15 -07:00
Vishnu Atrai
5801f42975 fixed type 2011-07-21 10:12:29 -07:00
Bratish Goswami
840ca47a46 Download and installation, License and Support sections added for activemodel 2011-07-21 13:03:45 +05:30
R.T. Lechow
86c15d8b89 Active Model typos. 2011-03-05 11:56:34 +01:00
John Firebaugh
57bc25c5f8 Use run_callbacks; the generated _run_<name>_callbacks method is not a public interface.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-01-31 19:45:53 -02:00
Vijay Dev
4038a6bc0f minor fixesin READMEs 2010-12-20 01:07:33 +05:30