The IT World
Hello!
It’s been a month since my last post here. I’m more than happy to say that things have been going very, very well for me. Right now I’m testing the software, learning how to look into some products and how to write automated tests. The knowledge, which I’ve gained during the last few months, makes me more comfortable with learning new things. I’ve been learning Ruby till this day but now there’s nothing to show and to be proud of.
I hope I’ll write posts more often. 🙂
Have a great day
Thank you for reading,
Janek
Back after holidays.
Hello again!
I’ve been working in the IT industry for almost 2 weeks. And I am very happy to be here, it looks as if I was dreaming. I have a great team and I learn something new every day. I still love ruby language and that’s why I still learn in my free time. I would like to show you what I’ve created so far:
https://murmuring-coast-73957.herokuapp.com/
https://github.com/Yankowski/simpleapp
It hasn’t been completed yet but some things have been already done. I am learning how to use bootstrap components. I created this website because I want to revive what I’ve learnt so far as not to forget it. I’ve had some breaks lately because of different reasons but it is good to be back :).
Thank you for reading,
Janek
Dreams come true!
Hi!
I want to announce that I am very happy! Thanks to Arkency from September I am starting a new job as a tester! I am so excited! Thank you Arkency! Now I will be writing about stuff that I am actually learning.
UPDATE:
For the next two weeks (08-22.08) I will be on holidays. So I will start writing after I will come back!
Have a nice day!
My first React code
Hello again!
I am proud to say, that I have finished my first React application. It is very simple right now. I’ve done it in a very very simple way and stored it on rails app in a public folder. Please forgive me, but I’ve wanted to start with something small, so I have created (with help of the Internet and some Udemy courses) my first calc in React!
My code:
https://goo.gl/GZarvB
And the result:
https://goo.gl/Yk0H2U
Thank you for reading,
Janek
Hi!
It has been a while, but I have been learning all that time! To be honest, I had some troubles with the new stuff as I was trying to install node.js; webpack; npm modules on my computer but it is finally working now! In the meantime, I have been preparing some simple React app, which I would like to show you soon.
I want to tell you about my first experience with the conference. Last week, I was at #Grillrb.com conference in Wroclaw, where I met many people, most of whom already work as developers in Ruby/RoR.
It was a great experience – during the first day we were outside on Ander’s Hill (it was hot, but we had big trees, which gave us some shadow, and we also had cold drinks!)
We started with watching soccer game: POLAND-SWITZERLAND, and after the great game, the conferences started.
I found these conferences interesting, they were understandable for a person who is not much experienced in programming. I spent a nice afternoon listening and eating food from barbecue.
The second day, we spent in an old brewery due to the bad weather, but the interesting topics were continued there. Below you can find some pictures from that event. I will also go there the next year!
Thank you for reading,
Janek
The next step
Hi!
Right now I will start to touch a little bit of Front End world. My goal is to learn the following technologies:
-JavaScript
-Ract.js
So it looks like there will be a lot of work for the beginning. I will begin with React By Example book by Arkency. Ihave installed Node.js, Webpack and Babel. Right now I will start to configure my Webpack so I can work with examples from this book.
Hope to provide you more information about my progress in next post!
Thank you for reading,
Janek
Shopping cart done!
Hello!
Finally, my code is working!:) I have done a little part of a shop panel – I have created an app, in which you can add some products to the shopping cart, and confirm it to make an order.
My last troubles was:
- to create correct link to
CLEAR CART
button - to create an sales report for every product
- to properly put my cart into order
I think it is a great exercise for each and every young rails developer. Using a session is very helpful, because you can store some useful data there.
I have also decided to create a direct link in my browser in order to solve my problem with CLEAR CART
button I wrote the following piece of code in my routes.rb:
post '/clear_cart' => 'cart#destroy', as: "clear_cart"
And to display the report I created a sum
method (but this time with each method)
def sum result = 0 line_items.each do |line_item| result += line_item.total_price end result end
Please have a look on my app:
https://powerful-retreat-73477.herokuapp.com/
Thank you for reading,
Janek
shop panel – cart – part II
Everyone has many duties during the day, so do I, but I am so motivated to learn how to be a rails developer that I find some time for learning. Sorry that I haven’t been writing very often lately – it is caused by a big amount of work which forces me to reduce my time spent on programming. But here I am again, and I want to share what I have learnt recently – each next week with ruby is great, I really like this languages, I feel that I am not fluent when it comes to Model-View-Controller things, but every day I learn more and more.
So, during this week I have had my ‘Add to Cart’ button working.
Right now I have three models:
Cart
Product
Line_Item
Please have a look:
class Cart < ActiveRecord::Base has_many :products, through: :line_items has_many :line_items, dependent: :destroy def add_product(product_id) current_item = line_items.find_by_product_id(product_id) if current_item current_item.quantity += 1 else current_item = line_items.build(product_id: product_id) end current_item end end # class Cart
class LineItem < ActiveRecord::Base belongs_to :product belongs_to :cart def name product.name end end
class Product < ActiveRecord::Base belongs_to :cart has_many :line_items before_destroy :ensure_not_referenced_by_any_line_item private def ensure_not_referenced_by_any_line_item if line_items.empty? return true else errors.add(:base, 'Line Items present') return false end end end # class Product
So, right now my code is working and I can see in my console/site that the products are held in my session.
I have added the following code to my Application Controller:
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception private def current_cart Cart.find(session[:cart_id]) rescue ActiveRecord::RecordNotFound cart = Cart.create session[:cart_id] = cart.id cart end end
My next goal is to create a confirmation for this card so an order may be created.
Here you can see it in Console:
Hope to write to you soon!
Thank you for reading!
Janek
My first recruitment task
Hello!
As I had told you before, I had a business trip, which made me unable to code during that time. But at the moment when I came back to my city, I got my first recruitment task to do. I had to write an application, which creates a bill for contract work agreement. I was very pleased that I got my first recruitment task after such a short period of time here! I learnt a lot and although it was not right time for me to start a job at this company, I am very happy for my first try!
I did not finished the whole application due to the lack of knowledge/time, but here you can see what I managed to do:
<%= form_for @agreement do |f| %>
<%= f.label :gross_amount %>
<%= f.text_field :gross_amount %>
<%= f.label :purchaser_id %>
<%= f.select :purchaser_id, User.all.map { |user| [user.name, user.id] } %>
<%= f.label :executor_id %>
<%= f.select :executor_id, User.all.map { |user| [user.name, user.id] } %>
<%= f.label :deductible %>
<%= f.select :deductible, [[‘Low’, 0.2],[‘High’, 0.5]]%>
<%= f.submit ‘Save’ %>
<% end %>
It was one of my first attempts to use the select method. And I even managed to put some calculating methods, which are counting my tax rate:
https://github.com/Yankowski/bill/blob/master/app/models/agreement.rb
Thank you for reading,
Janek