Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

Sorry that I am new to ruby on rails.

I am trying to create a directive in angularjs. What I was doing is create an html file in folder view/forms, named topRight-buttonGroup.html

Then I just created a simple directive for test:

app.directive('topRightButtonTools', function(){
    return {
        restrict: 'C',
        templateUrl: 'topRight-buttonGroup.html'
    };
});

But getting the error message in the console is:

GET http://localhost:3000/forms/topRight-buttonGroup.html 404 (Not Found) 

Am I missing something should be done on ruby on rails? Or should I write some redirect code and save in somewhere?

my full folder structure is:

Here is my structure

share|improve this question
    
Where you putting your html file? – BKM Apr 7 '14 at 6:40
    
@BKM I put html file in folder view/forms, as the post say – Justin Apr 7 '14 at 6:42
    
What you get if you give full path to your template in your directive? – BKM Apr 7 '14 at 6:47
    
@BKM still the same error – Justin Apr 7 '14 at 6:49
    
Try templateUrl: 'views/forms/topRight-buttonGroup.html' – BKM Apr 7 '14 at 6:52

If you need the form to be accessible so, create a folder inside public/ as forms/ and have the file placed there. Only content inside the public dir are rendered directly.

Unlike core php or other such scripting languages, RoR requires controllers to render actions which arent merely files that are interpreted. Also, routes are to be defined in config/routes.rb.

Refer:

http://guides.rubyonrails.org/routing.html

http://www.xyzpub.com/en/ruby-on-rails/3.2/statische_webseiten.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.