Displaying 20 results from an estimated 6000 matches similar to: "Flash message not shown after redirected by verify"
2008 Mar 07
2
Trouble using RESTful helper
Hi,
I am trying to get into this REST thing, I have a nested resource
whith the following route:
ActionController::Routing::Routes.draw do |map|
map.resources :members
map.resources :clubs do |club|
club.resources :members
end
map.connect '':controller/:action/:id''
map.connect '':controller/:action/:id.:format''
end
Everything worked ok for this
2008 Mar 03
2
how can i know type of attribute with active record
Hello,
In my database, I have a table "products" with attributes :
- id
- title ->string
- desc -> text
I use active record, but I don''t know why recover the type of this
attribute with active record?
I try attributes_before_type_cast but I don''t see the type
Can you help me?
Excuse for my english (I''am a young student french)
--
Posted via
2009 Dec 02
14
root_path and root_url undefined
Hi all,
I''ve just started working on another RoR project after a couple of months
away. I''m having trouble with named routes, specifically root_*
In previous apps I''ve used root_path and root_url without any problems, but
in this project (2.3.2 - the same as my last project where I used it) it
comes up undefined.
I''ve double and triple checking my routes.rb,
2007 Nov 01
1
List of Nth removed associated objects.
Given the following..
Foo has_many :bars
Bar has_many ::widgets
Widget has_many :gadgets
Gadget has_many :parts
All of the following are now possible...
@foo.bars
@bar.widgets
@part.gadget.widget.bar.foo
However, I can''t just do the opposite of that last one...
@foo.bars.widgets.gadgets.parts
and get a full list of every Part associated with @foo.
I know there''s several
2009 Dec 27
5
Difficulties in understanding Rail-Plugins in depth
Hi,
i try to understand how plugins work in detail.
Often you see stuff like:
class Post < ActiveRecord::Base
acts_as_commentable
end
I wonder what''s happen all there.
What kind of language-feature is behind this call "acts_as_commentable" ?
In my opinion you need some kind of extend or include to extend the
functionality of a model. And exactly this is which i found
2008 Mar 06
2
GateKeeper, Model Level Permissions Management
I''m pleased to announce the official release of "GateKeeper".
GateKeeper is a Rails plugin that provides easy to use methods to
declare access permissions to instances of ActiveRecord classes at the
model level. Permissions may be based on either a user''s roles (such as
Admin, Moderator, etc) or on associations with other models.
In most simple and straight forward
2008 Mar 20
2
link_to_remote confirm dialog title
Is there any way to set the confirmation dialog title when using
link_to_remote with the :confirm option?
In Firefox the dialog works fine but the title is:
"The page at http://localhost:3000 says:"
It would be nice if I could set that to something meaningful.
Any information is appreciated,
Rick
--
Posted via http://www.ruby-forum.com/.
2005 Nov 23
1
How to set flash for before_filter :login_system ?
Hello all,
I''m using Login Generator ACL
System<http://wiki.rubyonrails.com/rails/pages/LoginGeneratorACLSystem>
I want to know if there is a way to set the flash(:notice) before the
before_filter is processed so that the flash() is available on my login page
?
IE: "regular" user changes URL to an "admin" page, then I want the login''s
flash to say
2007 Jun 27
5
Filter Ordering in Edge Rails (Rev 7143)
Filter chaining appears to behave in differently than Rails 1.2.x. It
seems that I''m getting a lot of errors along the lines of:
ActionController::ActionControllerError: filter
#<ActionController::Filters::ClassMethods::BeforeFilterProxy:0x322f468
@filter=#<ActionController::Filters::ClassMethods::SymbolFilter:
0x322f4b8 @filter=:login_required>> was in the wrong place!
2008 Feb 01
4
How to sanitize _before_ going into the database?
I use a call to the sanitize method every time I render some user
input, but it would be much nicer if I could clean it up once before
putting it into the database and avoid having to call the (relatively
expensive) sanitize every time I render a page.
My first thought was to just add something like:
def message=(x)
self[:message]=sanitize(x)
end
However, the sanitize helper cannot be called
2006 May 17
3
Help mixin in class methods
Starting to feel more confident and code is DRYing up nicely, but I''ve
hit a brick wall here and hoping someone can help me.
I''ve got a module, TrustRanking, which extends a number of model''s
instance methods, and I want to extend their class methods too, but I
can seem to work out how to do it.
Simply including the module from the class works a treat for the
2006 Jan 10
5
problems overriding module with plugin
Hi I am trying to create a plug-in to fix the error in the rails core
produced by the multiple delete on a HABTM relationship. I have
confirmed that my plug-in is being included into the base during
runtime however the code does not seem to be overridding the base
class.
module ActiveRecord
module Associations
module ClassMethods
def has_and_belongs_to_many(association_id, options =
2005 Sep 11
3
Extending ActiveRecord::Base
Hey everyone,
I''m interested in extending ActiveRecord::Base. I have a special
"easier" find function that I want to include in all classes.
How can I include this in all classes?
Can I just create a model object that does something like this:
class ExtendedAR < ActiveRecord::Base
def self.special_find
...
end
end
and then all my other classes
2008 Jan 13
2
module_eval and scope question
When trying to understand a piece of code from the Ruby-On-Rails
framework,
I found that I''m still lacking knowledge about scope issues in Ruby.
Here is a
stripped down version of the code I''m trying to understand (in case
you
happen to use Rails: This is from file scaffolding.rb):
module ActionController
module Scaffolding
..
module ClassMethods
def
2007 Jan 17
1
include ClassMethods in plugins
Why is that in so many plugins I see people using (including
acts_as_taggable by DHH):
# init.rb
ActiveRecord::Base.send(:include, ActiveRecord::Acts::SomeModule)
# lib/some_module.rb
module ActiveRecord
module Acts
module SomeModule
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def acts_as_something
# code
2006 May 02
2
flash not shown
I am using the following code (inspired by one of the books) to check if
the user''s session should have timed out.
# Check to see if the user has been inactive for longer than the
# expiry period. If they have, reset the session.
def check_timeout
if session[:expires_at] != nil
@time_left = (session[:expires_at] - Time.now).to_i
unless @time_left > 0
2007 May 30
2
Bug? Filter chain halted as [#<ActionController::Filters::..
OK so I''ve been trying to follow the tutorial here:
http://rails.homelinux.org/
When I simply do "scaffold: category" in the controller.rb, everything
works fine. BUT after I generate the controllers and other files using
scaffold AS A SCRIPT (script/generate scaffold categories), DESTROY (or
DELETE) does not work for any record in a table. This is the error I
got:
Processing
2006 Feb 23
5
layouts
I created a controller called reports, for which I didn''t have any model
or tables.
I wanted to use a menu/layout structure similar to all my other
models/controllers and added a layout named reports which then gives me
the menu/layout structure but is also now part of all my reports.
That isn''t gonna work so I renamed reports.rhtml to reports_forms.rhtml
(still inside my
2006 Apr 18
4
Mixin variables
I''ve created an access control module that I''m including in several
different controllers. Everything works fine, but I want to allow each
controller to override the default login page with something like this:
set_login_pages :secure => ''my_login''
In my module, I''ve set up the set_login_pages method like this:
def self.included(base)
2006 Jun 07
1
validates_presence_of in a mixed-in module?
Anyone got any idea of how to use built-in validation methods in a
mixed-in module.
What I''ve got at the moment is each class that needs ranking methods
includes [the module] Ranking. Then the module Ranking has a bunch of
instance methods and a submodule ClassMethods. The ClassMethods in this
are mixed in to the class with self.included. So far so good.
But I want the module to