Thanks,
I've followed your advice (created a maxed_out_adverts?) method in the
user model. Works a treat. While I was at it I added a
User.max_allowed_adverts column in my DB. I'm quite pleased with myself.
However I think the adverts_controller could defo do with a critical eye
being cast
Anyone critique that controller - I'd be most gateful.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to
As yo explain this problem, you could just check the number of adverts the
user has in the add function. Something like this pseudo code
def add
adverts = User.adverts
if adverts.length 3
flash too many adverts
redirect back
else
all is normal and the user can add adverts
Aha ! didn't think of this, looks like I've overcomplicated things - of
course !
But what do you mean by the add action ? I don't have one.
Do you mean the new action in the adverts controller or maybe the create
action in the adverts controller or actually a new add action ?
bb
--
Posted
Yes, the action in your adverts controller to create new adverts.
I usually call these add, not very restful I know.
Trausti
On Thu, Aug 6, 2009 at 11:44 AM, bingo bob rails-mailing-l...@andreas-s.net
wrote:
Aha ! didn't think of this, looks like I've overcomplicated things - of
course !
OK, but the New action or the Create ?
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to
When a user wants to add an advert, what action does he call first ?
Trausti
On Thu, Aug 6, 2009 at 11:53 AM, bingo bob rails-mailing-l...@andreas-s.net
wrote:
OK, but the New action or the Create ?
--
Posted via http://www.ruby-forum.com/.
New it is then!
and thanks, that's working a treat. Imagine this is more simple than my
previously over-engineered idea.
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
On Aug 6, 6:23 am, bingo bob rails-mailing-l...@andreas-s.net wrote:
New it is then!
and thanks, that's working a treat. Imagine this is more simple than my
previously over-engineered idea.
--
Posted viahttp://www.ruby-forum.com/.
And then when the user POSTs directly to your create
Ok, I'm sold - I'll put it in the model - user model I take it?
What's the maxed_adverts? method look like then ? and how do i call it
from the create action in the adverts_controller ?
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You
On Aug 6, 3:30 pm, bingo bob rails-mailing-l...@andreas-s.net wrote:
Ok, I'm sold - I'll put it in the model - user model I take it?
What's the maxed_adverts? method look like then ? and how do i call it
from the create action in the adverts_controller ?
--
Posted
11 matches
Mail list logo