Displaying 20 results from an estimated 8000 matches similar to: "Column with dynamic db type"
2012 May 03
3
inheritance with rails.
Hello.
I''ve read about examples on inheritance with rails.
Here is an example:
http://juixe.com/techknow/index.php/2006/06/03/rails-single-table-inheritance/
The way is to add a type field in the table.
So if I have an Animal class with an attribute name, I can inherit
from this class like:
Dog < Animal, Cat < Animal, and so on.
With the type field in the table I can do Dog.all,
2012 May 10
6
Is it suitable using STI?
I have problems on a simple design problem.
I have many companies. Each company have one or more commercial activity.
Activities types are: ecommerce, local unit, television, automatic
vending machines, and so on.
Company may have one or more ecommerce activity or one or more local
unit activity, one ormore vending machines, etc.
How can I model this scenario?
Company has_many ecommerce has_many
2006 Apr 04
2
Syntax Error in find()
Maybe I misunderstand the parameterization of find(), I am getting this
syntax error for
<% @choices = Choic
e.find(:all, :conditions => "question_id" = question.id, :order =>
"order") %>
---- ERROR LOG ----
ActionView::TemplateError (compile error
../config/../app/views/admin/test/show.rhtml:37: syntax error
_erbout.concat " "; @choices =
2006 Jul 01
4
Radio_button in loop problem
Hi all, I can''t figure out why my radio_buttons won''t reflect the values
stored in my database. I read through some of the previous posts -- is
it true that they don''t work with integers?
This is the code I''m using:
<% for question in @survey.questions %>
<%= debug question %>
<%= radio_button ( "question", :question_id,
2006 Jan 04
4
many to many link table compound primary key explosion
Hi,
I have a many-to-many relationship between two tables, questions and
answers. My MySQL schema for the link table creates a primary key from
the two fields to prevent duplicate records. When I add the same answer
to the same question more than once, rails attempts to create a
duplicate record and explodes with a MySQL error:
MysqlError: Duplicate entry ''3-3'' for key 1:
2006 Jan 19
8
Passing variables across forms
I''ve been reading my Agile Dev book over and over again, but I can''t
wrap my head around how to do this. There''s a question and answer
portion site of my site. You begin the process by adding a question to
the database. After that, the program should redirect you straight to
adding an answer for that question. The problem is, I don''t know how to
keep
2006 Mar 08
0
Unit tests dynamic finders
Hi all,
I am having a problem with unit tests. Whenever I have a dependency
between two models (B depends on A) deleting A should also delete B.
This is simple with the dependent parameter in the model file of A. But
when I write a test the dependency seems to work, I can''t find the
answer with id 1 anymore(Answer.find(1)). But I appearently _do_ find it
with
2006 Jun 04
4
Multiple checkboxes
Please could someone suggest what might be wrong here. In my view I''m
displaying a series of check boxes and when the form is submitted I want
the controller to iterate over the values and contatenate them all into
a string "1" if the box was checked and "0" if it wasn''t.
I''m new to Ruby and Rails and I can''t seem to get any values out of
2006 Apr 02
5
adding primary_key to join table using migrations
Hi list,
My tag_question_user join table is not currently a full-blown model. It
doesn''t have a primary key - just tag_id, question_id, and user_id.
I now want to add a primary key to this model (because I want to add a
"description" column as well so users can describe the tag.
I''m not sure how to add this using migrations.
Here is what I have:
class AddNotesToTags
2018 Jan 11
3
sshfp/ldns still having issues in 7.6
> I replaced the ldns code with getdns. Works fine for more than a year now.
>
I am interested in how you did that. Would you mind sharing your procedure?
> I don't think anybody cares. I tried to tell people. But that had no
> effect.
>
There certainly is not as much talk about it as I would expect there to be.
2006 Aug 07
1
Unable to page.replace_html from rjs
I am having problems updating a div defined in a partial using both
Element.update and page.replace_html in an rjs. I can put a
link_to_remote in the partial using an :update, and the div updates
fine. Does anyone have any idea why this might be happening?
In the partial:
<div><div>
.
.
<div id="question_<%=question.id%>_error"></div>
.
(if a
2006 Dec 20
6
select lists - DB best practice
Hey guys,
I''m putting together an app with user profiles, and each user will be
able to update a section called ''quick stats''.
This will involve lots of drop down lists with options like ''hair
colour'', ''height'', ''Location'' etc etc.
The way I m thinking about doing it is to create new table for each
group of options
2006 Mar 10
0
Multiple radio buttons for defining multiple objects?
Hi, I''ve been working on a multiple choice Question/Answer system. The
response object (analagous to a lineitem) has a question_id, user_id,
and the actual response. What''s a good way of making a form with
multiple response objects which are created from the radio_button
helper?
Right now I''ve got the following code:
2011 Apr 21
0
Get data from 2 tables
Hi, i have 4 tables: questions, answers, users, and inquiries
(relationship)
def index
question_id = params[:id].to_i
question = Question.find(question_id)
@answers = question.answers
respond_to do |format|
format.ext_json { render :json => @answers.to_ext_json(:class =>
Answer) }
end
end
I have several scaffold in extjs, when I click on row, i get
2012 Oct 06
0
rails 3.2 question/answer with a through table
I have a person has many questions through person_questions. I have an
extra column in the join table for the answer. The section below works for
a new submit but when I edit I get 3 each with the first 2 of each selected
tand the third not so I get 6 check boxes some selected some not. Is there
a way to get this to work properly os just the questions in the db show up
once each with the
2010 Jan 25
3
Dynamic attributes!
I want to create a general model ''Product'' that I will be able to
store several attributes in it.
For example the attributes
:id
:name
:description
are pretty stantard. So each product will have this attributes.
However, I wanted to know if it is possible to create dynamic
attributes.
In the case of a cell phone device I might want to store the IMEI of
the phone, this
2006 Mar 19
3
Can''t add data during migration if column is called "type"
Hi
I''m new to Rails. This is my first application and I''m trying to set
up a schema I''ve hand-crafted as a migration.
Does anybody know why this...
# deposit_types
create_table :deposit_types do |table|
table.column :type_code, :string, :limit => 20, :null => false
table.column :description, :string, :limit => 50, :null => false
2006 Jun 02
7
Unit Tests crashing out for a table without an ID
I''m having problems unit testing my model- I have a kind of quiz
functionality user table and a question table and a
user_question_response table that contains the id for the user, the id
for the question and the user''s response. The user_question_response has
it''s own model belongs_to/has_many with users and questions and it works
fine in the actual application but
2006 Mar 28
1
Rails noob db questions
Hi, I''m trying to get my head around rails, but the documentation seems
sparse at best (and manuals.rubyonrails.com is unreachable from my location
for whatever reason). I''m trying to figure out a few things:
1) The documentation for the magicfields mentions using datetimes instead of
timestamps, which pgsql doesn''t appear to support. What''s the answer in this
2009 Feb 27
5
Polymorphic association..explain the extra query ?
Can anyone explain to me the sql query done in the last step :
http://pastie.org/402200
--
Arpit Jain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group,