Ruby on Rails Wednesday, July 19, 2017

hi all i want  to solve my problem i need to download a minimal projet and if i bundle them i have a mistake saying.



Le mercredi 19 juillet 2017 23:17:21 UTC-4, babacar thiam a écrit :
Hi in my item view i want to know how to add item using the user id who connected in my app i doo link user to item

Le mercredi 19 juillet 2017 21:45:53 UTC-4, babacar thiam a écrit :
Yeah i see and then if i wan t to load data at item html.erb i have a problem for my user id because i have a link to user and item in item table.


Le mercredi 19 juillet 2017 21:26:01 UTC-4, David Gleba a écrit :
Do this in your project folder at command prompt.


rails generate scaffold User2 email:string encrypted_password:string reset_password_token:string reset_password_sent_at:datetime remember_created_at:datetime sign_in_count:integer current_sign_in_at:datetime last_sign_in_at:datetime current_sign_in_ip:string last_sign_in_ip:string confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string failed_attempts:integer unlock_token:string locked_at:datetime name:string role:references --no-migration



###  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# add new lines of text after patrn...

filetarg='app/models/user2.rb'
r1tmp="/tmp/_temprubyrunner_${USER}.rb"
cat << 'HEREDOC' > $r1tmp
  repl2 = %Q{
  self.table_name = 'users'
  }
  ARGF.each do |line|
    puts line
    puts repl2 if line =~ /ApplicationRecord/
  end
HEREDOC
ruby $r1tmp $filetarg > $filetarg.tmp
cp $filetarg.tmp $filetarg; rm $filetarg.tmp

###  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  

--
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/5946515f-00b4-4a40-b83e-9bfe0a5673cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment