Displaying 20 results from an estimated 10000 matches similar to: "MVC design good/bad"
2005 Jun 27
9
FK constraints overrated?
Hello folks,
I use to think that a relational databases without foreign keys
constraints enforced strictly by the RDBMS were no good, piece of crap,
data junk.
However, I''ve also learned the hard way that FKs constraints imposes
serious difficulties when moving data around, specially between
different DBs, or for loading test data or for upgrading DBs schemas, or
for porting DBs
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
2005 Mar 08
19
find_by_sql ON STEROID possible?
find_by_sql BREAKS THE OOP BEAUTY and perhaps we can solve that.
NAMING CONVENTIONS can perhaps make find_by_sql much more clever.
lets imagine that relation:
publishers <- books <-> authors_books <-> authors -> universities (can''t find
something else than university for that last association :) )
imagine we want to fetch every book and every associated
2007 May 24
4
design patterns
Hi everyone
I''m Maximiliano Guzenski from Brazil and I am programing on ruby on rails
only a couple of months.
I read a lot of books and articles about it but I could not clarify some
doubts about design patterns:
1) Is it really good put some sql command on controller? because all
articles that I see use sql into controllers, like:
# my controller
@categories = Category.find
2006 Aug 11
3
General architechture / MVC question
Hi all,
A newbie with Ruby on Rails - and programming in general - I''m working
on a few Flash and PHP projects as well. Partly to make my work more
efficient, partly to gain a better understanding of system architecture
/ design patterns, I''ve been trying to use the MVC pattern in
database-backed Flash / Actionscript development as well.
I think / hope that I''m
2006 Mar 26
7
MVC Design
Hello I have been using LAMP for the last 6 years and i am now finally
making the choice to move over to RoR. This MVC stuff is all very new to
me. As i have no trouble understanding ruby code... or any code for that
matter.. my challange comes in getting my head around the MVC stuff. Is
there any demos articles that you guys have seen that takes a site or a
business breif and explains where
2010 Jun 21
14
Controllers, what? why?
Hi,
I am starting to learn rails and I went through the guide and a couple
of tutorials. Even though I understand controllers or at least I can
use them I can''t see yet the whole picture.
Why do you need several controllers for a single application? If a
controller is just a class whose methods interface with models and
views, why not have a single controller for the whole application?
2006 Feb 06
4
Basic MVC in RoR question
Ok, Here''s my controller:
def create
trainingplan = Trainingplan.createplan(@params[:startdate],
@params[:enddate], @params[:hoursperweek], @params[:programtype])
end
My model is:
class Trainingplan <ActiveRecord::Base
def self.createplan(stardate, enddate, hoursperweek, programtype)
stardate = startdate
enddate = enddate
hoursperweek = hoursperweek
programtype
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 Jan 17
9
using "find" when you have 2 has_many relations
An Account has_many Websites which in turn has_many WebsiteDomains
Now I can of course do this:
@domains = Account.find(1).websites.find(1).website_domains.find(:all)
To get all the domains for Account with id 1 and Website with id 1.
I would like to do something like this though:
@domains =
Account.find(1).websites.find(:all).website_domains.find(:all)
IE, get ALL domains for all websites in
2005 Jan 13
10
Program logic behind Ruby On Rails
Hi, I''m a newbie in both Ruby and Ruby on Rails. I finished the Ruby on
Rail Tutorial on Todo list and it was great. But, now I''m trying to
understand the logic behind it, that is something that is not obvious on
how each one of them ties together.
Is there a flowchart that shows how the inner working of Ruby on Rails?
In another words, let''s suppose we consider the
2006 Mar 28
5
combining two models in one controller/view "set"
I''m going to take another stab at this question (my first one received
no replies):
I have two models:
Author
has_many: books
Book
has_one: author
I have two tables:
authors
id
...
books
id
author_id
...
I let the scaffolding fly and it created the CRUD goodness for each
model, as expected.
However, I want to have only one view/controller "set" for both
models; when I
2006 Mar 02
7
The no-framework PHP MVC framework
"The no-framework PHP MVC framework"
http://toys.lerdorf.com/index.php?url=archives/38-The-no-framework-PHP-MVC-framework.html
Yuck! What spaghetti code. I can''t ever imagine preferring that to
Rails.
Joe
--
Posted via http://www.ruby-forum.com/.
2005 Dec 20
12
How to model "Expense Report" in Rails MVC
1st: I am a newbie to Rails & to pure OO.
Q: I want to use rails for creating a "master-detail" form. page layout
will allow users to type in an "expense report header" and as many
"expense report lines" as they need to. I understand how to wrap the
final submit action using "transaction" to ensure the inserts to the
database happen within the same
2006 Jun 08
3
MVC and Pagination
Just wondering how to best integrate with pagination and still stick to
MVC...
Say I have a Post model that has a published attribute. I want to show
all the recent published posts on a page.
My first instinct is to create a method in the Post model called recent
that does the find with proper conditions and order, but the problem I
have is how do I use that with pagination (which definitely
2006 Apr 23
8
Shattered, the rails-based MVC game development framework
if( you_want_to_make_a_game_with_ruby ) {
http://shattered.hastilymade.com/shattered_ruby.png
http://shattered.hastilymade.com/shattered_ruby.png
http://shattered.hastilymade.com/shattered_ruby.png
Shattered 0.3 has just been released! Inspired by Ruby on Rails, Shattered
is doing for game development what rails has done for web development.
Get it here !
We''ve made this
2006 Jul 31
5
can someone explain RoR MVC from a C++ or Java perspective?
is a model similiar to a class? and active record is similiar to how
Java classes inherit from Object?
View is nothing more than an output of a model with HTML?
Controller is basically the Main part of the program?
--
Posted via http://www.ruby-forum.com/.
2008 Sep 23
3
calling save in after_create hook
Scenario:
I''m creating an image file upload service for my web site.
As well as saving the actual file I also need to create a database
record for the file.
I would like to name the file after the record id, but I also need to
save some attributes of the image (width/height/mime_type etc) which I
can''t discover until after the file is created.
The Problem:
1) The id is not
2006 Jun 02
4
Ruby on Rails Performance question
I''m wondering if this is a typical thing.
What I''m doing is getting about 5000+ records from a database and
displaying all of it on a page.
I''ve used the benchmark helper to benchmark the views for that page
and that takes about 25 seconds to render that view. Is this pretty
typical?
What I''m doing is using find_by_sql to get all the values that I need
from
2006 Jun 22
2
MVC architecture
Hi,
I want to creat a GUI accessible via the web with ruby to interface some
matlab implementation ... so I extended Ruby with C++ and then matlab :)
that works perfectly: I have finaly a Ruby class I can call whenever I
want to lunch my matlab algorithm ;)
the point is now I have to make the GUI in HTML with Rubby on rails and
Damn! I don''t get how works the MVC architecture in Ruby