Displaying 20 results from an estimated 1200 matches similar to: "abstract_class... what exactly does it do"
2006 Aug 24
0
Model with self.abstract_class=true allows save method call
I think this is a bug.
I declared a model with self.abstract_class = true and then tried to
call save on it and it attempted the save. I think this should raise a
"method not allowed" exception of some sort.
Where is the Trac system that I would use to report this?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You
2009 Aug 23
5
Upgrading to 2.3 from 2.1
Can be done in a one step process or do I have to upgrade to 2.2 then
2.3?
Thanks for the help.
--
Posted via http://www.ruby-forum.com/.
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
2011 Dec 03
1
ActiveRecord Abstract class
Hi, I was trying to create an abstract class and a subclass which
inherit that abstract class.
However, seems like I cannot instantiate the subclass too. Below is my
code:
//abstractclass2.rb
class Abstractclass2 < ActiveRecord::Base
self.abstract_class = true
end
//subclass.rb
class Subclass < Abstractclass2
end
When I test drive it in rails console, I got the following error:
2008 Feb 16
4
controller initializer function??
Hi, i''m a php developer and am used to developing using the zend
framework, recently i have discovered the wonders of rails, and have a
simple question:
In zend in your controller you can make a function called init() which
will always run for every action inside that controller, how can i
make an initializer function in a rails controller?
I''ve searched but havent found much
2007 Sep 15
3
check_box_tag always checked
#check_box and #check_box_tag are going to be the end of me. Why is
this always checked?
<% checked = @reservation.selected ? ''checked'' : nil %>
<td><%= check_box_tag("reservation[" + @reservation.id.to_s +
"][selected]", ''checked'', :checked => checked) %></td>
2008 Jul 05
5
Does RSpec work nicely with UUID primary keys?
I have my application happily generating UUID primary keys using the
uuidtools gem.
But the auto-generated specifications created by "script/generate
rspec_scaffold...", etc, assume that one is using a sequential integer
primary key.
For those who have hit this same issue, is it just a matter of rewriting
the auto-generated specifications to take this into account, or does one
have to
2009 Jul 21
1
[RAILS] - 2.3.3 creating a sea of red
hello,
I''ve already asked via Rails channels on this and have received no
response, so I''m asking here in hopes someone has run into something
similar.
I updated to rails 2.3.3 yesterday, and now all of my specs are
failing with the following error:
Fixture::FormatError in ''PublishedGallery Methods#thumbnail should
delegate to its lead asset''
a YAML error
2012 Jul 25
0
Rails3-default_scope throws exception: undefined method abstract_class? for Object:Class
I would like to apply logical delete in my application(Instead of
permanently deleting a record just have been marked as deleted). I have
Added *available* column to all tables with default value *true*. Now I
want common place to write the following code for all models.
1.
Write the instance method which make ''available'' column value false when user clicks on
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
2006 Apr 27
12
Stealing users IP address
Is there a functiaon to take the IP address of person who submits to a
form
example:
<input id="user_ip" name="user[ip]" type="hidden" value="<%=
some_ip_call %>" />
--
Posted via http://www.ruby-forum.com/.
2009 Jun 07
6
Missing Template when testing with the Brain Buster Captcha partial
When I run my functional tests, they throw an error with the following
message:
ActionView::TemplateError: Missing template /_captcha.erb in view path
app/views:test/vendor/plugins/brain_buster/views/brain_busters
On line #23 of app/views/contacts/_form.html.erb
20: <%= f.label :message %><br />
21: <%= f.text_area :message %>
22:
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
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
2006 May 27
2
[Repost] OpenID and my db schema
Hi,
I posted this before, but didn''t get an answer, so I''m trying again.
I''ve recently decided to use OpenID to let users log in to my site
instead of old fashioned account creation. They''ll be able to add a
small amount of personal details (about three things) to their
account, and post messages in the site BB. I have an openid_users
table which stores 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
2010 Dec 22
8
Shoulda issue: no more "should have_instance_methods" ?
I''m using Shoulda.
After copying the code here....
.... http://joshuaclayton.github.com/code/2009/07/14/should-act-as-list.html....
into my test_helper file so I can test acts_as_list, I came across
issues. For one I realized I had to get rid of the _ between the
"should" and "have" in past cases, but here, I get this error when I
run my unit test:
2008 Jan 10
21
Shoulda
Hey, we''re currently using shoulda (http://dev.thoughtbot.com/
shoulda/) on a project and I saw some things that would be really nice
to see in rspec, namely the should_ methods, and especially the
should_be_restful method. Do these go against the rspec goals at
all? Or could an ambitious programmer go to town implementing these
for rspec_on_rails?
Nathan Sutton
fowlduck at
2006 May 24
4
AR foreign key problem.
Hello Railslist,
(I''m using RadRails 0.6.3 on Windows XP with Ruby 1.8.4, Rails 1.1 and SQLite3)
I have two tables in the database: "locations" and "customers":
customers.sql
---
id INT PRIMARY KEY
name VARCHAR 255
address VARCHAR 255
postal_code VARCHAR 255
city VARCHAR 255
---
locations.sql
---
id INT PRIMARY KEY
postal_code TEXT
longitude FLOAT
latitude FLOAT
2006 May 24
5
rxml vs rhtml
I have been wondering if anyone here knows which format is faster for
your templates? I am curious cause in the near future I may be using
some expensive scripts (timewise) and would like to try and squeak out
as much performance as possible. Is Ruby like other languages (ASP
classic for example) that inccur a penalty by switching between HTML and
Ruby Code?
Ben
--
Posted via