You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
On 2 February 2014 16:01, Astm Ali <li...@ruby-forum.com> wrote:
> Guys now i want to add just data in my users Table just for test with it
> so I'm trying from use this code
>
> users.create(:name => "admin",:user => "admin",:pass=> "123")
Try User.create it is a class method of the model.
Colin
>
> in the seed file then when it trying to run rake db:seed
>
> it always gave me the error [undefined local variable or method 'users'
> for main : object]
>
> my table structure was
> create_table :users do |t|
> t.string :name
> t.string :user
> t.string :pass
> t.timestamps
>
> so i want to know what is the best way to add data to the DB
> using the seed file
>
> --
> Posted via http://www.ruby-forum.com/.
>
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
when i used the command
User.create(:name => "admin",:user => "admin",:pass=> "123")
it gives me the same error
but then i used the command
Users.create(:name => "admin",:user => "admin",:pass=> "123")
it not gave me any error
now when i tried to use the command Rails c then Users.All
to show the data from the command screen
it gave me the error ( unintialized constant Ur)
Colin Law
unread,
Feb 2, 2014, 1:00:58 PM2/2/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
On 2 February 2014 17:04, Astm Ali <li...@ruby-forum.com> wrote:
> when i used the command
> User.create(:name => "admin",:user => "admin",:pass=> "123")
> it gives me the same error
> but then i used the command
> Users.create(:name => "admin",:user => "admin",:pass=> "123")
> it not gave me any error
What is the model name in user.rb? It should be User not Users.
Colin
> now when i tried to use the command Rails c then Users.All
> to show the data from the command screen
> it gave me the error ( unintialized constant Ur)
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.