Should I use a Model or Not for my Rails App? - ruby-on-rails-4

I'm new to RoR and hope I'm not in over my head here. So I currently have a user, product and 'order` models. My site just to give some context would be like using a paid Craigslist. You pay Craigslist upfront a flat fee (order), and then you can create your listing on their site (product).
My question is the flat fee portion of the site (let's call it packages) and whether to use a model or not? Currently there are 3 packages with 6 options. (eg - A $10/mth or $100/yr, B $20/mth,$200/yr, C $30/mth, $300/yr)
I assume if a model is not used, some type of JS is probably used, which I'm not super comfortable with yet. Any thoughts on what would be the best practice approach to this is appreciated.

I ended up going with setting up a MVC and seeding the database with the fixed prices for each package. Then in the create form, I added a hidden_tag that identified which package price should be passed to the Charges model to effectively charge the right price depending on the package chosen.

Related

How can I remove the "unlink relationship" either permanently, user based or amount of relationships?

On SugarCRM 7+ how can I remove the "unlink relationship" either permanently, user based or amount of relationships?
My problem is that I have two custom modules with a many-to-many relationship between them and I can't limit a user from editing, deleting or creating records on both modules since I actually want the users to be able to do those actions etc but at the same time I need to block unlinking of relationships either:
permanently
user based
based on the current amount of relationships
I've gone through a lot of google searching (about 7 hours total) but I couldn't find a tutorial or blog post about this type of customization for SugarCRM 7.1+ (I feel things changed a bit on subpanel customization on this version)
also, is there a way to easily add a "created_datetime" and "deleted_datetime to the relationship itself? I found a few "overkills" for such customization and my sugar skills are not that high to implement them.
I've decided to have extra modules making the relationships so then I have a related field on each of my current modules pointing to a module in the middle where I can customise fields anyway I want "and" I will block the related fields from modification based on user and if the field has been set already etc.
This is an obvious solution but I wanted to have less modules for plain and simple OCD. Once I convinced my brain that not being able to customise the relationship with "control" fields was even worse for OCD than having more modules everything settled down!

Guidance on building simple django application for feature testing

I am currently building a simple site where users can login and write comments. Its somewhat similar to a forum but difference is that users will see image/an article and they get to comments on things based what they see. In addition they also get to rate what they see in 5 star scale or thumbs up thumbs down.
I have build this site using django now I want to add another application where I can control who gets to see the 5 star scale vs. thumbs up and thumbs down scale after they log in to the site. I want to randomly pic users as they come into the site and make sure half of the user population see one scale vs the other.
Here are my questions:
How should the random selection take place? Does django has inbuilt function or functionality to do such randomization?
Can someone provide simple example?
Here is my thought process on building such thing:
We create a model where we keep track of the userid, experimentGroup(5 Star or Thumbs up), Time
Then in each template we check if which group the user is in and based on that we adjust the users view?
I am new django so it would be great is someone provides a simple example so I can built upon that. After doing google search I found out a very heavy django application but I would rather user something simple that I can understand and control with my limited knowledge.
You can get objects in a random order by using (from django docs):
<YOUR_MODEL>.objects.order_by('?')
The exact queryset depends of how you define your models
Also django provide a template filter to random a list of items (see django docs)
Last, if above is not enough you can use python random module

ContextualHelp on Infragistics XamFormulaEditor for custom variables

I am using DataGrid for displaying table. One of the columns in Datagrid consists of XamFormulaEditor. Also, there are some custom variables that are assigned to XamCalculationManager's Named references so that they are visible to user when he types formula in XamFormulaEditor. I have couple of problems with ContextualHelp:
For Eg. if the custom variable name is "a", then in ContextualHelp list it looks like [//a]. Isnt't there any settings to make it look like [a] ?
Is there any way to filter the contextual help to not display standard functions and only display variables that we want ?
After looking into this and doing some research, ContextualHelp on Infragistics XamFormulaEditor for custom variables has been determined to be a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at Infragistics new site for features:
http://ideas.infragistics.com.
There are many benefits to submitting an product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).
Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
Add your product idea and be sure to be specific and provide as much detail as possible. Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.

Joomla 2.5 registering different kinds of users

Maybe this isn't the correct place to ask, but I asked this question on Joomla forums and did not get any answers. If someone can help me or at least point me in the right direction, I would really appreciate.
My question is: In a Joomla 2.5 website, I want to create two different kinds of forms for registering users. Maybe "registering" isn't the correct term. I want to create something like a very simple database which will hold records for two kinds of users:
- one which will be interested in working in projects, so in this case the form will have more fields and specific details to fill
- one which will be interested only in receiving newsletters from the site, and in this case only basic contact information will be required.
I did some research and found an extension named AcyMailing which can handle the newsletters for example, but I need to have all my potential users registered as Joomla users. I would like to avoid that if possible. If not, how can I differentiate the two kinds of users on registration, so the visitor can choose which option he wants and in this case, add more information to the registering process, if possible.
I'm not very experienced with Joomla, but since the site in question is already implemented using it, I don't have much choice.
Thanks in advance!
Chronoforms. Most definitely here would be a great use for their AWESOME free component. Your forms can work as registration forms (should you desire that); or can also just be free standing forms that log the information filled out on them to your database which you can later use however you would like (i.e. compiling a mailing list or something of that sort).
The form wizard makes it almost bullet proof, then you can have a form for 1 type of user to fill out, and a form for a different user build different ways.
That will get you the data - in order to mass mail those people you'll need a way to extract their emails out of the database (or find an email component that will let you email based on certain fields in the database or what have you); but it's totally possible and would be easily done I think with 1 simple mySQL query on your database table created by chronoforms.
In terms of something that will solve your issue quickly and get you the info you're looking for in two separate ways - chronoforms will do that exactly.

Django multi-criteria weighted rating

I've started building an app in Django that will require multi-criteria weighted ratings. My issue is the exact same as this one from a few years ago, which unfortunately did not have any answer.
If anybody out there can give me some hints on how to make multi-criteria weighted ratings in Django, I would love to hear about it! I'm pretty new to the whole Django/Python world and come from a PHP background.
Thanks a lot!
PS: I did not put too much info in this thread, because the problem is already described on the other topic here. It's exactly the same thing.
The easiest solution for the weighted rating would be to add an additional field and populate it automatically in a custom save method on the rating object.
As far as getting the overall average rating goes, you can either calculate it dynamically every time it's needed (easiest/most accurate method) using Django's aggregation queries, or you can try to maintain an average rating field that is updated each time a rating is added/deleted/updated (the more performant method if you're running a read-heavy service). See my answer here for more details on implementing these (using sums rather than averages) and more detail on the tradeoffs.
If you do not want to create a separate field that you need to maintain by overriding the save method, you need to follow this slightly more complex approach: Using .aggregate() on a value introduced using .extra(select={...}) in a Django Query?