[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Modules in rails? ( controllers or models?

malugu satyajit

12/2/2007 11:41:00 PM

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

Hello,

I have an rails application that has almost similar function for three
classes. So I am thinking to create a parent class and then the sub classes
inherit from it. But rails already inherits from ActiveRecord(models) or
ApplicationController(controller).

So how can I inherit from others classes. My my ruby knowledge it is modules
and then you mixin the module in your class.

Now my question, where you write the module in rails is it in controller or
model? Can some one provide me links or guidance.


--
Regards,
M.Satyajit
Graduate Student,
Department of Computer Science,
NCSU.
www4.ncsu.edu/~smalugu

15 Answers

fedzor

12/2/2007 11:49:00 PM

0


On Dec 2, 2007, at 6:40 PM, malugu satyajit wrote:

> Hello,
>
> I have an rails application that has almost similar function for three
> classes. So I am thinking to create a parent class and then the sub
> classes
> inherit from it. But rails already inherits from ActiveRecord
> (models) or
> ApplicationController(controller).
>
> So how can I inherit from others classes. My my ruby knowledge it
> is modules
> and then you mixin the module in your class.
>
> Now my question, where you write the module in rails is it in
> controller or
> model? Can some one provide me links or guidance.
>

You can create a parent class that inherits from ActiveRecord or
ApplicationController.
Then, your subclasses can inherit from the parent class.

This may or may not work, and this is a question for the rails list


_______________________________|
- Ari
I just bought another case of RockStar. Expect architectural changes.



malugu satyajit

12/2/2007 11:58:00 PM

0

Note: parts of this message were removed by the gateway to make it a legal Usenet post.

thanks... can you say the rails list address? I found it on web.. but just
be sure

On Dec 2, 2007 6:49 PM, thefed <fedzor@gmail.com> wrote:

>
> On Dec 2, 2007, at 6:40 PM, malugu satyajit wrote:
>
> > Hello,
> >
> > I have an rails application that has almost similar function for three
> > classes. So I am thinking to create a parent class and then the sub
> > classes
> > inherit from it. But rails already inherits from ActiveRecord
> > (models) or
> > ApplicationController(controller).
> >
> > So how can I inherit from others classes. My my ruby knowledge it
> > is modules
> > and then you mixin the module in your class.
> >
> > Now my question, where you write the module in rails is it in
> > controller or
> > model? Can some one provide me links or guidance.
> >
>
> You can create a parent class that inherits from ActiveRecord or
> ApplicationController.
> Then, your subclasses can inherit from the parent class.
>
> This may or may not work, and this is a question for the rails list
>
>
> _______________________________|
> - Ari
> I just bought another case of RockStar. Expect architectural changes.
>
>
>
>


--
Regards,
M.Satyajit
Graduate Student,
Department of Computer Science,
NCSU.
www4.ncsu.edu/~smalugu

Todd Benson

12/3/2007 12:07:00 AM

0

On Dec 2, 2007 5:40 PM, malugu satyajit <malugu.satyajit@gmail.com> wrote:
> Hello,
>
> I have an rails application that has almost similar function for three
> classes. So I am thinking to create a parent class and then the sub classes
> inherit from it. But rails already inherits from ActiveRecord(models) or
> ApplicationController(controller).
>
> So how can I inherit from others classes. My my ruby knowledge it is modules
> and then you mixin the module in your class.
>
> Now my question, where you write the module in rails is it in controller or
> model? Can some one provide me links or guidance.

Well, from a kindergartener's perspective (namely, mine), I would
think that if your classes represent tuples of data in a database,
they would be models, and you would add functionality by having the
model classes (those that inherit from ActiveRecord::Base) require the
necessary mixin themselves, or make use of #extend. I think, however,
it is highly dependent on your situation.

I'm sure you can find some best practices advice from the rails list.
The one I have bookmarked is:
http://groups.google.com/group/rubyon....

Todd

doctor

11/5/2013 9:29:00 PM

0

In article <l5bfcb$gst$2@news.albasani.net>,
Adam H. Kerman <ahk@chinet.com> wrote:
>Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>"Adam H. Kerman" <ahk@chinet.com> wrote:
>>>Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>
>>>>The Name of the Doctor makes it clear that [John] Hurt is a version
>>>>of the Doctor. Smith knows him. He therefore is not from Smith's
>>>>future. . . .
>
>>>How did you rule out The Doctor not knowing future selves given that we've
>>>seen this? If Hurt is a past self but knows Smith, then a past self knew
>>>a future self in that episode
>
>>The Doctor has never known his future selves. On the few occasions a past
>>Doctor has met a future Doctor, the past Doctor's memory of the event was
>>wiped.
>
>I don't recall dialogue to that effect in "The Three Doctors", "The Five
>Doctors", or "The Two Doctors". Was there?
>
>On the few occasions the Doctor has had the opportunity to find out
>>about his own future (eg via River Song), he has completely refused to do
>>so.
>
>Except he did indeed learn what River saw in "The Impossible Astronaut",
>and created a situation in which River would still see it.
>
>>Why did the Hurt Doctor know Smith? Well first there's no evidence that he
>>did. Although there may be some kind of ability for Time Lords to recognise
>>future versions of themselves. Second, they were in the Doctor's own
>>time-stream, so theoretically the only people in there should have been the
>>Doctor. And thirdly, this was not the Hurt Doctor as he was when he was he
>>existed - this was a virtual version, held within the Doctor's subconscious.
>
>I suppose. I disliked the episode and may have forgotten something.
>
>>>Nothing we've seen rules out Matt Smith meeting a future incarnation
>>>of The Doctor. Not even all that dialogue we've heard during Smith
>>>seasons and in the past of not crossing time lines and not contaminating
>>>time lines. It's often done on this show, which has no rules.
>
>>Nothing rules it out. But it hasn't happened yet, and the dialogue in the
>>Name of the Doctor clearly indicated that Hurt was from his past, not his
>>future.
>
>>It's also a rather daft thing to do, as the writer would know that whichever
>>actor was picked to play a future Doctor was unlikely to ever actually
>>become that Doctor. In this case, do you think Hurt would take on the role
>>after Capaldi has quit?
>
>I rejected it at the time. They can't afford Hurt's wages for more than
>a one-off appearance. Capaldi's certainly cheaper.
>
>Nothing prevents Hurt from being a recast past or future incarnation,
>which they've done before as well.

No future.
--
Member - Liberal International This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.m... Look at Psalms 14 and 53 on Atheism
23 Nov 2013 a Big day indeed

doctor

11/5/2013 9:30:00 PM

0

In article <l5bgvu$l1h$3@dont-email.me>,
David Johnston <David@block.net> wrote:
>On 11/5/2013 10:28 AM, Stephen Wilson wrote:
>> "Adam H. Kerman" <ahk@chinet.com> wrote in message
>> news:l5ardc$63s$2@news.albasani.net...
>>> Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>>
>>>> The Name of the Doctor makes it clear that [John] Hurt is a version of
>>>> the Doctor. Smith knows him. He therefore is not from Smith's future. . .
>>>> .
>>>
>>> How did you rule out The Doctor not knowing future selves given that we've
>>> seen this? If Hurt is a past self but knows Smith, then a past self knew
>>> a future self in that episode
>>
>> The Doctor has never known his future selves. On the few occasions a past
>> Doctor has met a future Doctor, the past Doctor's memory of the event was
>> wiped.
>
>So the Doctor's memory of the Valeyard was wiped?
>

Doubtful.
--
Member - Liberal International This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.m... Look at Psalms 14 and 53 on Atheism
23 Nov 2013 a Big day indeed

doctor

11/5/2013 9:31:00 PM

0

In article <061120130908568655%YourName@YourISP.com>,
Your Name <YourName@YourISP.com> wrote:
>In article <l5ardc$63s$2@news.albasani.net>, Adam H. Kerman
><ahk@chinet.com> wrote:
>
>> Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>
>> >The Name of the Doctor makes it clear that [John] Hurt is a version of
>> >the Doctor. Smith knows him. He therefore is not from Smith's future. . . .
>>
>> How did you rule out The Doctor not knowing future selves given that we've
>> seen this? If Hurt is a past self but knows Smith, then a past self knew
>> a future self in that episode.
>>
>> Nothing we've seen rules out Matt Smith meeting a future incarnation
>> of The Doctor. Not even all that dialogue we've heard during Smith seasons
>> and in the past of not crossing time lines and not contaminating time lines.
>> It's often done on this show, which has no rules.
>
>You're wasting your time. The moron is so blinkered into their only
>being one possible solution that he simply won't every believe anything
>else. If he turns out to be wrong he's going to be bitterly confused
>and probably have a mental breakdown. :-
YN is in a permanent state of mental breakdown.
--
Member - Liberal International This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.m... Look at Psalms 14 and 53 on Atheism
23 Nov 2013 a Big day indeed

Stephen Wilson

11/5/2013 11:48:00 PM

0


"David Johnston" <David@block.net> wrote in message
news:l5bgvu$l1h$3@dont-email.me...
> On 11/5/2013 10:28 AM, Stephen Wilson wrote:
>> "Adam H. Kerman" <ahk@chinet.com> wrote in message
>> news:l5ardc$63s$2@news.albasani.net...
>>> Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>>
>>>> The Name of the Doctor makes it clear that [John] Hurt is a version of
>>>> the Doctor. Smith knows him. He therefore is not from Smith's future.
>>>> . .
>>>> .
>>>
>>> How did you rule out The Doctor not knowing future selves given that
>>> we've
>>> seen this? If Hurt is a past self but knows Smith, then a past self knew
>>> a future self in that episode
>>
>> The Doctor has never known his future selves. On the few occasions a past
>> Doctor has met a future Doctor, the past Doctor's memory of the event was
>> wiped.
>
> So the Doctor's memory of the Valeyard was wiped?

Possibly. Possibly not. What happened to the Doctor after the trial was not
looked into in any detail. But let's say the 6th Doctor retained all his
memories of what he learned during the trial.. How could he then go through
all the events in his future already knowing exactly how he should act/react
and what the outcomes would be?

But apart from all that, the Valeyard was a very different can of worms to
the Hurt Doctor. The Valeyard wasn't a future Doctor. He was an amalgamation
of the Doctor's darker side. He was a little like the Watcher (who existed
between the 4th and 5th Doctors). The Valeyard was a potential being, as
opposed to the Hurt Doctor who - as far as we can tell from the last
episode - was an actual incarnation as opposed to a potentiality.




---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www...

Stephen Wilson

11/5/2013 11:49:00 PM

0


"The Doctor" <doctor@doctor.nl2k.ab.ca> wrote in message
news:l5bnuo$4dt$1@gallifrey.nk.ca...
> In article <bmci79pddmt7pt4q2mec5ejt71o3kidbpe@4ax.com>,
> Ignis Fatuus <Ignis@fatuusisland.com> wrote:
>>On Tue, 5 Nov 2013 17:28:57 -0000, "Stephen Wilson"
>><stephen.wilson2004nospam@ntlworld.com> wrote:
>>
>>>
>>>"Adam H. Kerman" <ahk@chinet.com> wrote in message
>>>news:l5ardc$63s$2@news.albasani.net...
>>>> Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>>>
>>>>>The Name of the Doctor makes it clear that [John] Hurt is a version of
>>>>>the Doctor. Smith knows him. He therefore is not from Smith's future.
>>>>>. .
>>>>>.
>>>>
>>>> How did you rule out The Doctor not knowing future selves given that
>>>> we've
>>>> seen this? If Hurt is a past self but knows Smith, then a past self
>>>> knew
>>>> a future self in that episode
>>>
>>>The Doctor has never known his future selves. On the few occasions a past
>>>Doctor has met a future Doctor, the past Doctor's memory of the event was
>>>wiped. On the few occasions the Doctor has had the opportunity to find
>>>out
>>>about his own future (eg via River Song), he has completely refused to do
>>>so.
>>>
>>>Why did the Hurt Doctor know Smith? Well first there's no evidence that
>>>he
>>>did. Although there may be some kind of ability for Time Lords to
>>>recognise
>>>future versions of themselves. Second, they were in the Doctor's own
>>>time-stream, so theoretically the only people in there should have been
>>>the
>>>Doctor. And thirdly, this was not the Hurt Doctor as he was when he was
>>>he
>>>existed - this was a virtual version, held within the Doctor's
>>>subconscious.
>>>
>>>But finally, the Doctor described him as "my secret". Not as "the person
>>>who
>>>will become my secret". Everything Smith said about the Hurt Doctor was
>>>in
>>>the past tense. This is a pretty strong indicator that Hurt has been and
>>>gone, and not someone who is yet to be.
>>>
>>>> Nothing we've seen rules out Matt Smith meeting a future incarnation
>>>> of The Doctor. Not even all that dialogue we've heard during Smith
>>>> seasons
>>>> and in the past of not crossing time lines and not contaminating time
>>>> lines.
>>>> It's often done on this show, which has no rules.
>>>
>>>Nothing rules it out. But it hasn't happened yet, and the dialogue in the
>>>Name of the Doctor clearly indicated that Hurt was from his past, not his
>>>future.
>>>
>>>It's also a rather daft thing to do, as the writer would know that
>>>whichever
>>>actor was picked to play a future Doctor was unlikely to ever actually
>>>become that Doctor. In this case, do you think Hurt would take on the
>>>role
>>>after Capaldi has quit?
>>>
>>It might also be significant that there are no 'Future' Doctors in the
>>timeline. If it really is complete... and we know that another Doctor is
>>imminent... then either Smith can't see his 'future' selves, or his
>>'future' is under threat of extinction.
>>
>>But if the Doctor could foresee his own future, then he'd know the
>>circumstances of his impending regenerations. Tennant was in turmoil
>>because the Ood Elder (Brian Cox... Sydney Newman in the Hartnell Special)
>>revealed his 'destiny' (not a detailed account of the circumstances)... so
>>I can't see Smith having detailed knowledge of secret from his future.
>
> What about the fact the TimeLine guide Clara to spot to determine that
> this is Doctor #11.

You tell us. What about it?



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www...

Stephen Wilson

11/5/2013 11:50:00 PM

0


"The Doctor" <doctor@doctor.nl2k.ab.ca> wrote in message
news:l5bnvc$4ei$1@gallifrey.nk.ca...
> In article <l5bfcb$gst$2@news.albasani.net>,
> Adam H. Kerman <ahk@chinet.com> wrote:
>>Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>>"Adam H. Kerman" <ahk@chinet.com> wrote:
>>>>Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>
>>>>>The Name of the Doctor makes it clear that [John] Hurt is a version
>>>>>of the Doctor. Smith knows him. He therefore is not from Smith's
>>>>>future. . . .
>>
>>>>How did you rule out The Doctor not knowing future selves given that
>>>>we've
>>>>seen this? If Hurt is a past self but knows Smith, then a past self knew
>>>>a future self in that episode
>>
>>>The Doctor has never known his future selves. On the few occasions a past
>>>Doctor has met a future Doctor, the past Doctor's memory of the event was
>>>wiped.
>>
>>I don't recall dialogue to that effect in "The Three Doctors", "The Five
>>Doctors", or "The Two Doctors". Was there?
>>
>>On the few occasions the Doctor has had the opportunity to find out
>>>about his own future (eg via River Song), he has completely refused to do
>>>so.
>>
>>Except he did indeed learn what River saw in "The Impossible Astronaut",
>>and created a situation in which River would still see it.
>>
>>>Why did the Hurt Doctor know Smith? Well first there's no evidence that
>>>he
>>>did. Although there may be some kind of ability for Time Lords to
>>>recognise
>>>future versions of themselves. Second, they were in the Doctor's own
>>>time-stream, so theoretically the only people in there should have been
>>>the
>>>Doctor. And thirdly, this was not the Hurt Doctor as he was when he was
>>>he
>>>existed - this was a virtual version, held within the Doctor's
>>>subconscious.
>>
>>I suppose. I disliked the episode and may have forgotten something.
>>
>>>>Nothing we've seen rules out Matt Smith meeting a future incarnation
>>>>of The Doctor. Not even all that dialogue we've heard during Smith
>>>>seasons and in the past of not crossing time lines and not contaminating
>>>>time lines. It's often done on this show, which has no rules.
>>
>>>Nothing rules it out. But it hasn't happened yet, and the dialogue in the
>>>Name of the Doctor clearly indicated that Hurt was from his past, not his
>>>future.
>>
>>>It's also a rather daft thing to do, as the writer would know that
>>>whichever
>>>actor was picked to play a future Doctor was unlikely to ever actually
>>>become that Doctor. In this case, do you think Hurt would take on the
>>>role
>>>after Capaldi has quit?
>>
>>I rejected it at the time. They can't afford Hurt's wages for more than
>>a one-off appearance. Capaldi's certainly cheaper.
>>
>>Nothing prevents Hurt from being a recast past or future incarnation,
>>which they've done before as well.
>
> No future.

Of course the Doctor has a future. If he didn't, why would they bother
casting Capaldi as the 12th Doctor?



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www...

Stephen Wilson

11/5/2013 11:51:00 PM

0


"The Doctor" <doctor@doctor.nl2k.ab.ca> wrote in message
news:l5bo01$4ep$1@gallifrey.nk.ca...
> In article <l5bgvu$l1h$3@dont-email.me>,
> David Johnston <David@block.net> wrote:
>>On 11/5/2013 10:28 AM, Stephen Wilson wrote:
>>> "Adam H. Kerman" <ahk@chinet.com> wrote in message
>>> news:l5ardc$63s$2@news.albasani.net...
>>>> Stephen Wilson <stephen.wilson2004nospam@ntlworld.com> wrote:
>>>>
>>>>> The Name of the Doctor makes it clear that [John] Hurt is a version of
>>>>> the Doctor. Smith knows him. He therefore is not from Smith's future.
>>>>> . .
>>>>> .
>>>>
>>>> How did you rule out The Doctor not knowing future selves given that
>>>> we've
>>>> seen this? If Hurt is a past self but knows Smith, then a past self
>>>> knew
>>>> a future self in that episode
>>>
>>> The Doctor has never known his future selves. On the few occasions a
>>> past
>>> Doctor has met a future Doctor, the past Doctor's memory of the event
>>> was
>>> wiped.
>>
>>So the Doctor's memory of the Valeyard was wiped?
>>
>
> Doubtful.

According to...??



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www...