Displaying 20 results from an estimated 4000 matches similar to: "MVC and Pagination"
2006 May 03
7
Business Logic and where to place with rails
I am having an issue of deciding where I should put the business code
for example the more complex code coming off the controller. Right now,
I am just thinking to put it in the ''lib'' directory and the do something
along these lines:
require_dependency "system_process"
class SystemMessageController < ApplicationController
include SystemProcess
...
...
Where
2006 May 04
22
Should controllers be "smart"?
I''m working on a small project with a friend, and one of the things we
needed to do was send off an email whenever someone signs up an
account. His implementation was pretty simple - throw a
deliver_welcome call inside the controller after the signup. I''m sure
that this is a pretty common thing to do.
The problem, in my mind, was that the app now became tied to two
places -
2006 Sep 06
4
Setting Product Env
When I am using my rails models in my worker class, it appears the
background worker class is always using development no matter what I do.
I set background.yml to production. I even have ENV[''RAILS_ENV''] ||=
''production uncommented in environment.rb. I don''t have the development
db even created on my production box, so not sure where it is getting
development
2006 Apr 07
2
Paginate single items
Hi,
In my blog i display a post. I want to display a link tot he previous
post if there is 1 and a link tot he next post if there is one.
So i have in my controller
def post
@post = Post.find(params[:id])
@post_pages, @posts = paginate :posts, :per_page => 1
render(:layout => false)
end
And the following code in post.rhtml
<% if @post_pages.current.next %>
<%=
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
2008 Mar 31
10
Paginate with Rails 2.0.2 question
Hi,
So I''m using @post_pages, @posts = paginate :posts, :per_page => 10
to paginate.
But I have rails 2.0.2 on my VPS. Now this version of paginate throws
an error. What happened to classic pagination and what is done now?
Thanks,
Ron
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2006 Apr 19
4
RJS replace_html auto-closing tags
I''m using the following RJS template to spit out a div containing a
list of projects:
page.replace_html ''results'', ''<div>''
@projects.each do |p|
page.insert_html :bottom, ''results'', p.name + "<br/>"
end
page.insert_html :bottom, ''searchresults'', ''</div>''
page.show
2006 Mar 16
4
problems with latest and greatest ?
I just did the following:
1) checked out latest rails from svn.
2) built project using the /bin/rails with the latest rails binary.
3) did a "rake freeze_edge" within the project
Now, script/server is failing
===========================
./script/../config/../vendor/rails/railties/lib/commands/../tasks/tmp.rake:1:
undefined method `namespace'' for #<Object:0x401ce970>
2006 Apr 19
2
Credit Card Processing / Merchant Account
Hi All,
Has anyone implemented a credit card processing / merchant account
system using Rails? I know that there is a ''payment'' gem that is
supposed to integrate with the Authorize.net gateway, but I''m wondering
if that is the best (and only) solution out there. Are there any other
recommended solutions from Rails programmers out there?
Thanks in advance for the
2006 Jun 15
1
Paginating a .find
how exactly would I apply paginate to a .find I have:
@posts = Post.find(:all,
:conditions => [ ''(title) OR (body) LIKE ?'', ''%''
+ params[:query] + ''%''],
:order => ''end_date'')
How would I go about paginating the uoputed list? Something like 10 on a
page.
--
Posted via
2006 Jun 14
4
Using now() to determine what should be displayed
I''m trying to create a paginated list that will take note of the
"end_date" field in my table. This is what I have:
@post_pages, @posts = paginate(:posts, :per_page => 10, :order_by =>
''end_date'')
in the controller. And for the view:
<h1>Posts ending soon</h1>
<ul><% for post in @posts do %>
<strong>Post Title:
2006 Mar 09
2
Edge Rails Webrick Problem
Can anyone help me with the following error while trying to start
webrick on edge rails? Was working last week, but recent updates are
causing the following error. Is there something in my existing rails
dir that I might need to update?
Thanks in advance for any help.
./script/../config/../vendor/rails/activesupport/lib/active_support/core
_ext/kernel/agnostics.rb:7:in ``'': Exec
2006 Jan 03
5
Pagination Question
Hi -
I''ve just started working with Rails, having come from a Cold Fusion
background. I''m curious how best to deal with a huge result set. For
example, I''m building an app that contains users. I''ve used
scaffolding to setup my initial pages for CRUD operations on users.
All that is great. The problem is, I''m going to end up with 1000+
users in
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 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/.
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 Mar 14
5
Controller Naming Question
Is it possible to have controllers named the following?
/admin
/admin/user
If not, is there some way to get it to work with routes?
I want to have some actions at the url /admin/<action> and some at
/admin/user/<action> (obviously in admin/user controller).
Thanks!!!
2010 Jul 30
1
pagination
Pagination
I am using an old tutorial which is tripping me right up as I have the
latest version of rails installed. I''m persisting as I think I''m
learning a little bit more about how RoR works. However after installing
the scaffolding plug-in to fix an earlier problem I now have a problem
with the pagination. I have followed this workaround:
2006 Aug 03
5
Strategy for persisting row filter variables in pagination?
I have my list view filtering rows shown within the table <tr> tags like
most of the introductory tutorials do. As I''m adding a few dozen entries
I''m noticing the standard scaffolding pagination doesn''t pick up the
number of rows from the filter since it is not being passed the number
of rows returned within the scope of the filter statement.
>From a
2006 Feb 13
1
another simple question: per_page in pagination
Hi,
Why can''t I use a variable to specify the :per_page attribute when using
the most basic form of pagination? (if I use a hardcode number, it
runs) What did I do? Thx.
My code:
def list_orders
page_size = 20
...
order_pages, @orders = paginate(:orders, :per_page => page_size)
end
My Errors:
undefined method `>'' for false:FalseClass
RAILS_ROOT: