rails issue with scaffold - ruby-on-rails

I'm new to rails and messing around with scaffold. I generated a new one doing rails g scaffold Review artist:string venue:string date:string comments:string then ran rake db:migrate and it looks pretty weird, not how my professor's looked in class. I just opened it in my browser. Anyone able to explain to me why it looks like this? Sorry this is vague but not sure how to search for an answer online. Thanks
edit: I also tried connecting to localhost:3000 after starting my rails server, but it wouldn't load. any suggestions?

It looks like you're trying to access the file directly.
You should rather start your rails server and then access the page via the proper route, eg. http://localhost:3000/reviews

Related

Rails App inside a Rails app's sub-folder

I have a rails app, but a client wants to have another rails app be hosted in a ssub-folder of the first rails app.
I can't find any help on how to do this or if it's possible, because if I go to:
http://example.com/second_app, the first app will try and route it despite another app being situated in the second_app folder.
I hope this makes sense, and someone will be able to help.
Sorry, two Rails apps with one inside the other is not possible.
If all you want is a special page for the client, you need a view, controller, and route:
$ rails g controller Pages second_page
And then change your route (config/routes.rb) from get 'pages/second_page’ to get '/second_page’.
After starting up your rails s, you can then go to localhost:3000/second_page and see your page.
If I’m completely misunderstanding what you’re trying to do, please describe your situation a bit more and I’d be happy to help.

rake doesn't work when using swagger-docs

I'm using swagger-docs sample to generate my api docs, at the beginning, everything went well. but today when I use "rake swagger:docs" after I change something in controller, nothing happened.
There is no error alert. After I start the server and type url in browser, the UI didn't show what I want.
Is there any special configuration I need to do? or please just tell me how to generate the docs properly.
I had the same problem and I figured it out. But I am using AWS EC2. Just for someone may need it.
RAILS_ENV=production rake swagger:docs

Rails Server, new files not live

I'm going through a Ruby on Rails tutorial and right now it's generating controllers. (I believe I'm on the local server.. started by doing:
$rails s
When I look in TextMate, all the new files have a "no entry" sign on them, which I assume to be not live. They also don't work when I try to pull up the address.
How do I make them live?
(Edit: Picture added, also.. When I try to go to the page it says:
Routing Error
No route matches [GET] "address"
Try running rake routes for more information on available routes.
Rails should not be generating controllers.
My advise is to start all over
rails new myApp
cd myApp
rails generate scaffold Post name:string title:string content:text
rake db:migrate
rails s
At point your browser to http://localhost:3000
Then you'll see the rails welcome page
If you point the browser to http://localhost:3000/posts you'll get to the post index page
And read this rails guide
update
Are you running rails generations from another user? It looks like you don't have read and write rights to the files from textmate.
Embarrassing lesson. The server was attached to a different directory. And apparently the symbol isn't read/write.. Not sure what it is though

Heroku app url made out of random words

I'm new to rails and heroku, and this may very well seem like a daft question, if so I appologise, but would appreciate someone at least telling me so.
I've followed the heroku "getting started" guide, and managed to deploy a copy of the rails default project. But the url preovided by heroku was http://radiant-ice-84.heroku.com, my question is this:
Does heroku assign a randomly generated url, or have I done something wrong because I don't recognise radiant-ice-84?
Before you closing this question, I would like to say that you in fact could specify the first when you create the app (no need to change again in the setting page) by using:
heroku create your-app-name
If you don't specify a name, Heroku generates one for you. You can change it in your app settings (as you noticed), although a lot of people just buy a domain name and map it to the Heroku-generated name.

Just started a new spree app, but can't find a way to generate theme_default

Anyone know how to generate a default_theme so that it can be edited? It seems that all the core files are hidden and uneditable.
The last working spree app I made started with theme_default exposed under vendor/plugins.
Because this one is in Rails3, I pulled it right from the official railsdog git, thus no theme_default, and no haml.
I'm probably missing something obvious. Any ideas?
Basically, to create your own views, the starting point is to create our own extension. You can achieve this with the command you'll find here:
http://spreecommerce.com/documentation/extensions.html#creatingan-extension
Then it's like any raRails Engine, you can create the views you want, they'll override spree's.
Is rake sandbox what you are looking for? See Building a Sandbox Application
You only do rake sandbox just for test purpose, I have found this link
Change the command for rails g spree:extension [ext_name].

Resources