Search Results

Search found 116 results on 5 pages for 'scaffold'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • Rails : Scaffold works for the first, but not for the second table

    - by Sylario
    I am using aptana radrails empty rail project : scaffold Article titre:string body:text categorie_id:integer ordre:integer Migrate - it works fine scaffold Categorie titre:string ordre:integer It generate the files but when i access http://127.0.0.1:3000/categories i have the following error : NameError in Categories#index Showing app/views/categories/index.html.erb where line #22 raised: undefined local variable or method `new_categorie_path' for # Extracted source (around line #22): 19: 20: 21: 22: <%= link_to 'New categorie', new_categorie_path % i deleted recreated my whole rails project a few times, changed categorie with another name but it keep failling. Why ?

    Read the article

  • Scaffold is ignoring class file in CakePHP

    - by JoseMarmolejos
    Hi, when using scaffolding on a controller the views render fine and the app even attempts to insert the data; the problem is that the scaffold is completely ignoring the relations I'm defining in my model class, in fact it's ignoring the class entirely as I can delete the file and the controller still scaffolds and render the crud from the table. Has this ever happened to you?

    Read the article

  • Active Scaffold + Ruby 2.3.5 not working

    - by rodrigoaronas
    Hello, I have an application with Rails 2.3.5. And Im trying to use AS latest version, I have used it previously but cant make it work here. I have my ingredient_categories Controller, where i put class Administration::IngredientCategoriesController < ApplicationController layout "default" active_scaffold :ingredient_categories end I have this set up on routes to be :active_scaffold=true I have a model also called ingredient_category, and in the views folder (inside administration/ingredient_categories, and /ingredient_categories) i have nothing as it is usual. And Im getting over and over again: Template is missing Missing template ingredient_categories/list.html in view path themes/aqueouslight:app/views I had an error before asking me for a list.erb, which I created and put <%= render :active_scaffold = 'ingredient_categories', :label = 'Categorias' % And now this error of the list.thml... Cant make it work! dont know whhy really... whould be SO simple and its burning my head now.. Thanks!

    Read the article

  • How do I create many-one relationships using Scaffold?

    - by Simon
    I'm new to Ruby on Rails, and I'm trying to create a bass guitar tutor in order to teach myself RoR (and bass guitar). The walkthroughs use Scaffold to create ActiveRecord classes, but they seem to correspond to standalone tables; there's no use of belongs_to or has_many. I'd like to create three classes: Scale, GuitarString, and Fret. Each Scale has many GuitarStrings, which each have many Frets. How do I create classes with this relationship using Scaffold? Is there a way to do it in one go, or do I need to create them in an unrelated state using Scaffold, then add the relations by hand? Or should I ditch Scaffold entirely?

    Read the article

  • MVC Scaffold Template Not Generating?

    - by monkey9987
    Been working on an MVC project and my templates were not generating. I first created my Model inside my "Models" folder, then did a quick compile. Next I went to the Views folder to get it created, right click and say "Add View" then I clicked the checkbox to create an edit page. What happened was the template would never seem to pull in my Model, it would just have the default header items, but the entire model was missing.  My model was defined as follows: public class LogOnModel { [Required][Display(Name = "User name")]public string UserName;[Required][DataType(DataType.Password)][Display(Name = "Password")]public string Password;[Display(Name = "Remember me?")]public bool RememberMe; } See anything wrong with that? I couldn't figure out why each time I created my View and selected the option to create the "Edit" scaffold automatically, it would come up blank. Turns out I'm missing my get / set methods on the Model class items. Here's my code with the correct setup: public class LogOnModel { [Required][Display(Name = "User name")]public string UserName { get; set; } [Required][DataType(DataType.Password)][Display(Name = "Password")]public string Password { get; set; }[Display(Name = "Remember me?")]public bool RememberMe { get; set; } }  I hope that helps someone out, it's pretty simple when I look at it now, but that's always the case!  ~ Steve

    Read the article

  • scaffold does not update view

    - by doemsche
    Hi there I have a question to the following procedure: script/generate scaffold product title:string description:text db:migrate #then I generate a migration which adds a column description to the table products and migrate the db again. My question is: why is the field description not added to the project-views? Is that normal rails scaffold behaviour? I think I saw in a video tutorial that the scaffold updates as well the views, which would be very convenient. Thanks in advance for any help!

    Read the article

  • What's with bad function call in view generated via scaffold?

    - by meta
    I've scaffolded Things element: script/generate scaffold wip/thing name:string and got some invalid function call in views, like: <td><%= link_to 'Edit', edit_thing_path(thing) %></td> Which raise this error: ActionView::TemplateError (undefined method `edit_thing_path' for #<ActionView::Base:0xb5c00944>) on line #11 of app/views/wip/things/index.html.erb: 8: <tr> 9: <td><%=h thing.name %></td> 10: <td><%= link_to 'Show', thing %></td> 11: <td><%= link_to 'Edit', edit_thing_path(thing) %></td> 12: <td><%= link_to 'Destroy', thing, :confirm => 'Are you sure?', :method => :delete %></td> 13: </tr> 14: <% end %> What's with that function? Where is it? Is it some kind of automagic stuff or do I need to implement it (if so - where should it go?) I have resource defined in routes with namespace: map.namespace :wip do |wip| wip.resources :things end rake routes gives me this: wip_things GET /wip/things(.:format) {:action=>"index", :controller=>"wip/things"} POST /wip/things(.:format) {:action=>"create", :controller=>"wip/things"} new_wip_thing GET /wip/things/new(.:format) {:action=>"new", :controller=>"wip/things"} edit_wip_thing GET /wip/things/:id/edit(.:format) {:action=>"edit", :controller=>"wip/things"} wip_thing GET /wip/things/:id(.:format) I assumed that those names (wip_thing, new_wip_thing) are the correct names, but it's still gives me that error Thanks.

    Read the article

  • Rails Scaffold problem # undefined method `edit_pais_path'

    - by Bruno Cordeiro
    I created a scaffold of named pais (This is a word in Portuguese of Brazil and is the same that country), i created using the follow command: ruby script\generate scaffold pais name:string abreviattion:string First I changed the inflections to my local idiom, like that: inflect.plural /^([a-zA-z]*)s$/i, '\1ses' #The plural of Pais is Paises And when I tryied to open the page on http://localhost:3000/paises I'm receiving the follow error: undefined method `edit_pais_path' for #<ActionView::Base:0x387fdf4> Thanks in advance.

    Read the article

  • rails script/generate scaffold problem

    - by palecoder
    I'm new to rails and was trying out the scaffold command - the following scaffold runs and works when I view it via web brick script/generate book title:string the following fails - gives me a weird route error script/generate application name:string the following works script/generate app name:string can anyone shed some light on this? Is 'application' a reserved word?

    Read the article

  • Errors when using a Ruby On Rails scaffold with a data type of interger

    - by bublebboy
    I am learning Ruby On Rails. I am on a shared hosting with Ruby version 1.8.1 and Rails version 2.3.10. I am working my way through a tutorial at http://railstutorial.org/chapters/a-demo-app?version=2.3#top and at one point in the tutorial it has me run: script/generate scaffold Micropost content:string user_id:interger The tutorial is using the default database, SQLite3. The command works and I use rake db:migrate to create the database. I can view the page listing the microposts (which is empty), but when I try to add a micropost (microposts/new) I get an error undefined method `user_id' for #<Micropost:0x7f710e4988e8> After doing some testing on my own it seems I experience the problem by using the data type of interger. While I understand that using a scaffold is not the best way of building a ruby on rails, I'm just beginning and would still like to know why I am experiencing this problem to help me better understand how rails works.

    Read the article

  • Scaffold default files are the best practice?

    - by antpaw
    Hey, i have some experience with MVC. but I'm new to rails. I'm using the scaffold command to generate some default files. The model looks clean and nice, but the controller and the views aren't really dry. The contents of new.html.erb and edit.html.erb are almost the same and the methods new/edit and create/update are doing almost the same thing. In other frameworks i've used only one view for updating and creating new entries and also the same method in my controller by setting the id as an optional parameter. Do they use this structure to keep things RESTful (i have not much of a clue about rest :()? Is it the best practice to use this default stuff for crud?

    Read the article

  • Best practice in Rails when editing scaffold made pages

    - by abegbg
    I have a best practice question. I have two classes, company and category. They have a many-to-many relationship. When clicking a category I shall go to a page showing all companies with the chosen category. Pretty straight forward. My question is: Should I list all the companies on the companies/index.html.erb after filtering the companies in the controller? or Should I list all the companies on the categories/show.html.erb page? or Should I do a completely new page, since it doesn't really fit into any of the two above? Do you generally make a new page when your goal doesn't fit the scaffold made pages or do you use them quite freely? I am working/learning alone with rails, so there are a lot of best practice questions popping up all the time. Cheers Carl

    Read the article

  • Paperclip failing to upload on specific scaffold, yet works on others

    - by Saifis
    I know there are tons of questions about paperclip, but I failed to find the answer to my problem. I know its prob just something simple, but I I'm running out of hair to pull out. I have paperclip working on other parts of my project, they work with no problem, however, a certain scaffold fails to upload, all the attributes to the uploaded file are nil. Here are the relevant information. Model: has_attached_file :foo, :styles => { :thumb => "140x140>" }, :url => "/data/:id/:style/:basename.:extension", :path => ":rails_root/public/data/:id/:style/:basename.:extension" View: <% form_for(@bar, :html => { :multipart => true }) do |f| %> <%= f.error_messages %> ---------- <li><%= f.label :top %> <%= f.file_field :foo %></li> ---------- <ul><%= f.submit "Save" %></ul> <% end %> Also, comparing the logs to the parts that work, the :foo attribute seems to be passing different values than in the ones that work. In the logs, when the paperclip function works, it looks like this "image"=>#<File:/var/folders/M5/M5HEb+WhFxmqNDGH5s-pNE+++TI/-Tmp-/RackMultipart20100512-1302-5e2e6e-0> when it does not, it seems to pass the file name directly "foo"=>"foo_image.png" I am developing locally on MacOSX using local rails and ruby libs.

    Read the article

  • uninitialized constant Active Scaffold rails 2.3.5

    - by Kiva
    Hi guy, I update my rails application 2.0.2 to 2.3.5. I use active scaffold for the administration part. I change nothing in my code but a problem is coming with the update. I have a controller 'admin/user_controller' to manage users. Here is the code of the controller: class Admin::UserController < ApplicationController layout 'admin' active_scaffold :user do |config| config.columns.exclude :content, :historique_content, :user_has_objet, :user_has_arme, :user_has_entrainement, :user_has_mission, :mp, :pvp, :user_salt, :tchat, :notoriete_by_pvp, :invitation config.list.columns = [:user_login, :user_niveau, :user_mail, :user_bloc, :user_valide, :group_id] #:user_description, :race, :group, :user_lastvisited, :user_nextaction, :user_combats_gagner, :user_combats_perdu, :user_combats_nul, :user_password, :user_salt, :user_combats, :user_experience, :user_mana, :user_vie config.create.link.page = true config.update.link.page = true config.create.columns.add :password, :password_confirmation config.update.columns.add :password, :password_confirmation config.create.columns.exclude :user_password, :user_salt config.update.columns.exclude :user_password, :user_salt config.list.sorting = {:user_login => 'ASC'} config.subform.columns = [] end end This code hasn't change with the update, but when I go in this page, I got this error: uninitialized constant Users /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `constantize' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `each' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `constantize' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in `constantize' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:28:in `reverse_matches_for' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:24:in `each' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:24:in `reverse_matches_for' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:11:in `reverse' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/column.rb:117:in `autolink?' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:107:in `links_for_associations' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb:62:in `each' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb:62:in `each' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:106:in `links_for_associations' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:59:in `active_scaffold' /Users/Kiva/Documents/Projet-rpg/jeu/app/controllers/admin/user_controller.rb:11 I search since 2 days but I don't find the problem, can you help me please.

    Read the article

  • uninitialized constant Active Scaffold rails 2.3.5

    - by Kiva
    Hi guy, I update my rails application 2.0.2 to 2.3.5. I use active scaffold for the administration part. I change nothing in my code but a problem is coming with the update. I have a controller 'admin/user_controller' to manage users. Here is the code of the controller: class Admin::UserController < ApplicationController layout 'admin' active_scaffold :user do |config| config.columns.exclude :content, :historique_content, :user_has_objet, :user_has_arme, :user_has_entrainement, :user_has_mission, :mp, :pvp, :user_salt, :tchat, :notoriete_by_pvp, :invitation config.list.columns = [:user_login, :user_niveau, :user_mail, :user_bloc, :user_valide, :group_id] #:user_description, :race, :group, :user_lastvisited, :user_nextaction, :user_combats_gagner, :user_combats_perdu, :user_combats_nul, :user_password, :user_salt, :user_combats, :user_experience, :user_mana, :user_vie config.create.link.page = true config.update.link.page = true config.create.columns.add :password, :password_confirmation config.update.columns.add :password, :password_confirmation config.create.columns.exclude :user_password, :user_salt config.update.columns.exclude :user_password, :user_salt config.list.sorting = {:user_login => 'ASC'} config.subform.columns = [] end end This code hasn't change with the update, but when I go in this page, I got this error: uninitialized constant Users /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in `constantize' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `each' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in `constantize' /Users/Kiva/.gem/ruby/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in `constantize' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:28:in `reverse_matches_for' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:24:in `each' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:24:in `reverse_matches_for' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/extensions/reverse_associations.rb:11:in `reverse' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/column.rb:117:in `autolink?' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:107:in `links_for_associations' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb:62:in `each' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/columns.rb:62:in `each' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:106:in `links_for_associations' /Users/Kiva/Documents/Projet-rpg/jeu/vendor/plugins/active_scaffold/lib/active_scaffold.rb:59:in `active_scaffold' /Users/Kiva/Documents/Projet-rpg/jeu/app/controllers/admin/user_controller.rb:11 I search since 2 days but I don't find the problem, can you help me please.

    Read the article

  • Building a template to auto-scaffold Index views in ASP.NET MVC

    - by DanM
    I'm trying to write an auto-scaffolder for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IQueryable<MyViewModel>) and get back an HTML table that uses the DisplayName attribute for the headings (th elements) and Html.Display(propertyName) for the cells (td elements). Each row should correspond to one item in the collection. Here's what I have so far: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; // Should be generic! var properties = items.First().GetMetadata().Properties .Where(pm => pm.ShowForDisplay && !ViewData.TemplateInfo.Visited(pm)); %> <table> <tr> <% foreach(var property in properties) { %> <th> <%= property.DisplayName %> </th> <% } %> </tr> <% foreach(var item in items) { %> <tr> <% foreach(var property in properties) { %> <td> <%= Html.Display(property.DisplayName) %> // This doesn't work! </td> <% } %> </tr> <% } %> </table> Two problems with this: I'd like it to be generic. So, I'd like to replace var items = (IQueryable<TestProj.ViewModels.TestViewModel>)Model; with var items = (IQueryable<T>)Model; or something to that effect. The <td> elements are not working because the Html in <%= Html.Display(property.DisplayName) %> contains the model for the view, which is a collection of items, not the item itself. Somehow, I need to obtain an HtmlHelper object whose Model property is the current item, but I'm not sure how to do that. How do I solve these two problems?

    Read the article

  • Missing tables on Scaffold Dynamic Data page

    - by Ben Amada
    I created a Linq-to-SQL DBML for the first time. I dragged and dropped all my tables over to the designer. The tables all appear in the designer.cs file. In Global.asax, I also have model.RegisterContext() with the ScaffoldAllTables = true option. The routes are also setup. I can pull up the Scaffolding page, but there's at least one table that is missing that I'm trying to get to show up. This missing table has a relationship with a child table that references it. The child table appears. When viewing data for the child table, the column that references the missing/parent table shows the numeric PK int value, rather than showing the "name". So instead of showing "Cars" it shows 1, and instead of showing "Planes" it shows 2, etc. There's another table in the DB that has the same type of structure as the missing table, and it is correctly appearing in the scaffolded tables. For this missing table, I've tried explicitly adding the ScaffoldTable attribute to no avail. Does anyone know what would cause a table like this to not appear in the list Scaffolded tables? Thanks very much.

    Read the article

  • grails scaffolding broken

    - by damian
    Grails scaffoldin does not work in my grails application. When I go from the main page to the specific controller page it output something like this: Error 500: Servlet: default URI: /myapp/myDomain/list Exception Message: Tag [sortableColumn] is missing required attribute [title] or [titleKey] at /webTestDummyDomain/list:25 Caused by: Error processing GroovyPageView: Tag [sortableColumn] is missing required attribute [title] or [titleKey] at /myDomain/list:25 Class: /myDomain/list At Line: [25] Code Snippet: Code snippet empty. If I try to create a new app scaffold works perfectly. Additional data: Application Status * App version: 0.1 * Grails version: 1.2.2 * JVM version: 1.6.0_20 * Controllers: 11 * Domains: 10 * Services: 19 * Tag Libraries: 26 Installed Plugins * i18n - 1.2.2 * filters - 1.2.2 * logging - 1.2.2 * core - 1.2.2 * tomcat - 1.2.2 * webtest - 2.0.4 * functionalTest - 1.2.7 * yui - 2.7.0.1 * rest - 0.3 * jquery - 1.4.2.1 * bubbling - 2.1.2 * urlMappings - 1.2.2 * groovyPages - 1.2.2 * servlets - 1.2.2 * dataSource - 1.2.2 * controllers - 1.2.2 * codecs - 1.2.2 * jqueryUi - 1.8-SNAPSHOT * grailsUi - 1.2-SNAPSHOT * domainClass - 1.2.2 * mimeTypes - 1.2.2 * scaffolding - 1.2.2 * converters - 1.2.2 * hibernate - 1.2.2 * validation - 1.2.2 * services - 1.2.2 Can you give me any pointer?

    Read the article

  • how to specify a BIGINT in a rails scaffold?

    - by webdestroya
    I am trying to create a model in ruby that uses a BIGINT datatype (as opposed to the INT done by :integer). I have search all over Google, but all I seem to find is "run an SQL statement to alter the table to a BIGINT" - This seems a bit hack-ish to me, so I wanted to know if there was a way to specify a bigint in the ruby system like :big_int or something Any ideas?

    Read the article

  • how to specify a BIGINT in a ruby scaffold?

    - by webdestroya
    I am trying to create a model in ruby that uses a BIGINT datatype (as opposed to the INT done by :integer). I have search all over Google, but all I seem to find is "run an SQL statement to alter the table to a BIGINT" - This seems a bit hack-ish to me, so I wanted to know if there was a way to specify a bigint in the ruby system like :big_int or something Any ideas?

    Read the article

  • Rails: creating a custom data type, to use with generator classes and a bunch of questions related t

    - by Shyam
    Hi, After being productive with Rails for some weeks, I learned some tricks and got some experience with the framework. About 10 days ago, I figured out it is possible to build a custom data type for migrations by adding some code in the Table definition. Also, after learning a bit about floating points (and how evil they are) vs integers, the money gem and other possible solutions, I decided I didn't WANT to use the money gem, but instead try to learn more about programming and finding a solution myself. Some suggestions said that I should be using integers, one for the whole numbers and one for the cents. When playing in script/console, I discovered how easy it is to work with calculations and arrays. But, I am talking to much (and the reason I am, is to give some sufficient background). Right now, while playing with the scaffold generator (yes, I use it, because I like they way I can quickly set up a prototype while I am still researching my objectives), I like to use a DRY method. In my opinion, I should build a custom "object", that can hold two variables (Fixnum), one for the whole, one for the cents. In my big dream, I would be able to do the following: script/generate scaffold Cake name:string description:text cost:mycustom Where mycustom should create two integer columns (one for wholes, one for cents). Right now I could do this by doing: script/generate scaffold Cake name:string description:text cost_w:integer cost_c:integer I had also had an idea that would be creating a "cost model", which would hold two columns of integers and create a cost_id column to my scaffold. But wouldn't that be an extra table that would cause some kind of performance penalty? And wouldn't that be defy the purpose of the Cake model in the first place, because the costs are an attribute of individual Cake entries? The reason why I would want to have such a functionality because I am thinking of having multiple "costs" inside my rails application. Thank you for your feedback, comments and answers! I hope my message got through as understandable, my apologies for incorrect grammar or weird sentences as English is not my native language.

    Read the article

  • Using Ruby on Rails, can a polymorphic database be created in a few steps (with polymorphic associat

    - by Jian Lin
    I thought it could be created in a few steps but it can't yet: rails poly cd poly ruby script/generate scaffold animal name:string obj_type:string obj_id:integer rake:migrate ruby script/generate scaffold human name:string passportNumber:string rake:migrate ruby script/generate scaffold dog name:string registrationNumber:string rake:migrate and now change app/models/animal.rb to: class Animal < ActiveRecord::Base belongs_to :obj, :polymorphic => true end and run ruby script/server and go to http://localhost:3000 I thought on the server then if I create an Michael, Human, J123456 and then Woofie, Dog, L23456 then the database will have entries in the Dogs table and "Humen" or "Humans" table as well as in the Animals table? But only the Animals table has records, Dogs and "Humen" do not for some reason. Is there some steps missing?

    Read the article

  • Inspecting the model in a Rails application

    - by Matt Sherman
    I am learning some Ruby on Rails, and am a newbie. Most of my background is in ASP.net MVC on the back end. As I play with a basic scaffold project, I wonder about this case: you jump into an established Rails project and want to get to know the model. Based on what I have seen so far (again, simple scaffold), the properties for a given class are not immediately revealed. I don't see property accessors on the model classes. I do understand that this is because of the dynamic nature of Ruby and such things are not necessary or even perhaps desirable. Convention over code, I get that. (Am familiar with dynamic concepts, mostly via JS.) But if I am somewhere off in a view, and want to quickly know whether the (eg) Person object has a MiddleName property, how would I find that out? I don't have to go into the migrations, do I?

    Read the article

  • Inspecting the model in a Rails application

    - by Matt Sherman
    I am learning some Ruby on Rails, and am a newbie. Most of my background is in ASP.net MVC on the back end. As I play with a basic scaffold project, I wonder about this case: you jump into an established Rails project and want to get to know the model. Based on what I have seen so far (again, simple scaffold), the properties for a given class are not immediately revealed. I don't see property accessors on the model classes. I do understand that this is because of the dynamic nature of Ruby and such things are not necessary or even perhaps desirable. Convention over code, I get that. (Am familiar with dynamic concepts, mostly via JS.) But if I am somewhere off in a view, and want to quickly know whether the (eg) Person object has a MiddleName property, how would I find that out? I don't have to go into the migrations, do I?

    Read the article

1 2 3 4 5  | Next Page >