[Rails] Re: What if you don't want your model to be from Active Record?
Peter wrote in post #1124413:
> By "wrap together", I meant I would write a single function for all the
> functions I would use from the AWS API.
>
> So, I should put this in the models directory, right? I want the
> controller
> to remain a "controller" with respect to rails-isms.
>
> class MyAWSAPI
> def list_servers
> ... call to AWS API to get list of servers...
> end
>
> def show_server(int)
> ... call to AWS API to get info on server int ...
> end
> end
Yes, that would be a model object and models would be a good place to
put that. You might even consider implementing ActiveModel with your
class and gain some ActiveRecord like behavior, but not actually be an
ActiveRecord subclass. Depends on your needs.
--
Posted via http://www.ruby-forum.com/.
--
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/a17825a565ddaa4782ae9aa7c8d8db27%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home