-
Create unique id in link_to tag rails
Create unique id in link_to tag rails <%= link_to “Edit”, edit_question_path(question.id),method: :get, :remote => true, id: “myBtn_#{question.id}” %> This is how you can create a unique id using #. id: “myBtn_#{question.id}”
-
Edit using ajax
Edit using ajax Step 1: In your index.html.erb Add :remote => true, :class => ‘class_name’ in app/views/controller_name/index.html.erb. Like this,
-
Delete using ajax and fade out
Delete using ajax and fade out Step 1: In your index.html.erb Add :remote => true, :class => ‘class_name’ in app/views/controller_name/index.html.erb. Like this, <%= link_to “Delete”, question_path(question.id),method: :delete ,data: { confirm: “Are you sure?”}, :remote => true, :class => “delete_question”%> Step 2: Create a file, destroy.js.erb, put it inside folder .erb files (under app/views/controller_name). It should look like this: console.log(“here”) noty({text:…
-
ArgumentError in class#create while applying Ajax.
ArgumentError in class#create while applying Ajax. For these type of errors you must hav not initialized the vairiable with new keyword causing it to make a empty class. <%@answer=Answer.new%> <%= form_for @answer, remote: true do |f|%> <%= f.text_area :content ,placeholder: “Write your answer”, :class => ‘a2’, required: true%> <br> <%= f.hidden_field :question_id , :value =>…
-
Changing the name of already made Heroku app??
Changing the name of already made Heroku app?? Step 1: This step will create an app with some arbitrary name $ heroku create Step 2: This step will show the url of the remote servers that you have config. $ git remote -v Step 3: In this step go to your app on heroku and rename it…
-
Relative div is passing over fixed div while scrolling page
Relative div is passing over fixed div while scrolling page To solve this problem we should use property name z-index. So now , HTML =”navcontainer”>This is navigation =”movable_relative”> =”text”>text </div> CSS #navcontainer { position:fixed; z-index:3; } .movable_relative { position:relative; z-index:2; } I hope your problem will now be solved.
-
Adding time at which tweet or any text created in rails
Adding time at which tweet or any text created in rails So, for adding time use the above code if tweet or text was added before 24 hours then it will display as 2 hours ago or 4 hours ago and if more than a day time then it will display date. <% if…
-
Link_to tag color change
LINK _TO tag color Working on rails is quite different. The link_to tag is used to give links to texts on rails. To change its color, just add a line style: ” color: color_name” refer the image above for more clearity.
-
RAILS adding image through .scss file
RAILS adding image through home.scss file or any .scss file For working on .scss file we have to take care of how to add an image though this file. So first of all we have to use simple background-image tag background-image: url(‘your image url’); now add these lines , -webkit-background-size: cover; -moz-background-size: cover; -o-background-size:…
-
NameError in Devise::RegistrationController#create
NameError in Devise::RegistrationController#create If you get this kind of error while using Devise in your rails project, you have landed to right place. Let us first know why we got this error. This error indicates that you have not correctly fixed the permissions on devise. IS THE USER MARKED CONFIRMABLE???? Now we directly jump to…