[Rails] Re: About before_* callbacks

2009-03-07 Thread CFC
Okay, I seeThanks, Matt. On Fri, Mar 6, 2009 at 12:31 AM, Matt Jones wrote: > > > > On Mar 4, 11:13 pm, CFC wrote: > > Hi > > I have an problem about before_* callbacks. > > > > I have a model named: Event > > And I don't want anyone to destroy or update any records in Event > > model. > [snip]

[Rails] Re: About before_* callbacks

2009-03-05 Thread Matt Jones
On Mar 4, 11:13 pm, CFC wrote: > Hi > I have an problem about before_* callbacks. > > I have a model named: Event > And I don't want anyone to destroy or update any records in Event > model. [snip] > But, it won't create any events but the auto_increment will be > increment. > Do anybody knows

[Rails] Re: About before_* callbacks

2009-03-05 Thread CFC
I think the only way to do this is write the code in destroy & update action :( If one callback return false, then it will interrupt any actions after the callback. :( Thank you, Fred and Robert :D On Thu, Mar 5, 2009 at 5:35 PM, Frederick Cheung wrote: > > > > On Mar 5, 6:11 am, CFC wrote: >

[Rails] Re: About before_* callbacks

2009-03-05 Thread Frederick Cheung
On Mar 5, 6:11 am, CFC wrote: > If I set read-only to the model, then I can't create any event > anymore :( > I just want to block anyone to update/destroy records, but I need to > create records :) > Check whether new_record? is true before returning false from your callback ? Fred > On 3月5日,

[Rails] Re: About before_* callbacks

2009-03-04 Thread CFC
If I set read-only to the model, then I can't create any event anymore :( I just want to block anyone to update/destroy records, but I need to create records :) On 3月5日, 下午1時12分, Robert Walker wrote: > Billy Hsu wrote: > > I have a model named: Event > > And I don't want anyone to destroy or upd

[Rails] Re: About before_* callbacks

2009-03-04 Thread Robert Walker
Billy Hsu wrote: > I have a model named: Event > And I don't want anyone to destroy or update any records in Event > model. > So: How about instead making the model read-only: http://ariejan.net/2008/08/17/activerecord-read-only-models/ -- Posted via http://www.ruby-forum.com/. --~--~-