Prototypal inheritance

prototypal inheritance in Javascript and the difference between prototypal inheritance and classical inheritance

Angular JS for dummies

  AngularJS is an open source JavaScript web framework that is built for front end and it is aimed to make web apps simple to build and easy to maintain. It is currently being mainly maintained by Google and a massive community of developers. AngularJS is a single page application that handles routing and all of interactive…

Javascript Hoisting

One of the biggest difference between Javascript and Ruby is the order of the execution of code. Before I learned about Javascript, I’ve heard that javascript works asychronously sometimes(when it’s making AJAX calls, requesting data from server), but I was not even familiar with the word hoisting. So, what is hoisting? Hoisting is JavaScript’s default behavior(well-intended…

Mastering Rails Forms!

After learning Sinatra, I must say Rails is one powerful web application that has many useful features added to it. While I was working on my rails assessment, I realized that I didn’t have a firm knowledge of Rails on some materials since I had to go back and forth to labs and references several times to…

[Rails][LERN] From Pollywog Ranch Lab (08/09/2016)

<%= form_for @tadpole, url: “/tadpoles/#{@tadpole.id}/metamorphosize”, method: :post do |f| %> <%= f.submit “Become a frog” %> <% end %>   <%= form_for @tadpole, url: {action: :metamorphosize} do |f| %> <%= f.submit “Become a frog” %> <% end %>   Those two forms above which are in tadpoles/show.html.erb  act as same. *metamorphosize* is method in TadpolesController….

Finding Objects in Database: ActiveRecord Queries Over Raw SQL

As I was working on one of the labs on Rails called ‘Model Class Methods Lab’, I struggled a bit when it required me to write ActiveRecord queries for retrieving  specific objects from data with complexed associated models/tables. I would like to go over some of the ActiveRecord Query methods in this blog post so that…

My Sinatra Assessment: TOTD forum

For my sinatra Assessment I created a web CRUD app of a forum that gets data from twitter trend api. The data is parsed and then sorted by volumes. The selected top 10 data become the topics of the day, which means that the topics are the most popular twitter trend /hashtags of the day….

[Rails]Rendering Collections

Use the collection keyword with partials Pass a collection to the render method Handle empty collections OVERVIEW Up until now our only way to render collections was somewhat manually. We could iterate over an array and render the partial for each object in the array. Let’s see how Rails can abstract this into a nicer…

[Rails] Nested Attributes Problem of Today

1st problem   def user_attributes=(user_attributes) user_attributes.values.each do |user_attribute| user = User.find_or_create_by(username: user_attribute) if user_attribute != ” self.user = user end end >>>>>>>>>>>>>> THE ABOVE  WIL GIVE ME A NIL VALUE FOR USER   def user_attributes=(user_attributes) user_attributes.values.each do |user_attribute| self. user = User.find_or_create_by(username: user_attribute) if user_attribute != ” end end OR def user_attributes=(user_attributes) user_attributes.values.each do |user_attribute| if user_attribute…

[Rails] Activerecord Associations Review

CONVENIENCE BUILDERS BUILDING A NEW ITEM IN A COLLECTION If you want to add a new post for an author, you might start this way: new_post = Post.new(author_id: @author.id, title: “Web Development for Cats”) new_post.save But the association macros save the day again, allowing this instead: new_post = @author.posts.build(title: “Web Development for Cats”) new_post.save This…

[Rails] collection_check_boxes

from posts_controller    private     # Use callbacks to share common setup or constraints between actions.     def set_post       @post = Post.find(params[:id])     end     # Never trust parameters from the scary internet, only allow the white list through.     def post_params       params.require(:post).permit(:name, :content,…