• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ActiveRecord for CodeIgniter: Rails-style model interactions

I am about to start learning app dev with CI. I want to write codes easily. This looks promising. In wiki I also found " ActiveRecord Class Mod". Which one should I use with CI 1.6.3?

I have few questions with create, update etc.

1. Is it possible to show some specific fields of tables, rather than all fields?
2. Is it possible to validate fields and data inputs?
3. Can I use it with user auth systems to let registered users CURD their data etc?
4. How this ActiveRecord is different than CURD systems?


I think the 0.7 dev version of ActiveRecord Mod (scroll to the bottom of its wiki) is the only one that is actively developed. I'm currently using it with 1.6.3, and it works fine.

However, it is essentially an Object Mapper for SQL, so its not a silver bullet for form interaction and validation. You will still have to build your usual CI validation rules and such.

I've posted an addendum to a Validation extension that will let you hook validation callbacks into your ActiveRecord Mod models. You'll have to go to this version of Validation Callbacks into Models

Thanks beemr.

How do I implement some fields rather than all the fields of a table for create/edit/view forms? The wikipage of ActiveRecord Mod doesn't clears the matter.

Is there any sample app that using ActiveRecord?

ActiveRecord Mod doesn't let you manipulate forms. I think you must be thinking of the Scaffolding feature of CI.

ActiveRecord Mod helps you manage relationships between your data tables.


This class doesn't seem to work with Codeigniter 2.0.2. The first error given when autoloading is:

A PHP Error was encountered

Severity: Warning

Message: require(/Applications/MAMP/htdocs/CI/system//libraries/Model.php) [function.require]: failed to open stream: No such file or directory

Filename: libraries/Activerecord.php

Line Number: 9

And I guess it goes on form here. Any clues ?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.