[Rails] Re: password recovery

2013-11-18 Thread Yilia W.
You can even reset windows password while forgot it. The tool you need to handle it is a Windows Password Recovery software. The one ever helped me for Windows 8 Password recovery tool is this one: http://windows8password.com/ It is simple to handle with powerful functions. Once you need to reset

Re: [Rails] Adding role's field to users

2013-11-18 Thread Walter Lee Davis
Okay, try this: @user = User.new(params[:user].permit(:id, :email, :password, :password_confirmation, :roles)) And if that doesn't do it, then I need to see the raw parameters from your form submission (they will be in your console). Walter On Nov 18, 2013, at 6:00 PM, Phillip wrote: > J

Re: [Rails] Adding role's field to users

2013-11-18 Thread Phillip
Just the users table, "role_mask" the one we want? Here is the users from schema.rb create_table "users", force: true do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token"

Re: [Rails] Adding role's field to users

2013-11-18 Thread Walter Lee Davis
Okay, so now you know that strong parameters is the problem. Go into your schema, copy the entire table definition, and paste it here. This will be easy to fix, just have to see what the actual column name is that you need to whitelist. Don't just leave your controller like this, you are not sa

Re: [Rails] Adding role's field to users

2013-11-18 Thread Phillip
Yes! That works. Thanks Walter. (code now...) def create @user = User.new(params[:user].permit!) On Monday, November 18, 2013 10:30:42 PM UTC, Walter Lee Davis wrote: > > Okay, try this (just to see if it saves at all): > > params[:user].permit! > > That turns off strong parameters

Re: [Rails] Adding role's field to users

2013-11-18 Thread Walter Lee Davis
Okay, try this (just to see if it saves at all): params[:user].permit! That turns off strong parameters entirely, so let's see if your value is getting saved. Walter On Nov 18, 2013, at 4:41 PM, Phillip wrote: > Ah yes, in console I have a line(when creating a user) saying > > Un

Re: [Rails] Adding role's field to users

2013-11-18 Thread Phillip
Ah yes, in console I have a line(when creating a user) saying Unpermitted parameters: password_confirmation, roles I tried... def create @user = User.new(params[:user].permit(:id, :email, :password, :roles_mask)) ...etc... and... def create @user = User.new(params[:user].permit(

Re: [Rails] Adding role's field to users

2013-11-18 Thread Walter Lee Davis
Also, watch your console as you update, and see if there's a warning about illegal attributes not being saved. Walter On Nov 18, 2013, at 4:04 PM, Walter Lee Davis wrote: > Aha. You have a method called roles, but you're storing this in roles_mask? > Which is a string? You should try adding ro

Re: [Rails] Adding role's field to users

2013-11-18 Thread Walter Lee Davis
Aha. You have a method called roles, but you're storing this in roles_mask? Which is a string? You should try adding roles_mask in the strong parameters, I think. Walter On Nov 18, 2013, at 3:50 PM, Phillip wrote: > Hi Walter, > > Thanks for reply. > > Yes I have added in roles, but perhaps

[Rails] Re: Adding role's field to users

2013-11-18 Thread Phillip
Hi Walter, Thanks for reply. Yes I have added in roles, but perhaps I am doing it wrong? Here is my users controller for creating and updating... def create @user = User.new(params[:user].permit(:email, :password, :roles)) # authorize! :manage, @users respond_to do |format|

Re: [Rails] Adding role's field to users

2013-11-18 Thread Walter Lee Davis
On Nov 18, 2013, at 2:03 PM, Phillip wrote: > Hi, > > (Using Rails 4.0.1, Ruby 1.9.3, latest devise and cancan gems. sqlite db for > local development) Just a guess here -- have you updated your strong parameters declaration in the users_controller to include the roles field? Walter > > I

[Rails] Adding role's field to users

2013-11-18 Thread Phillip
Hi, (Using Rails 4.0.1, Ruby 1.9.3, latest devise and cancan gems. sqlite db for local development) I am a rookie, setting up website and was adding roles(using cancan gem) to my users table. Everything works great, except when I select a role for a user it is not getting saved. The user gets

Re: [Rails] Phonegap + Rails to render the views. How does Facebook Connect work then?

2013-11-18 Thread Dave Sims
One solution might be to hand off authentication to a native control, use the native FB SDK to authenticate and get the token, and then back to the PhoneGap webview. I've used this hybrid approach with Rails and PhoneGap, and it's been a decent compromise. Use Rails for what it does well, but lever

[Rails] Re: wrong number of arguements (1 for 0) on ActiveRecord::Base#send

2013-11-18 Thread zatz zatz
Alright, I had a big brain fart with this one. I was confusing the syntax with define_method. It doesn't work because it's calling model.content('some content'). What I need is model.content = 'some content'. So the correct invocation would be model.send('content=', 'some content'). Sorry for

[Rails] wrong number of arguements (1 for 0) on ActiveRecord::Base#send

2013-11-18 Thread zatz zatz
So I'm not exactly using Rails, but just ActiveRecord. Though I felt this would be more appropriate in the Rails forum than the general Ruby forum. I'm working on an app that interacts with databases, without having a database of its own. I have a class called Modeller, and a Modeller#retrieve_mo

[Rails] Phonegap + Rails to render the views. How does Facebook Connect work then?

2013-11-18 Thread Fai Wong
Hi everyone, I'm learning Phonegap and stumbled upon this solution which demonstrated that views can be dynamically rendered through Rails hosted on Heroku: - http://stackoverflow.com/questions/11713997/using-phonegap-as-a-native-container-for-a-rails-3-app It seems to be a good solution, but t

[Rails] Re: Hook into Exception Chain

2013-11-18 Thread sol
Thanks a lot! That's useful On Saturday, 16 November 2013 22:36:35 UTC+1, Frederick Cheung wrote: > > > > On Friday, November 15, 2013 10:26:10 AM UTC, sol wrote: >> >> I've used the above approach now >> >> However, this only works for controller actions. >> I've got some cronjobs in the project

Re: [Rails] Restful Routing and restful versus non-restful routes

2013-11-18 Thread Colin Law
On 18 November 2013 09:29, Srdjan Cengic wrote: > [snip] > Question 1 > > Second requirement for route to be restful is that action corresponding to > route must "play by restful rules" in another word, > for example a GET should not leave side-effects on the server, but just > retrieve data. > S

[Rails] Restful routing, restful versus non-restful routes

2013-11-18 Thread Srdjan Cengic
So resources :products will create 7 different restful routes for CRUD operations for resource products. For example: products GET /products(.:format) products#index So restful route includes only controller name within itself and :id for operation like edit, show, update, delete. When i crea

[Rails] Restful Routing and restful versus non-restful routes

2013-11-18 Thread Srdjan Cengic
So resources :products will create 7 different restful routes for CRUD operations for resource products. For example: products GET /products(.:format) products#index So restful route includes only controller name within itself and :id for operation like edit, show, update, delete. When i cre