Ruby on Rails Monday, January 20, 2014

On Jan 20, 2014, at 6:06 AM, Nguyen Le wrote:

> Thanks for your reply, Colin. I asked this question, because I want to
> make sure file *.html.erb can connect to mySQL database. Could you help
> me to answer this question and give me code sample?. Thank you so much
>

Colin's reply will help you understand the folly of your question as written. A single erb file won't connect to a MySQL database on its own, within the context of a Rails application, ever. The View is responsible for showing the data, not fetching it or responding to user input.

If you have a full Rails application there, and not just a single erb file, you may have a different question. But until you come to grips with the basics of how Rails works, I doubt you're going to get much of an answer here that makes sense to you until you can formulate your question in another manner.

Walter

> --
> 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/069854e0823d328441f7550a03df0d66%40ruby-forum.com.
> For more options, visit https://groups.google.com/groups/opt_out.

--
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/196D5CB8-FF6B-45F1-A249-8EB51460F8E4%40wdstudio.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment