Displaying 20 results from an estimated 1000 matches similar to: "conditions on model"
2005 Dec 19
6
how to do security??
hey, i have maded some security in my website based on
http://www.chaconforcongress.com/accounts/login
Here they work with users, roles and persmission, and they check it like this,
user.has_permission(permission).
I have extended this to: users and groups with roles and permissions.
With permissions like "view records","edit records","delete records",...
def
2006 Apr 10
0
Rails form error message oddness...
To get error messages for my form to show up I have to repeat myself in
the controller so that the render of the view including error messages
show up.
-------------------------
My Controller:
-------------------------
class ClientsController < ApplicationController
#---- index --------------------------------
def index
list
render :action => ''list''
end
2005 Dec 23
1
pagination problem
hey,
i have this problem
in the database i have 32 records
and the sql filtered 4 records
#getting the callerid records depending on the given paramaters and paginate it
@callerid_pages = Paginator.new self, CallerId.count, 10, @params[''page'']
@caller_ids = CallerId.find(:all, :conditions =>["geotags.firm_id = ? ",
@firm_id], :order => " geotags.address1
2005 Dec 01
0
problem with options_from_collection_for_select() need id not name
hey,
i need a select list with a id property and not name, cuz i just ajax with this
list and it checks on id not name
if @request.post? #called by ajax
if @request.xml_http_request? #called by ajax
@geotag_id=params[:geotag_id].nil? ? -2 : params[:geotag_id]
else
@geotag_id=params[:geotag][:id].blank? ? -1:params[:geotag][:id]
end
else
@geotag_id = -1
end
i use this
@geotags =
2006 Jan 03
0
has_and_belongs_to_many include problem
hey,
i have users who are in groups, and i have a search form, where i can search on
group, user lastname, and user firstname.
All this is also with pagination.
these are my models
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
in my controller i do this
THIS works (but in need pagination)
@users2
2005 Sep 28
0
search engine, select the selected option
hey, i have a search engine that let u search on the an employee
how can i make that if the user select "employee1" , on the next page
"employee1" is selected
this is my code (rhtml)
<tr>
<td><label for="employee_id">Employee</label></td>
<td colspan="3"><%= select "employee", "id",
2005 Dec 15
3
How to delete a record
hey,
i my database i have users and groups, each user can get in different groups
my db structure:
table groups: id, name, basegroup, firm_id
table users: id, firstname, lastname, email
table groups_users: group_id, user_id
my relation is a many to many:
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many
2006 Jun 08
9
find :order =>
Hi,
I have the following find statment
@client_pages, @clients = paginate :clients, :per_page => 20, :order =>
"organisation_id, surname"
currently im ordering by organisation_id however I need to order by the
field in the organisation table organisations.name
how can this be done?
Thanks
Scott
--
Posted via http://www.ruby-forum.com/.
2012 Mar 24
3
How to compute within-group mean and sd?
Hi, I want to run something like
SELECT firm_id, count(*), mean(value), sd(value)
FROM table
GROUP BY firm_id;
But I have to write a for loop like
for ( id in unique(table$firm_id ) {
print(paste( id, mean(table[firm_id == id, "value"]) ))
}
Is there any way to do it easier? Thanks :)
Best,
Reeyarn Lee
[[alternative HTML version deleted]]
2006 May 23
1
Re: Wierd pagination problem - Unknown options:
> Unfortunately I still get the same error. Here is my code now (the
> commented line works):
>
> def list
> @upload_pages, @uploads = paginate(:uploads, :per_page =>
> 20, :order
> => ''id'')
> # @upload_pages, @uploads = paginate(:uploads, :per_page => 20)
> end
You may have an older version, try using the order_by clause
2009 Apr 05
2
Prohibit removing INBOX
Hello list,
I'm using dovecot 1.1.11 and I'm going to prohibit users to remove
their INBOX and some other directories in the mailbox root.
I used Access Control Lists (http://wiki.dovecot.org/ACL) to do this:
protocol imap {
mail_plugins = acl
}
plugin {
# With global ACLs in /etc/dovecot/acls/ directory:
acl = vfile:/etc/dovecot/acls
}
/etc/dovecot/acls/.DEFAULT:
owner
2006 Aug 07
4
Problem with Pagination
Hi Guys,
I am trying to paginate the results from a search. When I use actual
constants in the search conditions, it works fine:
def query
@k2_result_pages, @k2_results = paginate (:k2_results,
:conditions => [''e_date >= ? AND
e_date <= ?'', ''2006-07-12'', ''2006-08-12''],
2006 Mar 31
2
Silly question
Hi there,
I know this is be a very minor issue, but considering
@users = User.find :all, :order => ''name''
_AND_
@user_pages, @users = paginate :user, :order_by => ''name''
by simplicity, shouldn''t the symbols :order and :order_by
be the same or both to both cases ?
I stumbled on them a couple of times yet :)
Thanks,
Andre
--
2005 Dec 14
0
how to get these records in has_and_belongs_to_many relation
hey,
i my database i have users and groups, each user can get in different groups
my db structure:
table groups: id, name, basegroup, firm_id
table users: id, firstname, lastname, email
table groups_users: group_id, users_id
my relation is a many to many:
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many
2015 Sep 08
0
Multiple vacation
Op 8-9-2015 om 17:15 schreef Michele Locati:
> I'm using Dovecot 2.2.9 and I'm having problems configuring multiple
> vacation actions.
> The problem is that I'd like to have two different senders and two
> different messages, selecting the correct case by the recipient email
> address.
> I mean, if someone writes me to my email address "to-address1 at
2006 Aug 02
3
newbie question, adding conditions to collection of sql objs
I have:
@pictures=@c.pictures
How do I add limit and order_by conditions. I have tried the following:
@c.pictures.find_all(:limit=>5)
@c.pictures, :limit=>5
@c.pictures :limit=>5
None of these work.
--
Posted via http://www.ruby-forum.com/.
2015 Sep 08
3
Multiple vacation
Hi all
I'm using Dovecot 2.2.9 and I'm having problems configuring multiple
vacation actions.
The problem is that I'd like to have two different senders and two
different messages, selecting the correct case by the recipient email
address.
I mean, if someone writes me to my email address "to-address1 at example.com"
I'd like to answer from "from-address1 at
2006 May 27
0
Typo 1055 created_at Vs. published_at
[Couldn''t post this to the Typo forum, hope it''s Ok here :-)]
Before I go off and create a Typo ticket, I''d like to know if anyone
else is experiencing this and what there thoughts might be on the
subject?
In Typo 1055, if you use the admin interface and change the published
date for an article, you will get "post not found", when you click on
the article
2008 May 07
1
Assigning to the foreign key on a belongs_to association
I''ve encountered what seems like an odd omission in the behaviour of
belongs_to associations: if you assign to the foreign key attribute,
it doesn''t update the associated object (or mark a previously loaded
one as stale) until you explicitly save or reload it.
Let''s say we have a Company model, which belongs_to :city :
>> torchbox =
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: