Displaying 20 results from an estimated 30000 matches similar to: "Cascading views?"
2006 Aug 03
5
DRYing up the view
Hello everyone!
I have generic views for CRUD operations
For example I render(''shared/list'') from controller
shared/list.rhtml
...
<% for item in @list %>
<tr class="<%= cycle ''list-line-odd'', ''list-line-even'' %>">
<%= render :partial => ''item'', :locals => { :item => item } %>
2006 Jul 27
0
CRUD, REST and associations
Let''s say I have the model class Reader and Magazine, connected by join
model Subscription. It looks something like this
class Reader < ActiveRecord::Base
has_many :subscriptions, :dependent => :delete_all
has_many :magazines, :through => :subscriptions
validates_presence_of :name
end
class Magazine < ActiveRecord::Base
has_many :subscriptions, :dependent =>
2006 Aug 01
5
MVC question
Should I create a separate controller for each model or should I use 1
controller for all models?
Having 1 "admin" controller for all backend stuff seems logic to me, but
when I scaffold it rather makes 1 controller per model.
I''m fairly new to the MVC pattern, so what''s the prefered way of doing
it?
I''m also wondering if the API is up to date? When
2006 Jul 22
3
How to use variables in your layout views?
Let''s say I wanted to find 3 products from my database and put them
in the layouts/application.rhtml view. Where do I find these 3
products? Do I just do it in application.rhtml?
<% for product in Product.find(:all, :limit => 3) %>
Because I was under the impression that you really don''t want to do
this in your views. You should do this in your controllers and
2006 Aug 02
3
controller methods for app/views/A/B.rhtml
If I want to call A/B, can I call a corresponding controller action for
it?
Like with app/views/A.rhtml, I can it will call the method A in the
controller file.
But with A/B.rhtml, I cant do def A/B.
--
Posted via http://www.ruby-forum.com/.
2006 Jul 28
4
Validation Reflection plugin
The validation reflection plugin adds three things
(1) Reflective access to validations
- ModelClass.reflect_on_all_validations
- ModelClass.reflect_on_validations_for(:property)
(2) It provides "declarative" methods for defining
validations based on database metadata
- validates_presence_of_mandatory_content_columns
- validates_lengths_of_string_attributes
-
2009 Jul 28
0
[PATCH 3/5] Storage views patched for glusterfs drop down as one the Storage Pools
---
src/app/views/storage/_form.rhtml | 2 ++
src/app/views/storage/_list.rhtml | 4 ++++
src/app/views/storage/_list_volumes.rhtml | 4 ++++
src/app/views/storage/show.rhtml | 4 ++++
.../views/storage_volume/_new_volume_form.rhtml | 1 +
src/app/views/storage_volume/show.rhtml | 8 ++++++++
6 files
2009 Jul 09
0
[PATCH 3/5 ovirt-server] Storage views patched for glusterfs drop down as one the Storage Pools
---
src/app/views/storage/_form.rhtml | 2 ++
src/app/views/storage/_list.rhtml | 4 ++++
src/app/views/storage/_list_volumes.rhtml | 4 ++++
src/app/views/storage/show.rhtml | 4 ++++
.../views/storage_volume/_new_volume_form.rhtml | 1 +
src/app/views/storage_volume/show.rhtml | 8 ++++++++
6 files
2006 May 04
1
Instance or local vars for field helpers in partial template
I''m getting confused.
If I have a view (.rhtml), I can use a field helper like:
<%= text_field :mymodel, :attribute %>
This uses the value from @mymodel.attribute
Now, if I am rendering a template normally (i.e. not partial), I would
expect @mymodel to be a model object defined as an instance variable in
the controller.
However, if I am rendering a partial template, I
2006 Apr 27
2
problematic admin/views
ok, i have a pretty almost finished (frontend) blog, i have defined an
admin zone with authentication to add content, now im getting trouble
with the views for the controllers in the admin zone, here you can see
my file structure:
http://img284.imageshack.us/my.php?image=tmpviews6oq.gif
and my admin controllers like this:
controllers/admin/admin_controller.rb
class Admin::AdminController
2006 Mar 29
0
placing specific views within a subdirectory?
Can anyone show me how to go about placing specific views within a directory?
ie:
controllers/hello.rb
views/hello/english/world.rhtml
views/hello/english/people.rhtml
views/hello/spanish/mundo.rhtml
views/hello/spanish/gente.rhtml
instead of the usual:
controllers/hello.rb
views/hello/world.rhtml
views/hello/mundo.rhtml
hello.rb currently contains the basic methods:
class ChartsController
2007 Sep 22
2
Dynamic view - is it possible at all?
I have the following question. It sounds weird, but still.
We all have app/views/say.rhtml or any other template for the view. It
can include of course instructions in <% %>
So the question is next -- is it possible to use .rhtml as a view
which we just uploaded?
I.e. user uploads his own .rhtml, controller saves it in the database,
and shows the view using it.
Is it possible at all?
2006 Aug 03
1
storing views in subdirectories?
I''d like to organize my project structure by storing certain related
views into a subdirectory. For example, I have a bunch of interviews
which each contain their own view (the client doesn''t want them
content managed, or put in the database). Right now I have them
placed inside "app/views/site/interview_one.rhtml",
"app/views/site/interview_two.rhtml", etc.
2006 Jun 24
3
Staying DRY -- can views share partials?
Let''s say I have a "main" controller/view and a "sub" controller/view.
If I have defined a partial in "main" for the site header
(_site_header.rhtml) can I share it with "sub" or does "sub" have to
duplicate it, use a symbolic link to the file, or convert the cool
partial into an ugly helper?
It would be nice to have a shared placed
2006 Mar 21
0
theme_generator custom application views
I''ve installed the theme generator but am having trouble getting custom
application views working. Let''s say I define a action called ''test'' in
the controller.
class PageController < ApplicationController
theme ''bluebird''
layout ''default''
def test
end
end
Now if I define a rhtml page called
2007 Dec 09
2
What to test for views?
When you guys test views, what are you testing? Do you just test that
all the form fields exist in a new.rhtml, that all form fields are
filled in an edit.rhtml, and that all the proper columns are are shown
in a index.rhtml page, or is there something more that should be tested?
Thanks.
--
Posted via http://www.ruby-forum.com/.
2006 Jul 20
2
Why is my rxml view being wrapped by the rhtml template in views/layouts?
Why is my rxml view being wrapped by the rhtml template in views/
layouts?
I was experimenting with REST, I had a nice little test program with
one table: ''resources''. Here''s what the show method looks like:
def show
@resource = Resource.find(params[:id])
respond_to do |accepts|
accepts.html
accepts.xml
end
end
I have a show.rhtml
2009 Jan 14
0
Separating views by locale?
I''m thinking this has to be a common question, but thus far I haven''t
found it, maybe somebody can point me in the right direction.
If I''ve got a controller Foo, and a page views/foo/index.rhtml, and I
want to handle multiple languages, I''m thinking that one way to go would
be to create views/foo/en/index.rhtml, views/foo/fr/index.rhtml, ... and
so on for each
2006 Jul 22
4
Accessing the controller name in your views?
I need to know what controller and action the user is currently in
to do various things in my layouts/application.rhtml file. Isn''t
there is a better way than:
<% if params[:controller] == "whatever" && params[:action] ==
"whatever" %>some html<% end %>
I know in the controllers you can just use controller_name, but that
is not provided
2005 Sep 13
12
PDF views?
I know there''s wiki page on generating PDF[*], but that''s not really
what I want. I don''t need to create arbitrary PDF. What I''d like to do
is create PDF templates and fill in the blanks. Roughly, I''m looking
for functionality akin to the mail merge feature of word processors,
including conditional and repeated elements, say, table rows.
Michael