Ruby on Rails
Saturday, September 2, 2017
On Saturday, September 2, 2017 at 5:05:10 PM UTC+1, Hassan Schroeder wrote:
On Fri, Sep 1, 2017 at 6:50 PM, Ben Edwards <lo...@funkytwig.com> wrote:
> So do I put the venue and event methods in to controllers or is there
> somewhere else. The venue and event classes map to tables which is why this
> seems the way to go. I want to put them into rails so I can use
> ActiveRecords, and also because it feels like the correct thing to do? I
> then need to work out how to change the setters in Active record, or maybe
> not, but at the moment I simply am trying to work out where the methods go.
Uh. That whole paragraph is such a mish-mash that it leads to me
believe that you don't have a clear picture of the MVC pattern that
Rails embodies.
Foe one thing, classes ("models") derived from ActiveRecord are
just that, models, *not* controllers. Controllers do not "map to tables".
You might want to, as Colin suggested, run through a tutorial before
going any further.
Then decide if it makes sense to combine your data import function
with the Rails *data display* function.
I get the MVC pattern now, but I did not when I wrote the stand alone scripts (I started by reacquainting myself with ruby and writing the batch processing). Basally I was trying to get my head around how, if at all, its best to do data loading and manipulation in rails. It seems very geared towards data input in forms. Ime sure there is a good way of doing it, just wondering if there is some guides about how to do it. Ime also thinking from a OO perspective there should be a VenueWebsite object so rather than collecting and manipulating the events in the Venue object it should be a separate class.
Anyway learning ruby and rails is enough for now. As the scripts work well so I've decided to park looking at moving them into rails until I know it better.
Thanks for everyone's help.
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c5fe832b-95cb-44ba-bde1-9413dffd0f1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment