Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm going to create some AngularJS/Rails app, but I'm a newby in developing with AngularJS. So, I have one question: should I divide my project with 2 parts: the first one is just HTML/CSS/JS code and the second one is Rails API? I also can do all work in the Rails project. What should I prefer? Thanks in advance!
Personally I feel that the clean way is to put the html files under the public folder. Also this will make it easier to point Angular routes to your html files as you don't have to mix .erb with your javascript, which also gives you the ability to use pure coffeescript everywhere (You cannot make .coffee.erb files sadly).
The folder structure for all my Angular applications was following:
Angular coffee files:
app/assets/javascripts/angular/
In there I have seperate folders for controllers services and directives. In controllers folder I have the same namespacing going on as in Rails controllers folder.
So if there is a content namespace where I have likes and media controllers inside of it, then it looks the same in Angular folder.
Angular template files:
public/templates/
In public/templates where I keep the .html files, I follow the rails way of naming folders and files, and also keep the namespacing. So if users folder has an index page and a show page then I also have show.html and index.html.
Here are some very good examples where people have made Angular - Rails applications:
CafeTownsend
Rails4-AngularJs example
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
This might not be an acceptable question for Stack Overflow but I didn't know where else to ask the question.
Web Components has been "about to happen" for a very long time. It now appears that most browsers have most of the required pieces natively instead of using polyfills (which always worried me).
I'm wondering if Ruby On Rails is planing on moving to it or if there are any projects creating web components as well as Rails server code to take advantage of them.
I'm wondering if Ruby On Rails is planing on moving to it or if there are any projects creating web components as well as Rails server code to take advantage of them.
The webpacker gem makes it easy to include some of the JS frameworks for non-native web components like Vue or React, but you can also use it with Polymer to support native web components. We do this at my work, and we don't necessarily use webpacker for it right now but I can assure you it's a very good gem.
Here's more info: https://github.com/rails/webpacker
Here's how you'd initiate a new rails project with webpacker set up for VueJS for instance:
rails new myapp --webpack=vue
I'm not sure if rails is going to implement web-components as a built-in feature or not but the motive behind adding webpacker as default in rails 6 is to improve the integration of front-end/javascript libraries. So, you can use vue-js, react-native easily along with your rails app and build components in it.
I'm personally using many vue-js components in rails projects and having no issue with that.
P.S: Same as the question this might not be an acceptable answer :P
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm a beginner of Ruby. I want to establish my website by programming with Ruby language.
Before that, I used to upload HTML files to my web-host server, so that I could update my website. But now I have no idea about what should I do with Ruby file.
Thank you!
If you are using the rails framework you may wanna try using cloud9 instead. Brackets from what i understand is "local". Whereas cloud9 is a "real" IDE. Additionally you can easily push your code to heroku where your code will be hosted at.
To get things started just head over to cloud9 to create an account to setup your IDE. If you are unfamiliar with it there are lots of guides out there that can help you to get things started.
However if you lack the fundamentals in using the rails framework, guides.rubyonrails.org may be a good place to start too.
Update:
There is no best language when it comes to developing a website. The fundamentals of a webpage are HTML/CSS.
HTML gives you the bones or structure, such as your titles and your paragraphs etc.
CSS gives you your styling, such as creating buttons or changing font color etc.
This 2 languages form the core part of what would be your website, at the very least on the front end (meaning to say what people see when they visit your website)
JavaScript is not a must but definitely a plus. It is able to improve the UI/UX (user interface/user experience) of your website.
Lastly would be your back-end language; what handles the processes that goes on behind the scenes. If you choose ruby (and by extension rails) then that is fine as well. Basically your back-end language will support your database and CRUD (create, read, update, delete) actions.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Rails provide a strong template engine out of box and i like it. I was wondering if there is any way to use it? So maybe angular templates can be wrapped inside rails that lives in our views directory. We can call it metatemplates.
So instead of my angular templates living in asset directory which i feel is not a good way?
Also i need to make use of rails routes inside my angular at some point. For example Signout functionality.
AFAIK, you could let Ruby serve up angular templates. Ultimately Angular is requesting a resource from the server via a url, and expects it to be an html fragment. If Angular is requesting from Rails, then you could use Rails functionality to serve up the html fragment (ie template). So you could write your angular templates as a Rails partial using erb or haml, which Rails would then serve up as html to the requester.
As a side note, it gets complicated to separate concerns doing this approach. Keep it clear in your mind what Rails needs to do as an application server, and what Rails needs to do as an application service. The application server needs to serve up the Angular application (i.e. js and html that will be managed by Angular on the client side). The application service needs to serve json that will be consumed by Angular.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to separate model view controllers in HMVC form including routes.After reading i found that ruby on rails does not support HMVC structure.Is there any alternative of doing it?. I also want to separate routes module wise.
Please suggest some best ways of doing it as keeping everything in one place is hard to manage.Thanks in advance.
Inside your app, with Controller Namespaces and Routing you can organize in subfolders inside the main MVC structure subsystems of your application. With David's patch to Routing you can split up a big routes.rb file.
If you prefer to extract "applications" from your main app, and mount them in the router, Rails::Engine is the way to go.
You can use nested routes: rails guide http://guides.rubyonrails.org/routing.html
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am currently using BlogEngine.net as my blogging platform. I'm fascinated with the beauty and simplicity of Jekyll and want to move to it.
I have found 2 resources which help in migrating existing posts: http://doingthedishes.com/2011/04/14/moving-to-jekyll.html and http://philippkueng.ch/migrate-from-blogengine-dot-net-to-jekyll.html. I am yet to try these methods. However, I'm worried about conflicting URL structures, which can cause broken links to my posts which are referenced elsewhere.
BlogEngine.net uses the URL structure "http:// sitename.com/post/title-of-the-post.aspx". I'm not sure if I can retain the same URL structure after migrating to jekyll (I've checked Jekyll's permalinks https://github.com/mojombo/jekyll/wiki/Permalinks, but I don't think it can help). Kindly let me know how I can solve this problem of migrating from blogEngine.net to jekyll without breaking URLs and losing SEO ranking.
Edit: I want to host my static blog on Github pages, which do not support redirects. Is there a way I can use Github or should I choose a host which supports htaccess redirects?
You can maintain the same URL structure with Jekyll. Add the following in _config.yml file,
permalink: /post/:title.aspx/index.html
Jekyll picks the :title from the URL part of file present in _posts folder.
Ex: File name: 2012-06-09-title-of-the-post.markdown, title: title-of-the-post
Since my blog is powered by Jekyll, I tested locally with this new URL format with .aspx extension. It worked.
Jekyll creates a folder called "title-of-the-post.aspx" instead of file, and creates index.html inside that folder. so no redirects required.