What is the best approach for using one form to create two different
models and join them? I'm working with a HABTM relationship. For
example a project HABTM services and vice versa.
I've tried using accepts_nested_attributes_for which seems to work when
I'm creating a project and using a servic
I am trying to created a nested form with a HABTM association and I am
unable to find an approach that works for all cases.
What I am trying to achieve is a Project form that can:
1. Create a new project and create new company to associate with it
- This works perfectly
2. Create a new project
Playing around with my new model I feel like I've made a good decision
with the modeling.
If I were to make an ER diagram, I've effectively made a sandwich with
Projects on the top, all my supporting models and relationships in the
middle, and People and Accounts on the bottom. I've linked Acc
Thanks for the responses. I think my application probably matches the
Basecamp style of account handling. I think for simplicity I can keep
everything project-centric and use the accounts to show who owns which
projects
@account.projects
@account.projects.companies
@account.projects.people
@a
I am creating an application that involves:
Accounts
People (Many people belong to one account)
..and various other models...
Companies
Projects
Services
...
I'm trying to find what the best way is to denote that any of the
non-account related model records belong to an account. So using the
def self.up
execute "UPDATE posts SET state_id = (SELECT states.id FROM states,
zips WHERE posts.zip_id = zips.id AND states.abbreviation = zips.state)"
end
def self.down
Post.find(:all).each { |post| post.update_attribute :state_id, nil }
end
--
Posted via http://www.ruby-forum
I found out about execute statements, but then I also learned that
sqlite3 doesn't support this syntax. I'm not sure what to do. This
seems like a common need.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rai
I'm trying to do an update that requires table joins but I can't find
any examples of updates beyond simple attribute value assignments. I
have a select statement like this:
SELECT title, state, name FROM posts, zips, states WHERE posts.zip_id =
zips.id AND states.abbreviation = zips.state;
The
>
> Dave, can you post your model file?
>
Thanks Conrad. I found a workaround and got some pointers on how to
build the links. I'll report back on the link approach tomorrow.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Gr
Hey everyone,
This is my first post to the forums. I'm trying to add an 'approve' and
'disapprove' link for new content to my website. I thought I should
just add two links to the "show" view to trigger the "approve" and
"disapprove" method. Clicking these links doesn't have any effect in
the D
10 matches
Mail list logo