Displaying 20 results from an estimated 600 matches similar to: "Rails base model"
2006 Mar 23
4
how to put the model class in module?
I meet a strange problem. I have a table name is application. So I have
to use Application as the model class name. But it reports error. If I
put the model class into my special module and require the file in
controller, it works. But I find that all predefined methods in Active
Record are no longer effective, such as validate and so on.
Can you please give me some idea on this problem? Thanks .
2010 Jan 26
6
Subclassing ActiveRecord::Base
First of all, sorry for the crossposting, but I put this into the Ruby
Forum first of all, but was pointed to this as a more appropriate
location.
I''m using ActiveRecord and ActiveSupport in a non-rails environment
to connect to multiple databases, and I''ve found the following (single
database) to cause me an error. Note that params is my database settings
and omitted for
2006 Jul 26
4
Execute code when an inheritance happens, or disabling STI
I am trying to inherit from a ActiveRecord class defined in a plugin.
The problem is that ActiveRecord thinks I am doing an STI and is looking
up a table that doesn''t exist.
Currently, I have a method in the parent class that looks like this:
def self.fix_table_name
class_eval do
set_table_name(Inflector.tableize(self.to_s))
end
end
The problem is that this method
2009 Mar 17
11
Refactoring module
Dear all
Please see the following module, In module SX3 SX4 and SX5 have similar
class Tasklist, but inherit from different class.
I will use the following code to connect to different data sources
RemoteSX3Model.establish_connection sx3_hash
RemoteSX4Model.establish_connection sx4_hash
RemoteSX5Model.establish_connection sx5_hash
How can I refactor my code in module to look simpler? Thank you
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2006 Jun 11
47
Ruby on Rails and CakePHP Comparison
>From a development standpoint, what are the features that make Ruby on
Rails a better choice compared to CakePHP?
--
Posted via http://www.ruby-forum.com/.
2006 May 08
4
Tables names with model classes in seperate modules
I have a module that deals with content pages and categories in my
application so create following tables:
content_pages
content_categories
Obviously I need a Page and Category module to map to these tables, but
in order to avoid conflicts with other Category classes, i declare my
model classes like this:
Content::Page
Content::Category
Now, that''s all fine - except that my models
2007 Oct 12
6
abstract_class... what exactly does it do
Hi,
Does anyone know much about abstract_class? Does it actually prevent
instances of the class from being created? Does it disable certain
methods? I already know what it''s for, but I want to know what setting
self.abstract_class=true actually does.
The reason I ask is that I want to use it for a slightly unorthodox
purpose. I want a class who''s only attributes are its
2007 Feb 13
1
cakePHP Programmierer gesucht
Für die Entwicklung einer Online Community suchen wir einen erfahrenen
cakePHP Programmierer in Heimarbeit und Vollzeit.
- fundierte cakePHP Kenntnisse.
- svn Routine.
- zeitlich ab sofort verfügbar.
- 2-3 Monate, ggf. länger.
- Kurz-Bewerbung per E-Mail.
- Bezahlung wahlweise pauschal nach Milestones oder Stundensatz.
Bitte senden Sie uns einen Link auf eine Demo Page Ihrer bisherigen
Arbeit,
2006 Jul 04
8
writing to many_to_many table
I have three tables. users, posts, users_posts. This last one is to
mark a post as read.
How do I write to the users_post table?
Here''s what I have:
In model ''User_Post''
belongs_to :post
belongs_to :user
In post/view/show:
<%= link_to "Mark As Read", :controller => ''post'', :action =>
''post_read'',
:user =>
2007 Jan 31
2
rspec + CakePHP
Hi,
I am in a situation where I am going to have to rewrite a working Ruby
on Rails application in CakePHP with PHP5. I have a whole bunch of
specs written with rspec, and I was wondering if it would be possible
to somehow use these specs to test the Models and Controllers that I
am rewriting in CakePHP. I am going to be basically just exactly
duplicating the Rails application, with identical
2006 Jul 12
10
Rails: Good for everything?
My department is in a battle right now. We have some very por PHP
people and very pro Rails people. The php guys make a good argument
that Rails is good for new applications where we dictate the DB schema.
PHP shines where we go into an existing application, or a new one where
multiple databases or possibly legacy systems are involved. The PHP
guys basically say Rails is good for Web 2.0
2010 Aug 21
4
No route matches?
Hi all,
I''m coming from the PHP world and I''m trying to learn Ruby and Rails.
I''m having a problem where I keep getting the error "No route matches /
home/view" even though I have it defined it. I''d appreciate any help
on this. I''m using rails 3.0 and the setting for the environment is
"development".
# routes.rb
2008 Dec 09
7
subclassing vs mixins, which one should be used?
Hey all,
I have two models in my rails project that share a lot of traits. They
each have the same 4 properties, and now I need to add 2-3 methods to
each one that will be the same. In the spirit of DRY I am looking for
a solution to write these methods only once.
Both of these models already inherit from ActiveRecord . . . and I
didn''t know if it was safe to just "whip up" a
2007 Jul 02
3
list box poupulation using php,mysql and ptototype
I have some problems with php and Prototype.I am trying to implement
listbox population (second dropdown box values depend on first
dropdown) using php,Mysql and Prototype.But i have no idea how to
implement . I hope you all have sucessfully done this, please show me
an example
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
2006 Mar 28
12
cached-model broken with Rails 1.1
It looks like cached-model is broken again under rails 1.1. Can anyone
confirm? Note that the exception below indicates it''s trying to treat
CachedModel as the class name of the model, rather than using the proper
class name (which is Entry in this case, and the table called entries).
This is a model using Single Table Inheritance and acts_as_tree, and
worked just fine under 1.0 and
2015 Jul 17
1
CakePHP in CentOS7
Hello everyone,
is there anyone who got CakePHP running in his CentOS7 machine?
I did it like the installation guide on cakephp.org says but I ran into file permission problems for error.log and cache configuration errors. The skeleton application is not running.
Regards
Tim
2007 Sep 29
8
Inheritance problem in model
Hello,
I''ve got a problem with the inheritance as soon as I try to use it in a
model.
I''ve got plenty of items which can share a lot of code, so I created a
class "Item", which inherits from ActiveRecord::Base, but because it''s
not a "real item" but an interface, I set it abstract (writing
abstract_class? method).
Then I have all the differents
2007 May 03
2
How to run a cpu intensive ruby script with rails functionality
Hi All,
I am new to this list and to rails. So far I am loving the way in
which it is easy to put together web pages with a database backend.
I would love to use the rails functionality (to do the sql queries)
and then process the results using some very cpu intensuve tasks. The
results will take far longer than it is viable to use a web browser to
view the results. I would like to see the
2009 Mar 14
9
null object pattern
I am trying to create a null object in my application. I would like to
assigned a null user object for anonymous/ mot-logged-in user, i.e. if
session variable has nil data.
In my User model, I have created a subclass like this:
class UnassignedUser < User
def save
false
end
def update
false
end
def username
"Unassigned"
end
def county_id