I wouldn't mention just ActionView. I believe this approach is used by all major pieces in rails repository, like AR, ActionPack and the like with the exception being AS.

The guide would be something like:

---
"Using Rails components outside Rails" (In some Advanced topics)

Sometimes you may want to rely on parts of Rails pieces in your own code. Maybe you're writing unit tests or maybe you are not using Rails at all (another web framework or the application is not a web one at all).

Still you might be interested on formatting numbers or currency in your code (ActionView::Helpers::NumberHelper), use ActiveRecord, ActiveModel or some other components you might be interested on.

Rails follows a few conventions you should be aware of if you want to try those components outside of the Rails context.

Since most Rails components make extensive use of some core extensions added by ActiveSupport, they're commonly included ('active_support/rails') in the entry point of those frameworks. For instance, if you want to use some part of ActionView you should require the entire ActionView component instead of only the specific part you want. That is because the specific parts may not declare all dependencies on their own files since they were already declared in the entry point of those components.

This avoids requiring all those common files over and over but you have to be aware that it means you have to load the entire component and not just part of it.

So, if you want to use ActionView::Helpers::NumberHelper, please be sure you require 'action_view' instead of 'action_view/helpers/number_helper'.

The same is true for all other components except ActiveSupport who always have explicit dependencies on each file it contains.

---


This is basically what I was proposing.

Best,
Rodrigo.


Em 08-02-2013 16:36, Rafael Mendonça França escreveu:
Accepted too.

About the subject, I think we had a guide or a topic in some guide about how to use Action View outside Rails. I'm not 100% sure but if this guide/section existed we reverted it since we thought doesn't make sense to leave it as official documentation since it is too advanced and talks more about the Rails internals and how it is implemented, not about how it is used.

I know is hard to understand the Rails internals but I don't think there are more that we can do that try to answers the people questions.

Rafael Mendonça França
http://twitter.com/rafaelfranca
https://github.com/rafaelfranca


On Fri, Feb 8, 2013 at 4:22 PM, Rodrigo Rosenfeld Rosas <[email protected] <mailto:[email protected]>> wrote:

    I was planning to send a particular message to Xavier about that
    but it seems he was not the only one offended.

    I'd like to apologize about that and I simply forgot to remove
    that particular opinion from the message. I just copied and pasted
    my solution and forgot I had written that along the other lines.

    It wasn't my intention to publicly offend any of you. I should
    have re-read my message and removed that "stupid" piece from it if
    I have noticed it there.

    It was intended to be kept only in my private repository as my
    particular opinion on the subject.

    It wasn't meant to offend any of you.

    So sorry about that.

    Em 08-02-2013 16:18, Rafael Mendonça França escreveu:

        Before calling something or someone stupid please try to
        understand the person/project, its historical reasons, its needs.

        Talking about something you don't understand is very easy.

        Next time think twice before insulting the project on this
        list again, or you could not get replies.


-- You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Core" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:rubyonrails-core%[email protected]>.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>.
    Visit this group at
    http://groups.google.com/group/rubyonrails-core?hl=en.
    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: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
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: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to