Maybe I can ask here

D

Dark Ambient

Sorry, because this is Rails related but it seems not answers are
forthcoming from the Rails list.

I am working from the Ruby for Rails book , the r4rmusic app.
All the code is already completed.

However I want to know how or if it's even possible to access methods
both within the controllers or models via the script/console ?

Example
class Composer < ActiveRecord::Base
has_many :works,
:eek:rder => "title"

def publishers
works.editions.publishers.uniq
end

..................

end

How could i access the publishers method via the console ?
Hope this makes sense.

TIA
Stuart
 
J

James Britt

Dark said:
Sorry, because this is Rails related but it seems not answers are
forthcoming from the Rails list.

I am working from the Ruby for Rails book , the r4rmusic app.
All the code is already completed.

Putting aside whether this is the right list for this question (I
sympathize with your difficulty in getting a response on the Rails
list), there is a forum set up by Manning for David's book:

http://www.manning-sandbox.com/forum.jspa?forumID=200
 
S

surf

Dark said:
Sorry, because this is Rails related but it seems not answers are
forthcoming from the Rails list.

I am working from the Ruby for Rails book , the r4rmusic app.
All the code is already completed.

However I want to know how or if it's even possible to access methods
both within the controllers or models via the script/console ?

Example
class Composer < ActiveRecord::Base
has_many :works,
:eek:rder => "title"

def publishers
works.editions.publishers.uniq
end

.................

end

How could i access the publishers method via the console ?
Hope this makes sense.

TIA
Stuart


I found you can write ruby programs which include code in the apps
directory from
lib/tasks directory if you fool around with the path a little bit

Here is some code I have that runs from the console in the tasks dir
and includes profile, criteria, match from app/models.

$:.unshift ";../"
$:.unshift ";c:/myproj/dateing/app/models/"

require 'rec_schema'
require 'profile'
require 'match'
require 'criteria'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top