Alan Reid

Joined

55,860 Experience
467 Lessons Completed
8 Questions Solved

Activity

Posted in Update an attribute on belongs_to

I think the second option maybe quickest, for now, I can always go back and refactor the code to improve it later.  At present, I just need to be able to assign a `produduct_group` to a product and let it be updated when editing the product.

How would I go about doing this?

Posted in How do I generate dynamic classes?

I did something like this when I was working out the column widths once, maybe you could do similar.

$grid-columns : 16 !default;
$grid-gutter : 0% !default;
$column-width : 100 / $grid-columns;

// Lets calculate the column widths, outputs in %'s
@function grid-column-width($n) {
@return $column-width * $n - ($grid-gutter*($grid-columns - $n)/$grid-columns);
}

@for $n from 1 through $grid-columns {
%col-#{$n} {
width: grid-column-width($n);
}
}

Posted in Update an attribute on belongs_to

Hi all,
I have my products and groups set up like so...

class Product < ApplicationRecord
  has_many :product_groups
  has_many :groups, through: :product_groups
end

class Group < ApplicationRecord
  has_many :product_groups
  has_many :products, through: :product_groups
end


class ProductGroup < ApplicationRecord
  belongs_to :product
  belongs_to :group
end

Basically, a product belongs to a group. All seems to work well.

Now I have a form which is updating the product attributes perfectly well. However, how would I go about updating the group the product is in? I have tried to Google this, but there doesn't seem to be anything which helps.

All help would be much appreciated, thanks.

Had an interesting message from a GoRails member (Jacob) which mentioned what music we listen to as we develop. It's a great discussion starter and could be cool to share playlists from Spotify, or tracks that really help you get int he zone as you're building up your apps.

We could even create a GoRails Spotify playlist. And if you don't use Spotify what do you use?

So to get us started, I have been listening to these acoustic playlists they get updated every so often. But I find them great to have playing in the background. 

Hot Acoustic Covers and Acoustic Cafe Mornings

Posted in Lots of trouble using LESS in a paid theme.

You could take a look at this site - http://less2scss.awk5.com

Depends how complex it is, cause it's quite easy to convert manually.

Posted in How do I create a Zapier integration with a rails app?

I have messed with Zaps in my previous job, and had a form submitting via Zapier into a Google Sheet.

Hopefully this Medium article can help?

https://medium.com/@ThatGuyTinus/rails-to-anything-integrating-zapier-via-webhooks-3e51a8f6a54f

Have you taken a look at Devise Roles? It will make your life a lot easier this way.

https://github.com/plataformatec/devise/wiki/How-To:-Add-a-default-role-to-a-User

Posted in Saas-Mixins

could you post a code sample?

Posted in What are your goals for 2018?

Hatchbox is an amzing platform! Crystal sounds interesting, i may take a peek at that too.

Post like these are great, and they allow you to see if you managed to hit your goals for the previous year too :) I didn't haha

Posted in What are your goals for 2018?

Hello all,
Last year I posted a similar post, and it was really popular. So first off how many of your goals did you complete? Here's the previous post as a reminder of what you may have posted.

So let me start the thread off...

Well 2017 was a crazy and busy year for me, other than beign a dad to my 3yo son (going on 18) I changed jobs twice and am now happily working to improve the fintech industry at Bud. Bud is a cool little app (Web, iOS and soon Android) which aggregates all your finacial products, some exciting times and busy ones to come!

So i got my Pi's all up and running, but never actually used them to host anything. So this will once again be a goal for 2018.

Other things i want to achive

  • Better understandig of VueJS, and Node.
  • Rebuilt my personal site, and contribute articles to medium again - maybe a development post a week.
  • Finish off my Pi project (one day, haha) and host a project.
  • Contuning to improve my development skills, and get back into rails on my side projects.
  • Get back into contributing to GoRails, i havent done enough during 2017 so want to get more involved int he community here.

So ladies and gentlemen, what are your goals for 2018?

Don't forget to have an amazing Christmas, and a Happy Ner Year!

Posted in 2 sites... 1 DB?

