similar to: Subclassing ActiveRecord::Base

Displaying 20 results from an estimated 3000 matches similar to: "Subclassing ActiveRecord::Base"

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
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 25
5
Routing and extensions.
I would like my something like "my_page.html" to map to :controller => ''page'', :action => ''my_page''. How can I accomplish that? Is there a way to make the routing parse other things other than ''/''? -- Posted via http://www.ruby-forum.com/.
2010 Mar 10
1
Importing Access 2007 data with ROBC
Hi all, I'm trying to import Microsoft Access data into R. It looks like I'm supposed to use the ROBC package, and this works fine with old Access files (those with an .mdb extension). However, lovely Microsoft must constantly update their software. Modern Access files have an .ACCDB extension. I cannot seem to coerce R to import data from such a file. Any advice? I've been using
2002 Oct 16
5
Database newbee problem...
Hi all, This is a potentially very stupid question about MySQL <-> R interaction, but I have not been able to solve it. I'm just trying to connect R to my MySQL databse, and gets this: > library(RMySQL) Loading required package: methods > m <- dbDriver("MySQL") > con <- dbConnect(m,group="testdb") Process R segmentation fault at Wed Oct 16 07:04:30
2006 Jun 18
1
Problem using "rake db:migrate"
Hi all, I am facing a problem while using rails "migrate" feature for creating tables in a database. Following are the details. I have 2 applications say "app1" & "app2". I want both of them to use same database say "testdb". For "app1", I create 3 models which in turn create 3 migration files with prefix, 001_, 002_ & 003_. Now I
2011 Jul 14
1
SQldf with sqlite and H2
SQldf with sqlite and H2 I have a large csv file (about 2GB) and wanted to import the file into R and do some filtering and analysis. Came across sqldf ( a great idea and product) and was trying to play around to see what would be the best method of doing this. csv file is comma delimited with some columns having comma inside the quoation like this "John, Doe". I tried this first
2007 May 31
2
Import data from Access
Hi, I want to import some data from Access and I am using the following codes: testdb <- file.path("c/../db1") channel <- odbcConnect("testdb") sqlFetch(channel,"tbl",colnames = TRUE, rownames = FALSE) It comes out the error message: 1: [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver Manager] Data source name not found and no default
2005 May 02
2
RMySQL query: why result takes so much memory in R ?
Hi I just started with RMySQL. I have a database with roughly 12 millions rows/records and 8 columns/fields. From all 12 millions of records I want to import 3 fields only. The fields are specified as:id int(11), group char(15), measurement float(4,2). Why does this take > 1G RAM? I run R on suse linux, with 1G RAM and with the code below it even fills the whole 1G of swap. I just
2010 Mar 18
1
Imported tables from Access 2007
Hi all, I am very new to R and I'm trying to import data from Microsoft Access. So far, I've managed to do so successfully using the following code: testdb <- file.path("c:\Databse.accdb") channel2 <- odbcConnectAccess2007(testdb) data.table <- sqlFetch(channel2,"data") This successfully imports a table(?) called "data.table". But when I try to
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 Jun 02
3
Custom Pagination Links
Hi, I''m using the code below to display some pagination links. It works great apart from when there''s no paging i.e. the full collection is displayed, when it still display a "1" to represent the current page. How can I suppress that? Thanks! <div class="pager"> <%= link_to(''&lt; Prev'', {:params =>
2010 Sep 26
2
Asterisk ODBC Insert issue
Hi guys, Having issues with doing an insert statement using ast 1.4.24: [START] dsn=mssql-asterisk write=INSERT INTO testdb (callarrival,callerid) VALUES ('${VAL1}','${VAL2}') SET(ODBC_START()${TIMESTAMP},${CALLERID(num)}) No errors pop up on execute, but nothing gets inserted. Read and update work fine, Wondering where I'm going off track with this, Thanks,
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
2003 Aug 25
1
ODBC access
Hello everybody, I have tried to connect to external databases (specifically, to a MS Access database in my computer) from R using the RODBC package. Unfortunatelly I haven't been able to do it, even if I 'followed' the instructions in the manual. COuld someone please help me? I have a MS Access database in my computer and I went to the control panel in order to create a DSN file
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
2011 Oct 26
4
Help wanted: pg vs. postgres-pr gems
Hi all, I installed Rails 3.0 + PostgreSQL 8.4. Installed the gem postgre-pr I added " gem ''postgres-pr'' " to my Gemfile I defined my database.yml with: # PostgreSQL 8.4 development: adapter: postgresql encoding: unicode database: testdb pool: 5 username: test password: ****** I run rails server which starts, but application environment returns this error:
2003 Jun 12
3
E1 cards
We are not having any luck with the E100p card here in Australia, it will work with a crossover cable to another device but will not talk to our Telco Telstra who probably have a weird implementation of an E1. Any suggestions on a replacement? Regards Mark McKibbin DCS Internet 64 Queen St Warragul Victoria 3820 Australia www.dcsi.net.au mark@team.dcsi.net.au Ph. 1300 665575 Fx. 1300 556595
2009 Feb 09
3
RSpec Testing ActiveRecord config dependency.
I have the following library code: def normal_time_now return DateTime.now.utc if default_timezone == :utc return DateTime.now end This is dependent upon a setting in config/environment.rb # Make Active Record use UTC-base instead of local time config.active_record.default_timezone = :utc I want to test that I get the expected results with the config set to utc and