Displaying 20 results from an estimated 50000 matches similar to: "Handling specific page editing permissions for members"
2006 Feb 21
7
has_many :through failing to save changes
Hi all,
I''m messing around with has_many, and has_many :through (on edge rails),
using a join model. Branches and Projects join through ProjectsAtBranches.
If I do @branch.projects, I can see the associated projects, and
visa-versa, if I manually put them in the join table.
But I cannot do @branch.projects << Branch.find(blah), or
@branch.projects.clear, and then save the
2005 Jul 28
0
ActiveRecord, computed values, and associations
Is there some sort of good pattern for dealing with computed values with
Rails/ActiveRecord?
A simple example: 3 tables, classes, students, and student_class_records
(habtm style relation but contains a good deal of additional state so is
modeled explicitly)
Something like select the 10 classes with the most students. Easy enough
in SQL. So I''m using a lot of find_by_sql and
2007 Jun 22
0
Using through with habtm
I have two models with an habtm relationship:
Foo has_and_belongs_to_many Bars (and vice-versa, obviously).
Let''s say Bar has_many Bazs (how the heck do you pluralize Baz?).
It would be nice to be able to say that Foo has_many Bazs through =>
Bar, but this does not seem to work.
Am I right, or should it be possible to do this?
The best I have been able to do is this:
bazs =
2010 Jan 27
2
has_many, through with nested models?
First the data model:
class Forum < ActiveRecord::Base
has_many :topics, :dependent => :destroy, :order => ''created_at
desc''
end
class User < ActiveRecord::Base
has_many :topics, :dependent => :destroy
has_many :comments, :dependent => :destroy
has_many :replies, :dependent => :destroy
end
class Topic < ActiveRecord::Base
belongs_to
2007 Jun 08
3
Barplots: Editing the frequency x-axis names
Hi
I have a timeSeries object (X) with monthly returns. I want to display the
returns with a barplot, which I can fix easily. But my problem is labaling
the x-axis, if I use the positions from the timeseries It gets very messy. I
have tried rotating and changing the font size but it doesn't do the trick.
I think the optimal solution for my purpose is too only display every second
or third
2006 Jan 07
4
To Chris Hall - Re: DB Modelling the Rails way - Opinions??
Chris,
Finally got time to fully play with your suggestions. Had to re-code a
bit of stuff but the concept works - just like a bought one :~). Many
thanks for the solution,
Kind Regards,
Eric.
For those curious - here''s what it was about;
On Monday 02 January 2006 02:10, Eric Sloane tried to type something like:
> Hi,
> I''m trying to figure the most efficient way to
2010 Jan 25
0
has_many, :finder_sql, setting attributes
Hi all,
My question is somewhat complicated, but bear with me. My project has a
number of models: User, Program, and Team. Users belong to multiple
Programs. Programs have multiple teams, but Teams belong to one
program. For each Program a User belongs to, he can belong to multiple
Teams. (Think of this in an athletic context where users are athletes,
programs are universities). So my
2011 Apr 06
2
Wish List: has_many :dependent => {}
I am after a nice way to disable (not destroy, delete nor nullify) all
associated records. I''m a hoarder, I don''t want to get rid of anything but I
want to stop records being visible.
I have a disabled boolean in my tables and if I disable the top record in
the association (say the association is 5-6 levels deep), I would like to
cleanly disable its children.
I''ve
2006 Jul 20
0
Getting joined collections on a form
Greetings, I''m looking for suggestions on how to simplify getting customer
addresses on a form:
I''m jumping between controller and view several times; alternating between
rhtml and rjs, in order to display customers and their addresses on an
invoicing form. It''s very messy.
I have a one to many relationship between Customer and Addresses, each
customer has one or more
2006 May 04
2
Testing associations
I have a pretty simple model, articles and users.
class Article
belongs_to :user
end
class User
has_many :articles
end
In my unit tests I want to ensure that the associations work properly.
What''s the best way to do this? The obvious thing to do is a test in
each model.
# user_test.rb
def test_add_post
u = users(:first)
before_articles = u.articles.count
u.articles
2006 Jul 21
0
Selecting customers and addresses in a form (was Getting joined collections on a form)
(Sorry if you have received this twice, I''m having trouble sending mail to
the rails list)
Greetings, I''m looking for suggestions on how to simplify getting customer
addresses on a form:
I''m jumping between controller and view several times; alternating between
rhtml and rjs, in order to display customers and their addresses on an
invoicing form. It''s very
2006 Aug 14
1
What fields_for really for?
Hello everyone!
I have 3 models:
=== 1 ===
class Region < ActiveRecord::Base
has_many :districts
end
=== 2 ===
class District < ActiveRecord::Base
belongs_to :region
has_many :suburbs
end
=== 3 ===
class Suburb < ActiveRecord::Base
belongs_to :district
validates_numericality_of :region_id, :only_integer => true
end
In edit.rhtml for SuburbController I need to specify
2006 Nov 05
0
Forms with associations and collections
Hi
Does anyone have a good pattern for using a sinlge form for a model
with multiple associations including some has_many''s?
For example I have a Property model with a has_one association an
Address model and a has_many association to a Highlight model. I would
like to update these all on the same page however if I render the main
Property form, then use a partial for the address and
2014 Oct 23
2
Permissions For Editing Centos Wiki Pages
Hi,
I want to update some wiki pages such as http://wiki.centos.org/AdditionalResources/Repositories/RPMForge for help to developt Centos project.
Can any one help to the permissions.
Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos-docs/attachments/20141023/ef8f7a0a/attachment-0004.html>
2007 Mar 17
3
guidelines for version specific info on wiki pages
hi Guys,
Just wondering if we should have some guidelines as to how version
specific information should be handled on the wiki ?
One way might be to have a version tag on each page on the top right and
indicate what Versions that page is going to work with. Then in the body
have a Grey bar to indicate version specific info. But this might get a
bit messy.
Any other ideas ?
- KB
--
2008 Mar 13
3
Refreshing a page gives a "stack level too deep" error.
I''m converting our app into restful rails. A couple of my classes
(Resource and Asset) have a has_many relationship with each other -
here''s the routes:
map.resources :assets, :has_many=>[:resources]
map.resources :resources, :has_many=>[:assets]
I''m getting something weird in my view pages. When i go to
/resources/4/assets
it works. I go to the page
2006 Apr 17
0
Pros/cons of doubling up in Self-Referential has_many via :through
Relative newbie so would welcome comments re structure of a
self-referential relationship I''ve got.
It''s started off similar to the Person HABTM friends in the Rails
recipes books (working fine), but I needed to turn the join table into a
full-blown model as I wanted to add attributes to it. Few tricky bits
dealing with the new :through structure and understanding how :scope
2006 Jul 07
0
has_many relation handling
Hello,
please have a look at this:
My tables:
create_table :languages do |t|
t.column :name, :string, :limit => 3
t.column :title, :string, :limit => 30
end
create_table :categories do |t|
t.column :category_id, :integer (3.)
t.column :created_at, :timestamp
t.column :updated_at, :timestamp
end
create_table :categorytranslations, :id
2013 Jul 11
1
Do I Edit the Migration Too to Show the Belongs To
Hi Everyone,
Do I edit the corresponding migration also to show the belongs_to (and the
has_many)? I have a many to many relationship where I am using the
"has_many :through" association. When I place in the individual classes the
''has_many :through'' and the ''belongs_to'' associations, do I also edit the
corresponding migrations to reflect those
2006 Jan 02
5
DB Modelling the Rails way - Opinions??
Hi,
I''m trying to figure the most efficient way to model the following. I
can think of at least two ways to relate the tables but from a
client/server perspective! I''m wondering how to best (and
elegantly)relate them from an AR perspective.
A project has many people,
A person can work on many projects at any time,
A project has many roles,
A role is performed by a person,
A