knew i could trust asking in here!

yeah an API would have been my first option as it sems the most logical, however now you have mentioned ActiveResource i think i will have a look at that :)

basically i need to have them running off the same DB, but i want to keep the sites seperate so each site can be updated without effecting each other.

thanks for all the infor Chris, and Jacob. :)

Posted in 2 sites... 1 DB?

Hello all! It's been a while since i was here, but i am back!

So today I would like to get some opinions on a project I am working on. So here we go...

What would be the best way to architect 2/3 sites (one comsumer, one business, one godmode/admin - maybe) running off one DB?

One solution i have come up with is to have an API, which dones all the leg work, then the sites - and eventually mobile apps could use that to deal with data. I assume this would need to be token based auth so its secure, and i think Chris has a great video covering this.

An other would be to edit a connection string, but i dont know if you can do that in Rails, i know you can in .NET which is why i thought about it.

Any one else have a better solution? All help or suggestions would be much appreciated thanks :)

Alan

Posted in Dynamically create sass variables in rails

Inline styles are not ideal, you could always create a class, and reference it in the header in a style tag. Then inject the colours into that?

<style>
.custom_class_1 { color: colour here; }
.custom_class_2 { color: colour here; }
</style>

then maybe set the colour in the application controller and cache it somehow?

Posted in Freelance advice

I agree with Chris on what he posted. For me a lot of the work i got when i was doing freelance work was via old contacts and recomendations which made it much easier.

One thing i would say, and its VERY important, have a contract!! Don't start any work before its signed, otherwise you will find yourself doing work for free - not good. I was burned from this as i forgot to get it signed.

Test the water with your daily rate, you will find that people who value the work you do and your skillset will pay the premium. You will also find some who want it cheaper, seriously dont budge on your costs as you then start to devalue yourself. You will find most people will pay what you charge (DON'T FORGET THE CONTRACT!!). Also, have a look online to see the contractor rates for the work youre doing. I know you can get up to £450 (plus VAT) a day for development in the UK - obviously depending on your skillset.

Working from home can be hard, there are lots of distractions. I would suggest here that you make sure your work area is cornered off from the rest of your home - or pop to a local coffee shop if you can. You need to try and avoid the distractions, but once you can you will be well away and get things done.

Marketing wise, I would suggest learning the basics of SEO for when you build websites. Its not just an extra you can charge for but it will make sure you write clean code. As for self marketing, get yourself a site and show off your work, maybe blog or post to Medium just to get your name out there. You will soon find work coming in without the need to self promote too much, mainly from word of mouth.

Posted in Anyone with experience using Quilljs?

I have used Quill, it wasn't too bad to implement if i am honest. I didnt use any Gem, i simply included the require JS script and the div. It really was that simple.

I would agree with others here, Google is a massive help. But Chris has built a fantastic comminuty here at GoRails along with a wealth of amazing resources. With that I would say never be affraid to ask questions, there is always someone out there who can provide you with the help and advise you are after.

Don't give up, keep going!! Remember you have a whole community here to help and get you through the times where you keep hitting your head against a wall! haha

Posted in What do you listen to while coding?

This weeks choice of music has been the Aucoustic Cafe playlist on Spotify :)

https://open.spotify.com/user/sonymusicuk/playlist/3ekxdy8ikOr87XuyPmgSqJ

Posted in How to make form fields to display placeholder text?

haha no problems mate ill see if i can get a sample togeher using your screens to try show what i mean.

Posted in How to make form fields to display placeholder text?

Ok back, sorry about this got dragged off onto some other tasks haha.

Any how looking at how the data is loaded it seems that item is getting prepopulated when you load yo the show.

Ideally what you want to do is not load that item on that textbox and only highlight one of the selected projects, and have the new task seperate. So when you click add project (the + icon) it takes the name from that box and creates a new project.

This would be the same for the task too.

I have it in my head, and may not have explained it properly haha but hopefully you can get an idea of what i am talkign about.

Posted in How to make form fields to display placeholder text?

Hi Aidan,
Give me a sec just rewriting this post :) I can see what your issue is.