Ruby on Rails Wednesday, July 19, 2017

I see your git i check this 2 item and i import your implementation for testing.
for the first step my friend say me to use this git https://github.com/605data/strongbolt_example and for me i have this information for your git brail.
You suggest me the strong bolt guide or your example.
For the first item 1:
i see the problem was solved. In a simple example if i add user or item or role at the seed.rb file it run normally and me i need to add user or item in the html.erb file? 


Le mercredi 19 juillet 2017 19:07:46 UTC-4, David Gleba a écrit :
For your second item:

I suggest that you download this:  https://github.com/dgleba/brail347a22

  • cp  config/database-example.yml    config/database.yml   
  • cp  config/application-example.yml config/application.yml
  • cp  config/secrets-example.yml     config/secrets.yml    

  • Check db/../..seeds*.rb for username and password.
  • bundle
  • rails s
It was recently created by bashrail.


For your first item: 
If am answering your question, I would scaffold User2 to match the User resource.
Then, change the table name in user2.rb to the user table.

Like so,  
self.table_name = 'users'

This will allow you to edit the users table from user2/ url.

I will add this to bashrail when I get a chance.





On Wednesday, July 19, 2017 at 2:47:20 PM UTC-4, babacar thiam wrote:
yeah its great david i havent problem if i had a user in my seed file (for example) and then i need to add new role new user or new item for my html.erb file and i don't know how i do to link user and item if i add item example.
Second wan't to know if its possible to use your projet (david ) to verify something for my user role and admin 
(need to import new projet and doing test for this) 

Le mercredi 19 juillet 2017 06:47:20 UTC-4, David Gleba a écrit :
I may not be answering your question on this one, but I just an admin tool to add a user since the administrator of the system must grant the proper role to the new user. 
So, if am using rails_admin with the project, add the user in that tool and assign the appropriate role_id.

The code can also be setup so a user can sign-up them selves and a default role is assigned.

You can also add a user with a tool such as phpmyadmin, pgadmin, sqlite-browser like http://sqlitebrowser.org/.


On Wednesday, July 19, 2017 at 12:06:09 AM UTC-4, babacar thiam wrote:
yeah in this i want to know how do to insert a new users using user view or devise and respected role.
in my userscontroller if i put at the top: before_filter :authentificate_user i hav and error saying 
use before_action 


Le mardi 18 juillet 2017 22:47:12 UTC-4, David Gleba a écrit :
The article has an app in github.


Can you download it and run it successfully?



On Tuesday, July 18, 2017 at 10:28:33 PM UTC-4, David Gleba wrote:
I see that in one spot you have Admin - capitalized. and in another it is not capitalized - admin.

I wonder if capitalization matters in your code.

Note that we can't see your code.  That makes it harder to help you when we can't see the code.


On Tuesday, July 18, 2017 at 7:07:11 PM UTC-4, babacar thiam wrote:
the error says no MethodError (undefined method `name' for nil:NilClass):

  

app/models/user.rb:15:in `admin?'

app/models/ability.rb:7:in `initialize'


Le mardi 18 juillet 2017 17:15:51 UTC-4, Colin Law a écrit :
On 18 July 2017 at 22:02, babacar thiam <thia...@gmail.com> wrote:
>
> hi i have a mistake since this morning .
>
> undefined method `name' for nil:NilClass
>
> Extracted source (around line #15):

>
> end
> def admin?
>   self.role.name == "Admin"
> end
> def seller?
>   self.role.name == "Seller"
>

As the error says, self.role is nil

Colin


 

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f6f5834a-ca07-4fb7-b263-aeedee292018%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment