similar to: before_save messing up

Displaying 20 results from an estimated 300 matches similar to: "before_save messing up"

2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
Newbie learning Rails. I''m currently on Chp9 here: http://railstutorial.org/chapters/sign-in-sign-out#top At the end of the tutorial, rails is erroring (see below). being new to Rails and after having checked the tutorial... How do you resolve this kind of error. It''s saying current_user is not defined, and it is supposed to be defined with/Sites/sample_app/app/helpers/
2011 Jul 30
22
Question about Helpers
Studying the RoR 3 Tutorial book by Michael Hartl and on page 345 there''s the code inside the SessionsHelper: _________________________________________________________ module SessionsHelper def sign_in(user) cookies.permanent.signed[:remember_token] = [user.id, user.sault] self.current_user = user end end __________________________________________________________ What is the purpose
2011 Feb 05
4
Questions about Chapter 9: Sign in, Sign out of RoR Tutorial | Learn Rails by Example
Hello Finished reading chapter 9 and im a little bit confused. 1. In the tutorial, Modules are used instead of creating a Model and working in a class inside a module , like in authenticating passwords. Wouldn''t that be possible? Or is it unnecessary since we''re not messing with a database in terms of storing data? 2. what is the difference between session[:remember_token] =
2012 Jul 17
24
Static Pages from Railcast
Hi everyone, I need several pages to be static but also modify when requested. I try following the railcast from Ryan at http://railscasts.com/episodes/117-semi-static-pages?view=comments Here what I have done!! rails g scaffold Pages name:string permanentlink:string title:string author:string access_level:string is_published:boolean meta_description:string meta_keyword:string
2011 Jun 12
3
Problem with undefined variable current_user
Hi everyone, I''m working through the tutorial at the following link and attempting to customise/adapt the lessons for my own slightly different application. Link: Ruby on Rails Tutorial: Learn Rails by Example | Ruby on Rails 3 Tutorial book and screencasts | by Michael Hartl <http://ruby.railstutorial.org/ruby-on-rails-tutorial-book> I''m currently trying to work
2008 Jun 20
15
before_save model callback rspec testing
hi all, i''m learning rspec and i can''t figure out how to test if a callback is executed in a model. my model code is: class User < ActiveRecord::Base before_save :encrypt_password ... def encrypt(password) self.class.encrypt(password, salt) end thanks a lot, cs. -- Posted via http://www.ruby-forum.com/.
2010 Jul 06
4
Simple routing problem
I''ve got the following in config\routes.rb: map.resources :users In app\views\shared\_menu.erb, I''ve got: Please sign in <%= link_to "here", :controller=>"user", :action=>"sign_in" -%> In app\controllers\users_controller.rb def sign_in end When I run the application, I crash with: Routing Error No route matches
2013 Aug 22
1
duplicated log lines in console
my app seems to be running fine in dev mode ( Rails4, Devise, OAuth2 , Doorkeeper ) but looking at the console , I can see all log lines duplicated .... where should I look for any tricky bug or missing param ?anyway to get more info on what''s happening ? thanks a lot for feedback (ruby-2.0.0@rails40)$ rails server -p 4000 => Booting WEBrick => Rails 4.0.0 application starting
2008 Mar 13
22
Specifing methods in a steps_for block
Hey list, I''m refactoring some much-used functionality into a common_steps step group. Methods like this are in there: steps_for :common do Given "a number of existing $types?" do |type| @initial_item_count = type.singularize.classify.constantize.count end When "the user adds an invalid $type" do |type| post
2007 Oct 04
1
Cookies in RSpec
So how do you work with cookies properly in rspec now? I noticed in the docs that it mentions session, assigns, and flash, but nothing of cookie. I''m using edge rails so I''m concerned about changes to the cookie mechanisms. I need to assign values into the cookie (a remember token for restful authentication) so that I can have it log in by cookie. here is my spec
2012 Jul 19
6
Rendering Partial
I am a bit confused when coming from layout and partials. To start of I have a file called application.html.erb which has my layout such has follow <html> <head> <body> <%= render ''layouts/footer'' %> </body </html> This call a new file _footer.html.erb This file his has follow <footer class="footer"> <nav> <%=
2011 Aug 02
2
ror +auth_token + c#
HI, i have to change a desktop app written in c# to post and get some data to/from a rails app. the railsapp uses devise. what im doing right now is: 1) pull up sign_in page 2) parse 1) for auth_token 3) post username+ pwd & auth_token 3.1) if 3 ok > goto 4) 4) post json data that works all good, except that i do not provide auth_token in step4 , but a) rails is still accepting my data.
2011 Aug 02
2
ror +auth_token + c#
HI, i have to change a desktop app written in c# to post and get some data to/from a rails app. the railsapp uses devise. what im doing right now is: 1) pull up sign_in page 2) parse 1) for auth_token 3) post username+ pwd & auth_token 3.1) if 3 ok > goto 4) 4) post json data that works all good, except that i do not provide auth_token in step4 , but a) rails is still accepting my data.
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
Hi, I just installed Rails 2.0.2 [root@mymachine easyx]# ruby --version ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux] [root@mymachine easyrx]# gem install rails --include-dependencies Need to update 16 gems from http://gems.rubyforge.org ................ complete Successfully installed rails-2.0.2 [root@remandev easyrx]# But I''m getting this error in my restful_authentication
2008 Jun 29
3
Working around/with Restful Authentication
I''m using Restful Authentication, and the code to create a user is pretty straight forward - there is a before_save action and a before_create action: before_save :encrypt_password before_create :make_activation_code But for some reason when I try to create a user programmatically in the controller like this: User.new(:email =>
2007 Dec 16
2
restful_authentication: update of users' attributes on every page load upon 'Remember me' being enabled?
Hello there, I just noticed a kinda weird thing: if users log in with the ''Remember Me'' option enabled, their records in the db get updated everytime the user reloads a page, because apparently restful_authentication''s code updates the remember_token_expires_at & remember_token attributes for each page load (not only once on the actual login (from cookie).
2013 Mar 21
3
Single page application authentication and authorization
How would I do authentication and authorization in a single page application running with Rails as the backend? Any recommendations? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to
2012 Oct 06
1
how to scope the /auth/:provider/callback , using OmniAuth for users and members
I have two separate groups of people authenticated w Devise , but in this case I cannot used the Devise embedded OmniAuth support. So i am using directly the OmniAuth gem. Initialized w : Rails.configuration.middleware.use OmniAuth::Builder do ..provider :twitter, .. end It''s running fine , but I have an issue with the callback route mapping : I tried match
2011 Feb 24
1
concurrent users.
If I have: class ApplicationController < ActionController::Base protect_from_forgery before_filter RubyCAS::Filter before_filter :fetch_operator include SessionsHelper private def fetch_operator @operator ||= session[:cas_user] && Operator.find_by_uid(session[:cas_user]) log_out if @operator.nil? end end @operator is available for all controllers of my
2008 Dec 11
2
restful_authentication errors
When I run [code] script/generate authenticated user --include-activation [/ code] it seems to work at first, but then it reports: " The name ''SessionsHelper'' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again " I''ve heard that having both acts_as_authenticated and