I have generated a model and a controller in rails 4,Client and
ClientsController, and configure the database.yml with the postgres
adapater and the database name, and i want that rails get the table
attributes from the clients table and generate the forms and all the
scaffolding CRUD operations. I’ve seen in the web some similar solutions
but with mysql database and i think with rails 3:
class ClientsController < ApplicationController
scaffold:clientend
but when calling any of the web urls, rails advertised that i have pending migrations, and if you think about it i dont need to migrate
the
model because is already in the database…
Rails looks at the migrations table to figure out what migrations are
pending. Run this command to fix the migrations first, and then run your
rails app:
On Friday, February 14, 2014 10:28:44 AM UTC, Juan Andres R.
wrote:
but when calling any of the web urls, rails advertised that i have pending
migrations, and if you think about it i dont need to migrate the
model because is already in the database…
Rails doesn’t really do scaffolding for existing models: the views etc.
are
generated statically rather than by introspecting the current state of
the
model (This was removed from rails around the rails 2 time - I think it
was
extracted into a plugin and there are other gems that produce an admin
type
interface automatically from the schema (eg activeadmin,
activescaffold).
You could i suppose generate the scaffold and then delete all the
database
migrations, leaving only the controllers/views. When you generate the
scaffold you would have to list all the attributes you want the scaffold
to
be aware of.
Lastly, none of this should depend on which db you are using
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.