comments

gem devise how to add comment created user email?

浪尽此生 提交于 2020-07-23 04:55:28
问题 I am using gem devise for creating users profile Each user can create a comment. I need to add the user name beside each comment something like this <%= @comment.user.name %> in user.rb has_many :comments, dependent: :destroy in comment.rb belongs_to :users in comment controller before_action :find_comment ,only:[:show,:update,:edit,:destroy] def new @user =User.find(params[:id]) @comment = @user.comments.build end def create @user =User.find(params[:id]) @comment = @user.comments.build

gem devise how to add comment created user email?

本秂侑毒 提交于 2020-07-23 04:54:16
问题 I am using gem devise for creating users profile Each user can create a comment. I need to add the user name beside each comment something like this <%= @comment.user.name %> in user.rb has_many :comments, dependent: :destroy in comment.rb belongs_to :users in comment controller before_action :find_comment ,only:[:show,:update,:edit,:destroy] def new @user =User.find(params[:id]) @comment = @user.comments.build end def create @user =User.find(params[:id]) @comment = @user.comments.build

Align inline comments to a certain column in VSCode

江枫思渺然 提交于 2020-07-20 07:48:08
问题 I'd like to organize the inline comments in VSCode so that they are all positioned in the same column. From this: int a = 0; //comment 1 int b = 0; //comment 2 int c = a*b; //comment 3 To this: int a = 0; //comment 1 int b = 0; //comment 2 int c = a*b; //comment 3 Tried using Better Align Extension but that didn't really work, as it only formats correctly lines that have an equal sign, like something = something. Is there any other way to do this? Thanks in advance. 回答1: You can do it with a

Get all comments on a post by an array of users

那年仲夏 提交于 2020-07-06 03:17:28
问题 I'm trying to get all the comments from a post by an array of users. This is what I'd like to be able to do: $user_ids = array(10, 22, 41, 80); $post_id = 57; $args = array ( 'number' => -1, 'user_id' => $user_ids, 'post_id' => $post_id, 'status' => 'approve', 'order' => 'DESC' ); $comments = get_comments( $args ); Now obviously this doesn't work , but that's what I'd like to do. Is there any other way to achieve this? Maybe using a custom select? 回答1: I've built a WPDB query based on the

Get all comments on a post by an array of users

巧了我就是萌 提交于 2020-07-06 03:14:55
问题 I'm trying to get all the comments from a post by an array of users. This is what I'd like to be able to do: $user_ids = array(10, 22, 41, 80); $post_id = 57; $args = array ( 'number' => -1, 'user_id' => $user_ids, 'post_id' => $post_id, 'status' => 'approve', 'order' => 'DESC' ); $comments = get_comments( $args ); Now obviously this doesn't work , but that's what I'd like to do. Is there any other way to achieve this? Maybe using a custom select? 回答1: I've built a WPDB query based on the

“Couldn't find <object> without an ID”

末鹿安然 提交于 2020-07-05 09:58:12
问题 I'm having problems implementing a kind of comments form, where comments (called "microposts") belong_to both users and posts, users have_many comments, and posts (called "propositions") have_many comments. My code for the comments form is: <%= form_for @micropost do |f| %> <div class="field"> <%= f.text_area :content %> </div> <div class="actions"> <%= f.submit "Submit" %> </div> <% end %> The MicropostsController has this in the create action: def create @proposition = Proposition.find

Looping through mailitems in Outlook macro freezes Outlook in large sets of mailItems

穿精又带淫゛_ 提交于 2020-06-29 03:33:29
问题 I am trying to loop through the mailItems of different subfolders looking for a comment (with PropertyAccessor) in different stores. My code works perfectly when given 1-3 stores and around 2000 mailItems, however as the number increases in the live testing it crashed Outlook not responding anymore. Do you have any idea how I could do it more efficient? I have implemented: Date filtering MailItem release And I am trying parallely the Application.AdvancedSearch method, however not managing yet

How to format comments with one space between // and words?

旧街凉风 提交于 2020-06-16 04:02:19
问题 How to automatically format comments with one space between // and words? For example, selecting format in my editors should convert //login to // login public interface LoginService { //login // -> // login SysAdminDO login(LoginForm form); } 回答1: You are probably looking for the setting Editor ~> Code Style ~> Java(language) ~> Code Generation Or else you can alternatively use Comment with line comment shortcut Just type a line and on that line use the shortcut. e.g. String var; I would

How to format Visual Studio XML documentation for display on the web

天涯浪子 提交于 2020-05-26 14:36:09
问题 I am using Visual Studio 2010 and have started being a good boy and documenting all my code as I write it, via XML comments. I have a well-documented project and I even figured out how to make Visual Studio spit out a complete XML document when doing a build. My question is, what is the best way to format/display this document on the web so that it appears in a nice friendly and usable format like MSDN? Is there a tool that does this easily? Thanks in advance! 回答1: Check out Sandcastle Help

How to open WhatsApp using an Intent in your Android App

老子叫甜甜 提交于 2020-05-25 03:36:49
问题 I want an Intent to take control you directly to WhatsApp. So the moment the user clicks on the button, the Intent is supposed to take you to WhatsApp. This is the code I wrote after following a few guide lines but it doesn't work buttonWhatsapp.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Performs action on click Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");