Displaying 20 results from an estimated 40000 matches similar to: "Multi-Model Forms"
2008 Jan 17
2
Forms, database, and yes I'm new
I have a quick question on a problem of mine.
I''ve done the ONLamp tutorial with scaffolding a recipe etc, and honesly
I didn''t get really any wiser. So I decided to try it out on my own
without scaffolding.
However. Now I''m stuck with my edit-form. I need to update a row with
old text in the ''pres'' column in the table called
2006 Feb 10
0
Update two models that have belongs_to relationship
I have model Program and model PointOfContact. Program belongs to
PointOfContact. There is a form to update values, which shows attributes
from both models on one form. What is the best way to update the models
with one call. I tried this and it did not work
Controller code:
@program_old = Program.find(params[:id])
@program = Program.new(params[:program])
@program.id =
2006 Mar 23
2
Question About Scaffolding for My First Rails App
When using ruby to generate scaffolding, is there an easy way to add
features that would be useful for keeping track of has_many and
belongs_to relations? For example, suppose I have the following:
Users
Sites
Pages
Modules
Each user has many pages, each site has many pages, each page has many
modules, and also the belongs_to relation holds in the opposite order.
I''m using the
2010 Apr 16
4
DEEEEPLY nested
Hello,
i have "a" has many "b", "b" has many "c", and "c" has many "d"
Now... "d" is a user model, and I have a current_user helper method
defined.
If i navigate to an "a" show page, how can I make sure that my
current_user ("d") is part of that "a"? meaning how can i make sure
that
2009 May 08
1
filter_parameter_logging for multi model forms
Hi all,
I have a multi model form setup in the classic Ryan Bates Complex
forms style (railscasts.com/episodes/73) for my signup page.
The two models in this are the Account model and the User model and
this structure cannot be changed right now. The User model has
password and password_conf attributes which are, unfortunately, taken
alongwith the rest of the User''s attributes into an
2010 Apr 03
2
Newsletter 1002, Spanish version
Hello, I have just finished my Spanish translation of the last
Newsletter. As I have no edit rights to the proper zone, I have
written it into my own personal page
http://wiki.centos.org/EduardoGrosclaude. Please some elder member of
the familiy snip it off from there and hang it where it belongs. :)
I have not involved myself in prior proofreading, so this may be a bit
off. May I slip in a small
2008 Jan 30
2
Stubbing controller methods vs model methods
I had an error that I couldn''t figure out, then when writing up a
question for the forum I figured it out. The thing is I don''t
understand why the change that was made works and why what existed
before didn''t.
Here is the initial post when I had the error:
----------------------------------
In the controllers/application.rb file
I have a method that finds the account
2011 Mar 10
4
Multi-model forms
Hi guys, I''m new to ruby and rails and I''m working on multi model
forms, specifically 3. I''m using this http://guides.rubyonrails.org/getting_started.html
as a start, and its got a 2 Model example but I cant seem to get the
last one working.
These are my models:
Country name:string code:string (has_one :address)
Address address_line1:string
2006 Feb 10
4
Handling a relationship between users and newsletter subcriptions.
Hey Everyone!
I have a newsletter system that contains a multitude of different
newsletters. In this case three but the system allows the user to
add more. Every user can be subscribed to any amount of given
newsletters. So what I did was I created a user model, newsletter
model, and subscription model.
The subscription model belongs to one user and one newsletter.
However,
2006 Jan 16
16
acts_as_authenticated current_user in a model?
What do I need to do to be able to use an acts_as_authenticated
current_user in a model?
Is there some sort of include or require I can do some where that would
allow this?
**********************************************************
Here is what I am trying to do:
**********************************************************
class Setting < ActiveRecord::Base
before_create :created_by_user #
2010 Apr 02
6
App_Controller and partial issues with has_many through
I have a User model, a Post model, and an Interest model:
User has_many posts through interests
User has_many interests, dependent destroy
Post has_many users through interests
has_many interests, dependent destroy
Post has_many interests
Interest belongs to Post
Interest belongs to User
Application_Controller is as follows:
class ApplicationController < ActionController::Base
before_filter
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
Hi all,
After many days of struggling, I have a multi-model form with ajax
elements more or less working, but I''m hitting a wall with a few bugs
that I can''t figure out. Guidance would be very much appreciated.
I''m using the Ryan Bates technique from Advanced Rails recipes to
dynamically add and remove elements on a multi-model form.
2010 May 31
2
has_many and has_and_belongs_to conflit
Hi,
I have 2 models: User and Article.
I have this relationship:
* User has many articles (and Article belongs to user)
* User has and belongs to many articles (and Article habtm users)
But this is tricky because of: current_user.articles ...this can return
articles thanks to *has_many* and *has_and_belongs_to* relations. So
there''s a collision.
How can I ask articles thanks
2008 Mar 07
0
ActiveRecordStore: cleanup & avoiding duplication
Hi,
I''m using ActiveRecordStore to track user sessions.
I''ve used as a base the next sources:
- http://blog.levicole.com/articles/category/ror
- http://matt-beedle.com/2006/12/13/rails-how-to-find-out-who-is-online/
- http://www.williambharding.com/blog/?p=99
This is what I currently do:
IN SESSION CONTROLLER
def create
self.current_user = User.authenticate(params[:login],
2010 Sep 16
3
Resyful authenticatio current_user in model
Hi,
I am using Restful authentication for user authentication.
I want the current logged in user object in my model property.rb
Problem is current_user is not working on model.
How can I fix this I need that?
Please help me out.
Thanks,
Mike
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"
2008 Feb 04
2
attachment_fu and form_tag for multiple models?
hi, i''ve got a page where i''m trying to save the user''s profile
information and an image of the user, but i''m having trouble with using
attachment_fu and the form_tag method.
now i know attachment_fu isn''t designed for form_tag but am really
hoping someone has a solution for this as frankly i''m stumped.
here''s the form_tag part in
2007 Aug 21
2
using restful_authentication current_user inside controller specs
I''m using restful_authentication in my app and I have the before filters in
my application rhtml:
before_filter :login_required
around_filter :set_timezone
around_filter :catch_errors
Currently I have them commented out while rspec''in but I''ll need to add them
in my specs.
def create
@ticket = Ticket.new(params[:ticket])
@ticket.user = current_user
if
2006 Jun 26
0
How to limit access to model objects based on role?
Hi all,
I want to limit access to model objects based on the role of the logged in
user. It seemed the most blunt way of doing this would be make copies of
each controller which accessed the models and use one of the access control
systems out there to limit access to the controllers. However, with 9
different controllers this seems like a terrible choice.
Here''s what I''ve
2008 May 06
1
check_friendship method only returning value of last pair
Hello, I''m new to facebooker and ruby, so not sure if the issue I am
having is due to my misunderstanding or a bug in facebooker plugin.
Here is what I have:
def show
@current_user ||= facebook_session.user
@member ||= params[:id].to_s==@current_user.id.to_s ?
@current_user : Facebooker::User.new(params[:id])
#for each of current_user''s friends, check if they are
2010 Aug 09
0
Devise :current_password validations and checking (how???)
Hi Guys,
In my devise applications in Rails 3, I created a separate form under my
SettingsController class of which it handles the ''Change Password'' of
the User Model, so i can manipulate the current_user in the
SettingsController.
Now, I followed the set-up in the Devise/Views on how to update the form
using ''Change password'' and either way update User for