similar to: Ugggh..another recipes question

Displaying 20 results from an estimated 1000 matches similar to: "Ugggh..another recipes question"

2006 Aug 07
8
Rails Recipes question - authenticating users
Didn''t think I''d be back so quick with another question but here goes: In this recipe for the signin or login (as I call it) there are these two lines if the user authenticates correctly: session[:user] = user.id redirect_to :action => session[:intended_action], :controller => session[:intended_controller] So I''m not seeing anything in the way of an explanation
2006 Jul 07
13
Rails Recipes Book: Authentication
Hi, The user/login management system in Chapter 31: Authenticating Your Users and Chapter 32: Authorizing Users with Roles of Chad Fowler''s Rails Recipes looks reasonable and adequate. However, when I ran the Chapter 31 code, I get the following error: Username or password invalid And I am not even given the chance to sign in; that is, the signin form does not appear at all. Has
2006 Jun 30
8
before_filter: nil vs. true vs. false
Folks, My understanding of how filters work is that I should return true if everything is ok and false if not. How does the filter below work then (from the Rails Recipies book)? It would return nil if there''s a user in the session. Does nil count as true? before_filter :check_authentication def check_authentication unless session[:user] session[:intended_action] =
2006 Apr 21
1
Catch authentication result from a model in a controller
Im still following the authorization recipe from the book, now all works fine but im getting trouble in how handle the model authorization result, if the user and pass are correct, it goes to a welcome screen(admin.rhtml) but if wrong the model prints a message in an ugly exception like page "usr and pass not correct", i want to redirect the user to the login
2006 Jul 09
1
Accessing the name of a controller''s module?
If I''m redirecting to a log in page, and saving the controller and action name in the session hash, how do I also save the controller module? After the log in is completed, I can''t redirect back to the originally directed page because it''s in a different controller module. For the controller action name I can use the ActionController instance method controller_name(),
2006 Aug 13
3
Render nothing; go nowhere
I am building an application that requires a C++ program to access the Rails web application using POST. Now, I just added user authentication to the mix and it has made things more interesting. I''m using basic authentication as shown in the AWDWR and Rails Recipes books. I can now get my C++ program to submit the user credentials to the login/login page. All I want the login page
2006 Aug 07
8
Login form question
I''m using Rails Recipes to create a login form but instead of username and password, my setup is firstname, lastname, password. I seemed to be gramatically challenged and not sure how to set up the parameter list. Can anyone offer up a suggestion. The book shows the method starting like: if request.post? user = User.find(:first, :conditions => [''username = ?'' ,
2006 Aug 12
7
Redirect back to last page?
I have a few pages where a user may do something (add tags, login, etc) and I would like to redirect them back to the last page they were at before calling that action. Is there an easy way to do this? -- Posted via http://www.ruby-forum.com/.
2006 Apr 27
7
Role Based Authorization recipe implementation?
i got the rails recipes book, i have now an auth system for users without problems, now i want to made a role based acces for my app, im following the "Role Based Authorization" recipe of the book but i cant make it to work even when the tables created and correctly added data manually definig the roles and rights. als i dont know how to define a right for use all the actions in a
2006 Aug 01
0
How to retrieve :web when redirecting to an Instiki page?
Hello, I am currently working on implementing some authentification code onto Instiki (0.11.0). I am encountering a problem in this situation : When I try to access say http:/localhost:2500/orz/show/Test , where orz is an instiki web name, I am redirected to my signin form screen (which is what I want) but then upon signing in I get the following message: No url can be generated for the hash
2006 Jul 02
3
2 before_filters, only want one to render something
I have two before_filters for a few of my controllers. They are running my own methods authorize and admin_authorize. authorize is called on just about every action to make sure that a user is logged in. admin_authorize is called on about 80% of the actions and is used to make sure that a user is an administrator. If a user tries to access an admin_authorize protected action without being
2006 Mar 13
7
Problem with params
I''ve got a User model, which holds the following (excerpt): def try_to_authenticate User.authenticate(self.username, self.password) end .. private def self.hash_password(password) Digest::SHA1.hexdigest(password) end def self.authenticate(username, password) @user = User.find(:all, :conditions => ["username = ? AND password = ?",
2006 Jun 04
5
filter function with parameter
Hi! I want to add a function with a static paramter ("2" in the example) to a filter, but somehow Rails seems to be looking for another syntax. before_filter :check_quantity(2), :only => [:show] doesn''t work. What''s the right way to do this? Thanks a lot! -- Posted via http://www.ruby-forum.com/.
2006 May 19
0
No luck with multiple before_filters
I''ve got these two lines set up in my controller before_filter :check_authentication before_filter :check_max_hands, :only => [ :play ] Here''s the corresponding code for each def check_authentication unless session[:user] and authorize?(session[:user]) session[:intended_action] = request.request_uri redirect_to :controller => ''user'',
2006 May 16
2
before_filter and the application controller
Hi there, I''m having a bit of an issue with my before_filter. I know that the filters put in the application.rb controller are global for all the controllers. In my application filter I''d like to allow access to the RSS feed method in a ''member'' controller and skip the login checks that the before_filters are currently performing. In my application my filters
2007 Nov 06
10
Test case for file import
Hi Friends, I need to write the testcase for fileimport. Pls give me any idea -- Posted via http://www.ruby-forum.com/.
2006 Aug 14
2
ajax - layout problem.
Hi guys Here is my problem... Using Ajax to update a div with link_to_remote. Problem is I have a layout defined in my class, so, the div gets the layout when I call the method, how di I tell a method to ingore the layout? Cheers. Pieter. -------------- next part -------------- An HTML attachment was scrubbed... URL:
2008 Jan 19
5
"should_not ==" vs "should !="
describe "should_not == vs. should !=" it do 5.should_not == 6 end # passes it do 5.should != 6 end # fails end # I''m running the rspec 1.1.2 gem with the corresponding Textmate bundle # The second failure surprises me. # Is != not supported? # I''d like to hear what you all think. -------------- next part -------------- An HTML attachment was
2007 Nov 01
8
Specifying mixins
Hi folks, Can anyone share some accumulated wisdom about the best way to spec mixins in general, and (Jamis Buck-style) ActiveRecord "concerns" in particular? The standard situation here is that there''s a bunch of functionality, related by concept if not by implementation, that one wants to inherit in many different classes (e.g. ActiveRecord models) without having to
2007 Jan 20
2
Conditional pluralize without the number
Hi. Assume you have an array of person names. I want to generate results in my view that look like this: Abby is your friend or Abby, Bob, and Carol are your friends. So I''d like to say: <%= friends.to_sentence %> <%= pluralize(friends.count, "is") %> your <%= pluralize(friends.count, "friend") %> But because pluralize puts in the