Displaying 20 results from an estimated 12000 matches similar to: "how to put the model class in module?"
2010 Sep 17
6
Rails base model
I''m very new to Ruby and to Rails. I''m coming from PHP and CakePHP.
I would like to create a base model from which all other models will
inherit from.
I have done this:
class AppModel < ActiveRecord::Base
end
and
class Post < AppModel
end
I''m getting the following error:
Table ''blog_development.app_models'' doesn''t exist
My
2006 Mar 09
8
Problem with scaffolding and table name
Hello, i''m new in ruby rails framework. I have the following problem. I
try to create a scaffold
for a certain model of my db, but since ruby rails doesn''t assume the
table name corectly (its incidents_reported )
i get errors ....
Besides renaming the table :) is there a way to ''tell'' ruby rails the
name of the table?
I haven''t been able to find any
2009 Mar 18
1
set_table_name woes, fragmented domain class
Hi all,
I''m running Rails on top of a Mongrel cluster. I have several model
classes that are going to have so many records it is not feasible to
keep them all in the same table. So I''ve split out the records into
many different tables, each with its own suffix which corresponds to
the id of the model to which all records in that particular table
belong.
For example,
2006 Mar 18
9
How do I write this SQL the Rails way?
I''m trying to find all the unique bill_number, status records in Bills
table. I can do it with a find_by_sql statement like this:
@records = Bill.find_by_sql( "select distinct bill_number, status
from bills
group by bill_number, status;")
How would I rewrite it using ''find :all
2005 Sep 19
4
indicator value in labdsv
Hi,
I'm trying to find out what threshold of indicator value in labadsv should be
used to accept a specie as an indicator one? So far I assumed that indval=0.5
is high enough to avoid any mistakes but it was based only in my intuition.
I'd be greatful for any advise
best regards
Agnieszka
2006 Jan 30
3
Arrays of objects as parameters to webservices
I think I am missing something terribly obvious. Is it possible to have
an :expects parameter for a webservice that is an array of objects? I
want to have a single webservice that expects all my line items (for an
order). Is this something that is possible?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 11
2
AR class names
hello all, quick question: how can I find out if a given string matches the
name of an ActiveRecord derived class?
thanks in advance
alan
2006 Mar 23
11
ActiveRecord: Oracle metadata loading slow on large database
All,
While attempting to use ActiveRecord against a large database, approx.
1700 tables and 4 million rows, I discovered an inefficiency in
oci_adapter.rb. The problem seems to be the SQL being generated to
lazy-load the columns metadata. "def columns(table_name, name = nil)"
method generates the following SQL:
select column_name, data_type, data_default, nullable,
2006 Mar 31
2
Backslash Escaping in View
Ok, I''m hoping this won''t be a forehead slapper, but take a look at this code:
physician.name.sub(/''/, "\\''")
I''m trying to substitute a single quote with a backslash and a single
quote. This seems pretty simple right? Well, someone kick me and
tell me why it''s not :)
Here''s what I''m getting if the
2006 Jul 24
7
RoR + MySQL + Unicode
hello! I have a problem when I want to display data in Unicode from
database. I read <a
href="http://ruphus.com/blog/2005/06/23/getting-unicode-mysql-and-rails-to-cooperate/">this
tutorial</a> but I still have problem with non-English characters. I
don''t have any other idea what I should do. Did you meet with similat
problem? Have you got any idea? Thanks in
2006 Mar 24
2
Return all rows, split then show uniques
I''m returning some rows from a tags database that look like this:
ID WORDS
1. apple banana pear
2. banana melon
3. apple peach lime
What I want to do with that data is use the .split method to divide them
into separate values in an array, then use the .uniq method to return a
unique list of the words like so:
apple, banana, pear, melon, peach, lime
So in my controller I
2006 Apr 20
1
fit testing, FitNesse
Hello,
this is a typical "how do you do it in Rails" question :) I would like
to incorporate fit testing into a RoR app and I''d like to hear your
recommendations on how to do it. In the ideal world I would like all the
table test definitions and implementations stored in svn together with
the app, ability to run the tests with a rake task + a hook to FitNesse,
so that
2006 Feb 23
1
HABTM testing - fixtures not loading?
Hi,
I have a strange problem with testing classes which have a HABTM
relation. It seems that while running my tests with rake the fixture for
the association table is not loaded - as a result I get a failure on a
test which simply checks the number of associated elements - it says
it''s 0 although there should be one. The weird thing is that when I run
the tests with rcov
2005 Aug 08
2
INDVAL and mvpart
Hi,
I'd like to perform Dufrene-Legendre Indicator Species Analysis for
a multivariate regression tree. However I have problems with arguments
of duleg(veg,class,numitr=1000)function. How to obtain a vector of
numeric class memberships for samples, or a classification object
returned from mvpart?
thanks in advance
--
Best regards,
Agnieszka Strzelczak
2006 Jan 19
4
multiple database in the same actions?
Hi,
I read the example in
http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases,
it show us how to connect to other database, each time
we start a new action, however, this doesn''t work
while you try to connect to two different database
within the same action.
SO I wonder is it possible to bind to two or more
database within the same action????
Thanks you very much
Saiho
2006 Apr 19
8
Module and Model
I am getting the following error
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1129:in
`method_missing'': undefined method `directory?'' for Msg::File:Class
(NoMethodError)
I have a model called Msg::File in models/msg/file.rb, and I have a file
in lib/msg/helper.rb which references to both Msg::File and
File.directory?
How do I help activerecord
2006 Jul 22
3
Extend dynamically a model
Hello,
I''ve a model defined as
class Account < ActiveRecord::Base
end
This maps a mysql table Accounts. I want to be a able to dynamically
change this model. During the life of my app, the table Accounts may
change name, how do I do a set_table_name not within account.rb?
--
Posted via http://www.ruby-forum.com/.
2006 Mar 30
2
How do I format text before saving it?
I tried to use a before_save and use simple_format, it returns and
undefined method error. Can I even use these methods within a model? I
tried to use auto_link and it failed too. What am I doing wrong?
Furthermore, would it be recommended I format text before saving it to
the database? Advantages or disadvantages?
--
Posted via http://www.ruby-forum.com/.
2008 Apr 09
2
GLM fitting in R and Statistica
Hi,
I have a problem concerning discrepances between R (which I use) and
Statistica (which uses my supervisor). I can't say what is the origin
of these differences but unfortunately my supervisor doesn't know that
either.
Our response variable is number (or presence/absence) of parasites in
rodents and explanatory variables are presence/absence of several
alleles. The rodents were
2006 Mar 25
4
dynamic set_table_name for achives
How can I pass something to set_table_name so that I can switch tables
on the fly for accessing archive data?
If I could access sessions inside a model I would do something like:
if @session[:current_period]
set_table_name "statistics_" + @session[:archive_year]
else
set_table_name "statistics_" + Date.now.year
end
But since I cannot access the session from within a