I'm new to rails and I'm actually reading a tutorial on it but unfortunately it's a very old one (2007). They talk about temporary scaffolding which is a one-line addition to a controller for example:
class StoryController < ApplicationController
scaffold :story
end
I tried it in my project but I'be got this error:
Routing Error
No route matches [GET] "/story"
Try running rake routes for more information on available routes.
I thought maybe it's because I'm running a different rails version, maybe the syntax have changed... So my question is how do we perform temporary scaffolding on rails 3.
I previously had to set config.assets.enabled to false because I had a route error.
I'm running under:
Rails 3.2.13
Windows 8 pro 32-bits
I'm very surprised to see this, because I wasn't around when Rails had this scaffold method you show. I've never heard of it before.
I searched the API documentation (and Rails source) and there is nothing like this now. Instead, there is the rails generate scaffold command. You can find more information at http://guides.rubyonrails.org/command_line.html.
As a suggestion: If you want to use a version of Rails from 2007, the tutorial you have now is fine. If you want to use a modern version, find a modern tutorial. The Ruby on Rails Guides site is good.
Related
So I recently update from bootstrap 2 to bootstrap 4. I then changed the syntax, grids and such. The website was running/building fine in debug, however, when it comes to release, it won't work. It can build without errors, but when I run it, it seems like the site has the new syntax and classes (the code running is the one i changed) but bootstrap is still at v.2. I checked multiple times, there are no bootstrap 2 files left, nor any cdn references. I can see it still is running bootstrap 2 by changing classes from col-12 to, say span12. It works fine in debug, but not in release. Any clue why ?
Also, the site is running Asp.NET Core MVC Razor.
I think you might have a bundle-ing configuration issue.
Please verify your bundle configuration (App_Start\BundleConfig.cs) and the web.config settings and pertinent web.config transform.
You can find documentation on how to configure your bundles here : Bundling and Minification (assuming you're not using ASP.NET Core)
For ASP.NET Core it a bit more complicated because you can have multiple ways of doing the budleing. Documentation for it can be found here: Bundle and minifiy static assets in ASP.NET Core.
However, I think that is pretty probable that the production version of your app is still targeting the old Bootstrap version because of the bundle-ing configuration
When I create an app using composer, or install another app created using composer, there is a vendor/symfony folder included.
For example, I installed Laravel using composer. The folder vendor/symfony is present. I am not specifically referencing this in my Laravel app at all.
What is this folder, and it needed? Does the app use it, or composer use it? So if I am using an app created using Composer and dont use composer myself, can it safely be deleted and the app still run? Or could the app be using it?
Thanks
Answer is quite simple: Laravel uses Symfony components.
Check this article: http://www.sitepoint.com/build-php-framework-symfony-components/
Improved Routing Engine
Laravel 4.1 features a totally re-written routing layer. The API is
the same; however, registering routes is a full 100% faster compared
to 4.0. The entire engine has been greatly simplified, and the
dependency on Symfony Routing has been minimized to the compiling of
route expressions.
http://laravel.com/docs/master/releases
The "vendor" folder is a standard in every application / framework that uses composer to manage dependencies. In the "vendor" folder you will find all dependencies (read: libraries) that your applicatication requires.
But you will also find all libraries that your libraries require. In order to minimize code duplication, and thanks to the composer system, most open source projects now reuse parts from other open source projects.
BTW, this is great.
Symfony components are excellent and well documented, so they are currently used by many other frameworks and applications.
Inside the "vendor" you may find other libraries that you did not specifically require yourself, but as long as your correctly use composer, that's not something you should worry about.
I'm setting up my first Rails 4.1 app, which comes with Spring, their new preloader. When I try to install Devise using their generator ($ rails generate devise:install), the command line just hangs and nothing gets generated.
If I remove Spring from the gem file and try again, the Devise generator works.
Anyone have any insight?
Check directories of some other projects that you were working on at that time, chances are that the generated files ended up there.
spring seems to get confused when you work with more than one rails app at a time. That's probably what caused your problem
spring runs as a server and keeps a rails environment loaded. I think what happens is that if you work with more than one project at a time then spring system seems to get confused and uses wrong environment.
I have had a situation where I was running rails g ... in one project and the files were getting generated in another project. What was crazy was that I kept renaming and moving that other folder, and still the generator kept putting the files in that folder. As if spring had latched on the the inode of that folder.
Try DISABLE_SPRING=1 rails g devise:install
or ps aux |grep spring and kill all the processes you see and then run rails g devise:install
We are taking out spring from the Gemfile for now while this broken behavior persists, and in the future use rails new --skip-spring
If you want to keep using spring, then try following these rules
Use new shells for each new project
Use a new directory name for each new project (If you do rails new blog, work on it, then mv blog blog.old and rails new blog again, it might not work.
From time to time keep on killing all the spring servers, for safety's (and sanity's) sake.
You can disable spring for any $ rails command by passing the environment variable DISABLE_SPRING=1.
$ DISABLE_SPRING=1 rails generate devise:install
Alternatively, you can try $ spring stop to spin down the spring processes. Running $ rails generate afterwards will spin up a new spring process, which might solve the temporary issue.
There is same problem on rails 5.1.4 for responders gem
I listed solutions along with previous ones:
close terminal and open new one
run command with DISABLE_SPRING=1 bundle exec rails generate responders:install
or export it as environment variable
export DISABLE_SPRING=1
kill running spring process for your app
ps ax | grep spring | grep YOUR_APP_NAME | cut -f1 -d' ' | xargs kill
This is an old post, but i think my experience might help someone...
rails 5.0.1
I was facing same issue after i messed up some devise generated files(i am new to rails and learning) and than i tried rails destroy devise model and i was stuck, tried many time and nothing worked.
Googled, got here, tried excluding spring gems, and it worked, again added spring gems, and devise was again stuck on everything.
I just closed the terminal and opened new one, and it worked.
I'm trying to setup VS 2012's new bundling functionality (via the Microsoft.Web.Optimization package - read more here) and for the most part, everything is working alright. The problem is that the processing just gives up after ~15000 characters.
When I build and run the page, I get a bunch of failures because the JavaScript files that have been loaded are truncated halfway through a line in the middle of a function...
Has anyone else experienced this or does anyone have any insight into how resolve this issue?
--UPDATE--
I originally encountered this error using foo.AddDirectory("~/scripts/", "*.js"). Using foo.AddFile("~/scripts/bar.js") only results in the javascript errors when I include any jquery plugins. No errors are being thrown on the server.
--UPDATE2--
The problem was a result of the Web Optimization library not being up to date. I highly suggest that anyone attempting to use this retrieve the library via NuGet command line: Install-Package -IncludePrerelease Microsoft.AspNet.Web.Optimization. There are various versions of documentation and examples on the web, but the most current can be found using the above method and the most current documentation is that found in the answer below.
Do you have a small repro? My guess is that maybe there's an issue with the javascript files that are in the bundle.
Its also possible the minifier is choking on something and/or incorrectly minifying them.
If you are using the Scripts.Render helper, have you tried running with debug = true to make sure that everything works correctly with no bundling or minification?
Here's also the latest documentation which might be helpful: http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification
After upgrading the Flex SDK from 3.1 to any newer version of the SDK and trying to compile an existing project, the following error appears in the Problems pane:
Description: { expected
Resource: (shows project name, not a specific file)
Location: line 15
Any ideas how to solve this or where to start the bug hunt?
It looks like the problem is in the ...sdks/3.3.0/frameworks/libs/player/10/playerglobal.swc file, but I'm certainly not sure.
I've had this happen (among others). Never got to the bottom of it. In the end I migrated my code files to a new project. There are some pretty nasty bugs in FlexBuilder, especially when working on 64bit windows.
Have you tried to do a clean on the project? You didn't mention this but I assume that the project compiles fine under 3.1? If you create a new project does it compile cleanly (if not, it may mean that you have a bad download of the SDK and need to get a new copy.)
The problem was solved by removing halo.swc from libraries. Copying halo.swc to the project was suggested by an online tutorial (which I cannot find right now).