similar to: how to access a model from application.rb

Displaying 20 results from an estimated 300 matches similar to: "how to access a model from application.rb"

2006 Jun 13
2
four days on rails - nil object when you didnt expect it
Hi all, Im trying to get my head around rails and to help along Im working through "four days on rails" as this seems to give a good real world example with multiple tables and relationships (the main thing I cant work out!) Ive got stuck. Some help would be really good here. The controller has this code: def list @category_pages, @categories = paginate(:category, :per_page =>
2006 Jul 09
2
using content from a model in application.rhtml
Hi all, Not sure if Im doing this the right way (most likely not as I cant make it work!) I have an application that needs to put some content from two different tables(db) on every page within the application. What I thought I could do is write a small application helper that talks to the model and asks for the data. But I cant for the life of me work out how to actually talk to a model from
2005 Nov 18
2
help with User.find() and rendering text
Hi all, I''m trying to do something for a project. Herez what im trying to do. The user name gets passes from the view to the controller. On line2: The user name gets displayed. On line 3: (If this command works the way I think it works, the sad part is I always get it wrong) anyways, The entry in the data base with the given user name gets searched and the user info gets stored in
2005 Dec 19
6
custom find methods and pagination
i''ve got several methods in my models i use to find based on certain criteria...i''ve done this so the controller code is less cluttered, plus the DRY factor. example: class Foo < ActiveRecord::Base def find_by_something(something) find :all, :joins => ..., :conditions => ... end def find_by_something_else(something_else) find :all, :joins => ...,
2006 Apr 25
7
Rails producing the / page.
Hi all Very simple question, im sure, but I cant find docs anywhere that tell me how to do this. What I want is for the index page of the server to be generated from rails, is www.wibble.com/ will result in a page that has been processed by rails, has the templates etc. >From what I can see, the index page comes from public/index.html How do I get this to be a rails page? Thanks Jonathan
2002 Dec 06
1
Making TIMEOUT work?
I have problems getting the TIMEOUT value work the same way LILO/GRUB does it.. ie it should wait until the timeout and then use the default value. However, it goes straight for the default value without waiting a single second (and a TIMEOUT value of 500 should mean 50 seconds, as it counts in 1/10th of a second, right?) SYSLINUX (isolinux) 2.00 ----8<------8<---- SERIAL 0 38400 TIMEOUT
2006 Aug 03
3
Relationships between models.
Hi All, I think Im having a mental block here. For some reason I just cant get my head round relationships. What I have is the following. 4 tables 1) Hosts 2) Software 3) OperatingSystem 4) Company In my terms (which are most likely wrong) a company can have lots of hosts, a host has lots of software, a host has one operating system. So should my models have the following relations in them?
2007 Sep 13
3
Templates and undefined variables
Using puppet 0.23.2, I have a template where I wish to do something like this: <% if defined? some_variable %> .... <% end %> Ideally I''d like to tell these three cases apart: a) defined to a non-empty value b) defined to an empty value c) undefined However case c) causes problems - in templatewrapper.rb::method_missing it causes an error to be thrown. I''ve changed
2006 Jul 20
11
3 columns
Hi all, Not really sure what to put in the title so hope people still open this! What I want to do is produce something like this Col1 Col2 Col3 data1 data2 data3 data4 data5 data6 data7 data8 data9 data.. data.. data.. data.. data.. data.. data-n data-n+1 data-n+2 I can get the data back from my db
2006 Mar 13
7
Wilcard search
Hello, I''m writing a search function for my application, but I am unsure on how to search for all results that contain my search string; here''s what I''ve got: def search @products = Product.find(:all, :conditions => "date_available < now()", :conditions => [ "title ilike ?",
2006 Mar 18
3
paginate a collection
hi i want to paginate a collection found by complex sql query how can i do thanks -- Posted via http://www.ruby-forum.com/.
2010 Feb 17
1
Checking the assumptions for a proper GLM model
Hello, Are there any packages/functions available for testing the assumptions underlying assumptions for a good GLM model? Like linktest in STATA and smilar. If not, could somebody please describe their work process when they check the validity of a logit/probit model? Regards, Jay
2006 Feb 03
4
contoller code mysteries
In my controller...this code works def list2 first_name = params[:client][:first_name] @myclients = Client.find(:all, :conditions => ["first_name = :first_name", {:first_name => first_name}]) end this code doesn''t... def list2 first_name = params[:client][:first_name] if first_name searchstring = ''["first_name =
2006 Apr 09
7
Simple Search
I''m trying to implement a search system and I''m lost as to how to go about it. I''m searching the model "category", and I''m searching the "name" field. >From there I''ll use @categories.listings to display. But that''s the easy part. I assume I need to use a LIKE command in MySQL, but I don''t know how to do
2002 Oct 30
3
Problem with ISOLinux 2.00
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I am trying to build a live fs on a CD that is selfbooting that later installs a pre-configured linux (this is acctually an upgrade, I have already done it before with 1.67). Anyway, I can't get it to work this time. All I see is - -----8<------ Cannot load disk image (invalid file)? - -----8<------ My isolinux/isolinux.cfg file: -
2008 Apr 18
1
Embedding fonts in pdfs
Hi all, I'm having problems embedding fonts in my graphics - and I've tried embedFonts to no avail. I have a pdf file and pdffonts tells me: name type emb sub uni object ID ------------------------------------ ----------------- --- --- --- --------- ZapfDingbats Type 1 no no no 5 0 Helvetica
2004 Nov 16
3
deleting a file
Dear all, I have a very simple question. Simple, that is, if you know the answer. I wish to delete a file in a given directory after having first checked its existence. I issue the following commands path<-'c:example/R/' Thus creating the directory. indicator<-length(grep(filename,path)) If indicator is greater than zero then the file exists. Now I wish to remove this file.
2005 Dec 28
3
Axis/Ticks/Scale
Dear All, Apologies for this simple question and thanks in advance for any help given. Suppose I wanted to plot 1 million observations and produce the command plot(rnorm(1000000)) The labels of the xaxis are 0, e+00 2 e+05 etc. These are clearly not very attractive (The plots are for a PhD. thesis). I would like the axes to be 0,2,4,6,8,10 with a *10^5 on the right hand side. Is there a
2005 Aug 04
3
how to read individual values from a pixmap object
Hi All, I have a greyscale image that I am reading in through RGDAL and placing in a pixmap object. As an example use the logo.jpg file that comes with the RGDAL package: #Read the file logo <- system.file("pictures/logo.jpg", package="rgdal")[1] x <- new("GDALReadOnlyDataset", logo) #Create the pixmap object xGrey <- getPixmapGDAL(x) Now I would
2012 Oct 06
2
Expected number of events, Andersen-Gill model fit via coxph in package survival
Hello, I am interested in producing the expected number of events, in a recurring events setting. I am using the Andersen-Gill model, as fit by the function "coxph" in the package "survival." I need to produce expected numbers of events for a cohort, cumulatively, at several fixed times. My ultimate goal is: To fit an AG model to a reference sample, then use that fitted model